We provide an API so that other web-based applications can use our shortening service, storage, analysis and redirection links and images. To access this API just send a request HTTP GET or POST with appropriate parameters from a web page. Follows the descriptions with the all necessary information.

Our API is based on REST requests from the URL address http://api.glurl.co/ . To use it will be necessary to perform a authentication and a subsequent verification of data received so that we can send to your website the result of your request. Please note that this API can only be used with requests made by a dynamic website. If you do not have a dynamic website, we suggest using one of our browser extensions.

Inform the URL of your 'URL Token' page. This page should contain a dynamic code that will receive and send back a API token to our server.

Click 'Edit API'.

Authentication and verification

Authentication of an application is required in all cases. To perform authentication, the user must send the parameter 'apikey' to http://api.glurl.co/authenticate/, as shown below:

http://api.glurl.co/authenticate/?apikey=YOUR_API_KEY

The identification sequence begins with sending query parameters for the Glurl.co authentication service. The server identifies your 'URL Token' and automatically sends a verification token ('ApiToken' parameter) to be captured by the page and returned to the verification service. Upon being accepted, the token validates user credentials and the server releases the information requested.

The data verification should be done by a request GET or POST to the http://api.glurl.co/verify/from your 'URL Token'. Your 'URL Token' page must contain a server-side script to retrieve the 'ApiToken' that will be passed by the API and sends it back to the server. Below is an example in PHP that can be used on your 'URL Token':

1. SHORTENING A LONG URL (SHORTEN)

Shorten a long URL using base64 encoding.

Parameters used:

apikey - (required) String. Required for all requests. Value of this parameter must necessarily be a valid key obtained after you are joined Glurl.co. If this parameter specifies an invalid value, the API returns a null result and redirects to http://glurl.co.

long_url - (required) String. A long URL to be shortened. Without this value the API returns a null result and redirects to http://glurl.co.

alias - (optional) String. Suggests a custom short URL. Values must be necessarily numbers, letters or the symbols '-' and '_' and should have a maximum of 8 characters. Other characters are not allowed. If the 'alias' is already in use, the API returns the following message: 'The URL suggested in parameter alias is already in use' and deny the URL shortening. This option is Case Sensitive.

3. VIEWING THE USER'S HISTORY (HISTORY)

action (required) - String. To use this method, set the parameter 'action' value to 'HISTORY'.

itemsPerPage (optional) - Integer. Indicates the number of URLs displayed at a time. 20 is the default value.

page (optional) - Interger. Indicates the current page of records returned. The default value is 1 (the first page of records whose number can be defined by itemsPerPage parameter) and the maximum value is equal to the total_pages parameter contained in the result of the request. Notice that if the value page is greater than total_pages parameter, the request returns an empty recordset.

protected (optional) - String. Indicates whether the list should contain only public URLs ('TRUE') or not ('FALSE', default).

order (optional) - String. Sets the order of results. If it is not defined, the results are sorted according with the sending time (most recent first). Accepts the following values​​:

clicks - Descending sort according to the amount of hits.

likes - Descending sort according to the number of likes.

shares - Descending sort according to the number of shares.

filter - (optional) - String. Returns only results that match the entered value. When this parameter is not set, all results are returned. The following values are accepted:

This API, as well as other Glurl.co services, has a filter that scans pages suspected phishing practice and malware through a list, constantly updated, provided by Google and Short for Spam URI Real-time Block Lists (SURBL). While attempting to shorten and create a redirect to a page contained in this list, the API will deny the request with an error ('Url rejected. Reason: malware/phishing'.) We know that such prevention practices can be fallible and do our best to improve them constantly.

Example

A simple usage example of our API can be downloaded here. Follows a javascript code used to retrieve data with the callback function.