API for qr.cx

v1.1 (last changed 16.06.09)

qr.cx provides a basic API (Application Programming Interface) which can be used to harness our URL shortening service for other applications. This works by accessing a particular URL on the qr.cx site which accepts the long URL you would like shortened as a parameter. The shortened URL (or various error conditions) will then be returned in the HTTP response.

Submitting a URL for shortening

Simply have your application access a URL similar to the following,
via an HTTP GET request: http://qr.cx/api/?longurl=http://example.com

The "http://example.com" parameter in the example above may be replaced by whatever URL you wish to shorten.

After submitting the LONG-URL as specified above, an HTTP response (web page) will be returned. On success the HTTP response will contain only the short url in plain text.
If an error occurs an error message will be printed. It will lead with "error: " and the rest of the message should explain what went wrong.


It is advised to encode the URL to be shortened to be URI safe (e.g.: convert all special characters like space to %20).

Getting an original URL from a shortened URL

If you want to retrieve the original long URL from a URL shortened with qr.cx, the API does provide a function for this; via an HTTP GET request: http://qr.cx/api/?get=http://qr.cx/1r8 or http://qr.cx/api/?get=1r8.
you can be explicit about the plaintext and add "mode=plain" to the query, see below (since v1.1).

There is a method to get a link like this http://qr.cx/1r8. call: http://qr.cx/api/?mode=title&get=http://qr.cx/1r8
this will return a html link with the long url as title (since v1.1).



This service is provided without any guarantee and as is. Links to illegal and suspicious sites will be deleted. Austrian law applies. Please report misuse to abuse [at] qr.cx