logo

Create a free account It only takes 14 seconds

  • or

  • Already have an account?

logo

sign in & start sharing

logo

Recover your password Enter your email address or username and we'll help you reset your password.

Feedback
Feedback Survey

Please feel free to share any feedback you may have, be it good or bad about our website. We always reward good ideas and helpful feedback.

Do you have a suggestion on what things we could do differently?

Is there something that impresses you?

Can you suggest us any improvements or additional features that we could make to Snipli?

Welcome

Welcome to the Snipli API! We offer multiple ways to communicate and integrate with different parts of Snipli, so if you are looking to create or edit Sniplinks, retrieve user/link stats or do something interesting with the API, you're in the right place.

In order to get started, signup for a Snipli account. In case you don't have one yet click on the buttons on the left sidebar.

If you have any problems or requests please contact our support team.

Authentication

Snipli currently uses temporary security credentials for user authentication. All API requests must use the SSL endpoint at https://api.snipli.com

All access tokens provided have an expiration time that the users can set. The access token provided must be included in each API request, using the header, X-Snipli-Access-Token

The lifetime parameter, by default, is set to 3600 seconds. The maximum value is 86400 seconds. Here is an example for authentication:

Example request

POST /authentication

Host: api.snipli.com

Content-Type: application/x-www-form-urlencoded

client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&lifetime=100

Example response

{

"access_token" : "e783e30818201d28mn07803e57333bed4f17803"

"login": "snipli_user"

"expiration": 1432810814

"response_code" : 201,

"response_message" : "Created"

}

Return Values

  • access_token - The access token that will be used for Snipli API requests.
  • login - The Snipli username.
  • expiration - An Unix timestamp, representing the datetime when the access token will expire.

Sniplinks

/shorten/

Send a long URL and receive a Sniplink.

Parameters

  • long_url - The long URL, which you wish to shorten. The URL must be encoded. (required)
  • domain - The short domain to use: snip.li, snipli.com. Default is snip.li (optional)
  • short_url - The short URL for the URL. (optional)
  • tags - One or more tags. (optional)
  • private - Boolean true or false, indicating privacy settings. Default is false. (optional)
  • private_stats - Boolean true or false, indicating privacy settings for your stats page. Default is false. (optional)
  • mask_url - Boolean true or false, indicating if the long URL is masked using an iFrame. Default is false. (optional)

Return Values

  • short_url - The Snipli short URL.
  • sniplink - The Snipli short link.
  • long_url - An echo back of the long URL for this Sniplink.

Example request

API Address: https://api.snipli.com

POST: /shorten/

Content-Type: application/x-www-form-urlencoded

long_url=http%3A%2F%2Fexample.com

Example response

{

"date" : {

"short_url" : "aBx23",

"sniplink" : "http://snip.li/aBx23",

"long_url" : "http://example.com"

},

"response_code" : 201,

"response_message" : "Created"

}

/edit/{short_url}

Edit an existing Sniplink from your account.

Parameters

  • short_url - The Sniplink to be edited. (required)
  • long_url - The long URL that you want to replace. The URL must be encoded. (required)
  • domain - The short domain to use: snip.li, snipli.com. Default is snip.li (optional)
  • new_short_url - A new short URL for this Sniplink. (optional)
  • tags - One or more tags. (optional)
  • private - Boolean true or false, indicating privacy settings. Default is false. (optional)
  • private_stats - Boolean true or false, indicating privacy settings for your stats page. Default is false. (optional)
  • mask_url - Boolean true or false, indicating if the long URL is masked using an iFrame. Default is false. (optional)

Return Values

  • short_url - The Snipli short URL.
  • sniplink - The Snipli short link.
  • long_url - An echo back of the long URL for this Sniplink.

Example request

API Address: https://api.snipli.com

PUT: /edit/aBx23/

Content-Type: application/x-www-form-urlencoded

long_url=http%3A%2F%2Fexample2.com

Example response

{

"date" : {

"short_url" : "aBx23",

"sniplink" : "http://snip.li/aBx23",

"long_url" : "http://example2.com"

},

"response_code" : 200,

"response_message" : "OK"

}

Get info for a specific Sniplink.

Parameters

  • short_url - The short URL of the Sniplink you are looking for.

Return Values

  • long_url - An echo back of the long URL parameter.
  • title - The title of the Sniplink.
  • date - An Unix timestamp indicating the date of creation.
  • domain - The chosen domain for a specific Sniplink.
  • tags - The tags chosen for a specific Sniplink.
  • private - Boolean true or false, indicating privacy settings for a specific Sniplink. (optional)
  • private_stats - Boolean true or false, indicating privacy settings for the stats page of a specific Sniplink.
  • mask_url - Boolean true or false, indicating if the long URL is masked using an iFrame for a specific Sniplink.
  • user_name - If private is set to true it will return "Someone", otherwise it will return the username that created the Sniplink.

