Users can shorten long URLs through the web interface at https://lst.to, or they can create short links programmatically, through Lst.to API. With the API, you can create applications that use HTTP methods to manage short links.

Please complete the authentication procedure, to start using the API. Enter your email address in the below field and we will send an authentication token to you.


After authentication, you may proceed to the action you would like to perform. Each action is provided with a brief description and an example. All examples use a REST-style JSON protocol.

Limits

Each project receives 10 requests per minute by default.

Create a short link

Lst.to API allows you to shorten long URLs just as it can be done in the web version. Send the following request:

POST https://lst.to/api/v1/link

Headers:

X-AUTH-TOKEN: JkdnskjmnsjOKSaPqd Content-Type: application/json

A request body example:

{ "data": { "type": "link", "url": "www.example.com", "utm": "utm_campaign=[domain]" } }
{ "data": { "type": "deeplink", "url": "www.example.com", "deeplink": { "ios":{ "deeplink_url": "app://www.example.com", "fallback_url": "itms-apps://www.example.com" } } } }
{ "data": { "type": "targeting", "url": "www.example.com", "targeting": { "ios": "www.example.com" } } }

Request parameter descriptions

JSON element Declaration Type
type Link type. Options: link, deeplink, targeting String
url Target URL, to which the user will be redirected by default String
utm UTM template String
deeplink An object containing deep links The device is indicated inside (options: iOS or Android). It must contain two properties: deeplink (deep link to the application) and fallback — application installation link on the App Store or Google Play Object
targeting An object with OS-based targeting. The target device OS is indicated inside (options: iOS, Android and Other). Value — the target URL address, to which the user will be redirected Object

Response example:

{ "data": { "url": "https://www.example.com", "short": "https://lst.to/vhlck", "qr": "https://lst.to/vhlck.png", "type": "deeplink", "utm": "utm_campaign=[domain]", "created": "2018-12-04 09:58:39", "deeplink": { "ios": { "deeplink_url": "app://www.example.com", "fallback_url": "itms-apps://www.example.com" } } } }
JSON element Declaration Type
url Target URL, to which the user will be redirected by default String
short Short URL String
qr QR code image URL String
type Link type. Options: link, deeplink, targeting String
utm UTM template String
created Creation date and time Date and time
deeplink An object containing deep links The device is indicated inside (options: iOS or Android). It must contain two properties: deeplink (deep link to the application) and fallback — application installation link on the App Store or Google Play Object
targeting An object with OS-based targeting. The target device OS is indicated inside (options: iOS, Android and Other). Value — the target URL address, to which the user will be redirected Object

Update link

The short link target URL can be edited using the Lst.to API. To do this, send the following request:

PUT https://lst.to/api/v1/link/mvlck

Headers:

X-AUTH-TOKEN: JkdnskjmnsjOKSaPqd Content-Type: application/json

A request body example:

{ "data": { "type": "deeplink", "url": "www.example.com", "deeplink": { "ios":{ "deeplink_url": "app://www.example.com", "fallback_url": "itms-apps://www.example.com" } } } }

Delete link

To delete a short link, send the following request:

DELETE https://lst.to/api/v1/link/mvlck

Headers:

X-AUTH-TOKEN: JkdnskjmnsjOKSaPqd Content-Type: application/json

Get link

GET https://lst.to/api/v1/link/mvlck

Headers:

X-AUTH-TOKEN: JkdnskjmnsjOKSaPqd Content-Type: application/json

Response example:

{ "data": { "url": "https://www.example.com", "short": "https://lst.to/vhlck", "qr": "https://lst.to/vhlck.png", "type": "deeplink", "utm": "utm_campaign=[domain]", "created": "2018-12-04 09:58:39", "deeplink": { "ios": { "deeplink_url": "app://www.example.com", "fallback_url": "itms-apps://www.example.com" } } } }

Get all links

To get all links created using your token, send a request of the following type

GET https://lst.to/api/v1/link

Headers:

X-AUTH-TOKEN: JkdnskjmnsjOKSaPqd Content-Type: application/json

Response example:

{ "data": { "url": "https://www.example.com", "short": "https://lst.to/vhlck", "qr": "https://lst.to/vhlck.png", "type": "deeplink", "utm": "utm_campaign=[domain]", "created": "2018-12-04 09:58:39", "deeplink": { "ios": { "deeplink_url": "app://www.example.com", "fallback_url": "itms-apps://www.example.com" } } } }, { "data": { "url": "https://www.example.com", "short": "https://lst.to/vhlck", "qr": "https://lst.to/vhlck.png", "type": "deeplink", "utm": "utm_campaign=[domain]", "created": "2018-12-04 09:58:39", "deeplink": { "ios": { "deeplink_url": "app://www.example.com", "fallback_url": "itms-apps://www.example.com" } } } }