We provide a API so that other applications can harness our URL shortening service. You can access this by submitting an HTTP GET request with appropriate parameters.


You’ll receive the generated short URL as plain text response to your request.


The url parameter is the address that you want to shorten. You must URL encode this parameter before submitting it. A lot of languages have a built in function for URL encoding such as encodeURIComponent() in JavaScript, urllib.quote() in Python, and urlencode() in PHP.

custom (optional)

You can specify the custom parameter if you’d like to pick a shortened URL instead of having lk.to randomly generate one. It must be between 1 and 20 characters long and can only contain alphanumeric characters and underscores. Shortened URLs are case sensitive. Bear in mind that a desired short URL might already be taken (this is very often the case with common words), so if you’re using this option be prepared to respond to an error and get an alternative choice from your app’s user.

validity (optional)

You can specify the validity parameter if you’d like to define an expiry date for the shortened URL. It must be an UNIX timestamp somewhen in the future, otherwise the URL will be valid forever.


400 Bad Request

There was a problem with the original long URL provided.

406 Not Acceptable

There was a problem with the custom short URL and/or the validity (if provided).

502 Bad Gateway

Our API is overused (your app should wait before trying again).

503 Service Unavailable

Any other error (includes potential problems with our service such as a maintenance period).