Example request

API Address: https://api.snipli.com

GET: /link/aBx23

Example response

{

"data" : {

"long_url" : "http://example.com",

"title" : "Just Another Sniplink",

"date" : 1432810814,

"domain" : "snip.li",

"tags" : {"test", "Sniplink"},

"private" : 1,

"private_stats" : 0,

"mask_url" : 0,

"user_name" : "Someone"

},

"response_code" : 200,

"response_message" : "OK"

}

Users

/user/{username}

Get a list of links for a specific user.

Parameters

  • username - If username is specified, it will get all public links for that username, or else it will get all links for the authenticated user. (optional)
  • title - Title to lookup. (optional)
  • tag - Tag to lookup. (optional)
  • limit - The number of Sniplinks to show. Default is 25, maximum is 100. (optional)
  • offset - Number of Sniplinks to displace or pass over. Default is 0. (optional)

Return Values

  • long_url - An echo back of the long URL parameter.
  • title - The Sniplink title.
  • date - An Unix timestamp, indicating the date of creation.
  • domain - The chosen domain for a specific Sniplink.
  • tags - A list of tags for a specific Sniplink.
  • private - Boolean true or false, indicating privacy settings for a specific Sniplink. (optional)
  • private_stats - Boolean true or false, indicating privacy settings for the stats page of a specific Sniplink.
  • mask_url - Boolean true or false, indicating if the long URL is masked using an iFrame for a specific Sniplink.

Example request

API Address: https://api.snipli.com

GET: /user/snipli_user

Example response

{

"data" : [

{

"long_url" : "http://example.com",

"short_url" : "aBx23",

"title" : "Just Another sniplink",

"date" : 1432810814,

"domain" : "snip.li",

"tags" : {"test", "Sniplink"},

"private" : 0,

"private_stats" : 0,

"mask_url" : 0,

}

],

"response_code" : 200,

"response_message" : "OK"

}

Stats

Sniplinks that don't belong to the current user and have the private stats option on will receive a 401 Unauthorized response.

/stats/clicks/{short_url}

Get number of clicks for a specific Sniplink and for other Sniplinks with the same long URL.

Parameters

  • short_url - The short URL to lookup. (required)

Return Values

  • this_link - Number of clicks for a specific Sniplink.
  • other_links - Number of click on other Sniplinks with the same long URL.

Example request

API Address: https://api.snipli.com

GET: /stats/clicks/aBx23

Example response

{

"data" : {

"this_link" : 22,

"other_links" : 10

},

"response_code" : 200,

"response_message" : "OK"

}

/stats/chart/{short_url}

Get a list of days with the number of clicks for each day for a specific Sniplink.

Parameters

  • short_url - The short URL to lookup. (required)
  • days - A number that represents the last number of days to be shown. O represents all days, maximum is 30 days. Default is 0. (optional)

Return Values

  • date - The date for the clicks. Format: dd/mm/yyyy.
  • this_link - Number of clicks for a specific Sniplink.
  • other_links - Number of clicks on other Sniplinks with the same long URL.

Example request

API Address: https://api.snipli.com

GET: /stats/chart/aBx23?days=2

Example response

{

"data" : [

{

"date" : "1/19/2016",

"this_link" : 22,

"other_links" : 10

},

],

"response_code" : 200,

"response_message" : "OK"

}

/stats/24h/{short_url}

Get number of clicks for the last 24 hours.

Parameters

  • short_url - The short URL to lookup. (required)

Return Values

  • date - The datetime for the clicks. Format: dd/mm/yyyy hh:00.
  • this_link - Number of clicks for a specific Sniplink.
  • other_links - Number of clicks on other Sniplinks with the same long URL.

Example request

API Address: https://api.snipli.com

GET: /stats/24h/aBx23

Example response

{

"data" : [

{

"date" : "1/19/2016 06:00",

"this_link" : 22,

"other_links" : 10

},

],

"response_code" : 200,

"response_message" : "OK"

}

/stats/browsers/{short_url}

Get a list with number of clicks and browser names for a specific Sniplink.

Parameters

  • short_url - The short URL to lookup. (required)

Return Values

  • browser_name - The name of the browser.
  • clicks - Number of clicks associated with a browser for this Sniplink.

Example request

API Address: https://api.snipli.com

GET: /stats/browsers/aBx23

Example response

{

"data" : [

{

"browser_name" : "Firefox",

"clicks" : 22

},

],

"response_code" : 200,

"response_message" : "OK"

}

/stats/os/{short_url}

Get a list with number of clicks and operating system names for a specific Sniplink.

Parameters

  • short_url - The short URL to lookup. (required)

Return Values

  • os_name - The operating system name.
  • clicks - Number of clicks associated with an operating system for this Sniplink.

Example request

API Address: https://api.snipli.com

