API / Developer

We provide an API system that you can use to shorten URLs from your own applications and save them in your account in the process. You can also use the API to fetch data about a URL, provided that you have the permission to do so. You can find out more information here below. Please note: No support for integrating api keys on your website at the moment. Sorry. Perhaps in the near future.

We provide an API key for free and for premium user. And that's for free! Every user get an own fresh generate unique API key.


  1. Register an free account here to get an API key or login here (Login with your TO.tc account, facebook, twitter or google+).

  2. Go in your account to "Settings" and to your sidebar on the left side.

  3. Now, you can see your fresh generate API key on the right side below.


(Click the screenshot for large size view.)


Here is the explain how to use the new API of www.TO.tc URL shortener. There were some changes to the API in order facilitate requests from developers.

About API keys: API key english (Wikipedia), API key german (Wikipedia), API key spain (Wikipedia).

Registering for an API Key

As before, an API key is required for requests to be processed by the system. Once a user registers, an API key is automatically generated for this user. The API key must attached to request via the api parameter (see full example below).

Sending a request for shortening a URL

To send a request, the user must use the following format where the variables api and url are required. In the example below, the URL of the demo is used but you should use your own domain name. To request a custom alias, simply add &custom= at the end.


Server response

As before, the response will encoded in JSON format (default). This is done to facilitate cross-language usage. The first element of the response will always tell if an error has occurred (error: 1) or not (error: 0). The second element will change with respect to the first element. If there is an error, the second element will be named “msg”. which contains the source of error, otherwise it will be named “short” which contains the short URL. (See below for an example)

// No errors
// An error has occurred
  "msg":"Please enter a valid email"

Using plain text format

You can now request the response to be in plain text by just adding &format=text at the end of your request. This will return just http://to.tc/DkZOb instead of the JSON response. Note that if an error occurs, it will not output anything.

Using the API in PHP

To use the API in your PHP application, you have to send a GET request through file_get_contents or cURL: Both are reliable methods. You can see a sample code below using file_get_contents.