GET: /stats/os/aBx23

Example response

{

"data" : [

{

"os_name" : "Windows",

"clicks" : 22

},

],

"response_code" : 200,

"response_message" : "OK"

}

/stats/referer/{short_url}

Get a list with number of clicks and referer domains for a specific Sniplink.

Parameters

  • short_url - The short URL to lookup. (required)

Return Values

  • referer - A referer domain for this Sniplink. For direct clicks it will show "Direct".
  • clicks - Number of clicks associated with a referer domain for this Sniplink.

Example request

API Address: https://api.snipli.com

GET: /stats/referer/aBx23

Example response

{

"data" : [

{

"referer" : "facebook.com",

"clicks" : 22

},

],

"response_code" : 200,

"response_message" : "OK"

}

/stats/status/{short_url}

Shows you if and for how many users that clicked your Sniplink a long URL's host was down.

Parameters

  • short_url - The short URL to lookup. (required)

Return Values

  • downtime - A number (percentage) that represents downtime for a specific Sniplink.
  • uptime - A number (percentage) that represents uptime for a specific Sniplink.

Example request

API Address: https://api.snipli.com

GET: /stats/status/aBx23

Example response

{

"data" : {

"downtime" : 20.5,

"uptime" : 79.5

},

"response_code" : 200,

"response_message" : "OK"

}

/stats/users/{short_url}

Get the number of unique and returning users for a specific Sniplink.

Parameters

  • short_url - The short URL to lookup. (required)

Return Values

  • unique - A number (percentage) that represents unique users for a specific Sniplink.
  • returning - A number (percentage) that represents returning users for a specific Sniplink.

Example request

API Address: https://api.snipli.com

GET: /stats/users/aBx23

Example response

{

"data" : {

"unique" : 41.7,

"returning" : 58.3

},

"response_code" : 200,

"response_message" : "OK"

}

/stats/map/{short_url}

Get a list of countries and number of clicks for each country.

Parameters

  • short_url - The short URL to lookup. (required)

Return Values

  • country_code - A two-letter uppercase abbreviation for a particular country.
  • country_name - The country name.
  • clicks - Number of clicks associated with a country for this Sniplink.

Example request

API Address: https://api.snipli.com

GET: /stats/map/aBx23

Example response

{

"data" : [

{

"country_code" : "USA",

"country_name" : "United States",

"clicks" : 33

},

],

"response_code" : 200,

"response_message" : "OK"

}

/stats/shared/{short_url}

Get a list of users that shorten the same long URL (Only for PRO users)

Parameters

  • short_url - The short URL to lookup. (required)

Return Values

  • username - The username of the account that shortened a similar long URL.
  • full_name - The first name followed by the last name of the account that shortened a similar long URL.
  • profile_url - The profile URL of the account that shortened a similar long URL.

Example request

API Address: https://api.snipli.com

GET: /stats/shared/aBx23

Example response

{

"data" : [

{

"username" : "john02",

"full_name" : "John Doe",

"profile_url" : "http://john02.snipli.com"

},

],

"response_code" : 200,

"response_message" : "OK"

}

Response codes

200 OK

The request was successful.

201 Created

The Sniplink creation was successful.

400 Bad Request

An invalid request or response.

401 Unauthorized

Limited access or none to this Sniplink.

403 Forbidden.

The maximum limit of requests was reached.

404 Not Found

Indicates a not-found response.

501 Not Implemented

This feature is being implemented.

Guidelines

Our API URL is https://api.snipli.com/ so please make sure that you always use https.

Rate Limits

For each API method, Snipli practices per-hour rate limits. Regular users are limited to 1000 per-hour API requests. The default limits that we currently have should be more than enough for most use cases.

Caching

You should always cache data locally, if possible, because Sniplinks never change or expire.

Avoid Making Calls to The Snipli API On Page Loads

In most cases, rate limiting issues are caused by this, so you shouldn't make any calls while the page loads. It's best to make API calls on exact user actions.

How to Check for Errors

If you make an invalid request or if it's rate limited, the Snipli API will not return a Sniplink. Make sure you always check all API responses for errors.

Batch Processing

With a single API call, you can only shorten one long URL. In one API call, using the /v3/user/ endpoints, up to 100 URLs can be handled at the same time.

Bulk Shortening Requests

When you want to shorten a high-volume of URLs at once, it's always best to spread the requests over multiple hours. You can also use the bulk URL shortening tool if you want to shorten a large volume of URLs at once.

URL Encoding

We ask that you always encode all the long URLs before sending them to the Snipli API. You should also encode links that contain escaped characters.

For instance the following link:

http://link-example.com/page/1/index/

should be fully escaped to

http%3A%2F%2Flink-example.com%2Fpage%2F1%2Findex%2F

If you have any kind of questions related to our API key or access token do not hesitate to contact us.