Shlink REST API

v3.0
Base URL
{scheme}://{host}
scheme
default https; one of https, http
host
default s.test

Shlink, the self-hosted URL shortener

Find more info on how to start using this API here

Authentication

ApiKeyapiKey

A valid shlink API key

API Key: X-Api-Key in header

Short URLs

Operations that can be performed on short URLs

List short URLs

GET
https://s.test/rest/v{version}/short-urls

Returns the list of short URLs.

Parameters

versionstring321requiredpath

The API version to be consumed

pageintegerquery

The page to be displayed. Defaults to 1

itemsPerPagenumberquery

The amount of items to return on every page. Defaults to 10

searchTermstringquery

A query used to filter results by searching for it on the longUrl and shortCode fields. (Since v1.3.0)

tags[]Array<string>query

A list of tags used to filter the result set. Only short URLs tagged with at least one of the provided tags will be returned. (Since v1.3.0)

tagsModestringanyallquery

Tells how the filtering by tags should work, returning short URLs containing “any” of the tags, or “all” the tags. It’s ignored if no tags are provided, and defaults to “any” if not provided.

orderBystringlongUrl-ASClongUrl-DESCshortCode-ASCshortCode-DESCdateCreated-ASCdateCreated-DESCtitle-ASCtitle-DESCvisits-ASCvisits-DESCnonBotVisits-ASCnonBotVisits-DESCquery

The field from which you want to order the result.

startDatestringquery

The date (in ISO-8601 format) from which we want to get short URLs.

endDatestringquery

The date (in ISO-8601 format) until which we want to get short URLs.

excludeMaxVisitsReachedstringtruefalsequery

If true, short URLs which already reached their maximum amount of visits will be excluded.

excludePastValidUntilstringtruefalsequery

If true, short URLs which validUntil date is on the past will be excluded.

Response

200OKobject

The list of short URLs

Response fields application/json
shortUrlsobject
Show child attributes
dataArray<object>
Show child attributes
shortCodestringrequired

The short code for this short URL.

shortUrlstringrequired

The short URL.

longUrlstringrequired

The original long URL.

deviceLongUrlsobjectrequired
Show child attributes
android | nullrequired
ios | nullrequired
desktop | nullrequired
androidstringrequired

The long URL to redirect to when the short URL is visited from a device running Android

iosstringrequired

The long URL to redirect to when the short URL is visited from a device running iOS

desktopstringrequired

The long URL to redirect to when the short URL is visited from a desktop browser

dateCreatedstring<date-time>required

The date in which the short URL was created in ISO format.

visitsCountintegerrequireddeprecated

[DEPRECATED] Use visitsSummary.total instead.

visitsSummaryobjectrequired
Show child attributes
totalintegerrequired

The total amount of visits.

nonBotsintegerrequired

The amount of visits which were not identified as bots.

botsintegerrequired

The amount of visits that were identified as potential bots.

tagsArray<string>required

A list of tags applied to this short URL

metaobjectrequired
Show child attributes
validSincestring | nullrequired

The date (in ISO-8601 format) from which this short code will be valid

validUntilstring | nullrequired

The date (in ISO-8601 format) until which this short code will be valid

maxVisitsnumber | nullrequired

The maximum number of allowed visits for this short code

domainstring | nullrequired

The domain in which the short URL was created. Null if it belongs to default domain.

titlestring | nullrequired

A descriptive title of the short URL.

crawlablebooleanrequired

Tells if this URL will be included as ‘Allow’ in Shlink’s robots.txt.

forwardQuerybooleanrequired

Tells if this URL will forward the query params to the long URL when visited, as explained in the docs.

paginationobject
Show child attributes
currentPageinteger

The number of current page.

pagesCountinteger

The total number of pages that can be obtained.

itemsPerPageinteger

The number of items for every page.

itemsInCurrentPageinteger

The number of items in current page (could be smaller than itemsPerPage).

totalItemsinteger

The total number of items among all pages.

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

Create short URL

POST
https://s.test/rest/v{version}/short-urls

Creates a new short URL.

Param findIfExists: This new param allows to force shlink to return existing short URLs when found based on provided params, instead of creating a new one. However, it might add complexity and have unexpected outputs.

These are the use cases:

  • Only the long URL is provided: It will return the newest match or create a new short URL if none is found.
  • Long url and custom slug are provided: It will return the short URL when both params match, return an error when the slug is in use for another long URL, or create a new short URL otherwise.
  • Any of the above but including other params (tags, validSince, validUntil, maxVisits): It will behave the same as the previous two cases, but it will try to exactly match existing results using all the params. If any of them does not match, it will try to create a new short URL.

Body

application/json

Request body.

longUrlstring

The long URL this short URL will redirect to

deviceLongUrlsobject
Show child attributes
android | null
ios | null
desktop | null
androidstring

The long URL to redirect to when the short URL is visited from a device running Android

iosstring

The long URL to redirect to when the short URL is visited from a device running iOS

desktopstring

The long URL to redirect to when the short URL is visited from a desktop browser

validSincestring | null

The date (in ISO-8601 format) from which this short code will be valid

validUntilstring | null

The date (in ISO-8601 format) until which this short code will be valid

maxVisitsnumber | null

The maximum number of allowed visits for this short code

validateUrlbooleandeprecated

[DEPRECATED] Tells if the long URL should or should not be validated as a reachable URL. Defaults to false

tagsArray<string>

The list of tags to set to the short URL.

titlestring | null

A descriptive title of the short URL.

crawlableboolean

Tells if this URL will be included as ‘Allow’ in Shlink’s robots.txt.

forwardQueryboolean

Tells if the query params should be forwarded from the short URL to the long one, as explained in the docs.

deviceLongUrlsobject
Show child attributes
androidstring

The long URL to redirect to when the short URL is visited from a device running Android

iosstring

The long URL to redirect to when the short URL is visited from a device running iOS

desktopstring

The long URL to redirect to when the short URL is visited from a desktop browser

customSlugstring

A unique custom slug to be used instead of the generated short code

findIfExistsboolean

Will force existing matching URL to be returned if found, instead of creating a new one

domainstring

The domain to which the short URL will be attached

shortCodeLengthnumber

The length for generated short code. It has to be at least 4 and defaults to 5. It will be ignored when customSlug is provided

Parameters

versionstring321requiredpath

The API version to be consumed

Response

200OKobject

The result of parsing the long URL

Response fields application/json
shortCodestringrequired

The short code for this short URL.

shortUrlstringrequired

The short URL.

longUrlstringrequired

The original long URL.

deviceLongUrlsobjectrequired
Show child attributes
android | nullrequired
ios | nullrequired
desktop | nullrequired
androidstringrequired

The long URL to redirect to when the short URL is visited from a device running Android

iosstringrequired

The long URL to redirect to when the short URL is visited from a device running iOS

desktopstringrequired

The long URL to redirect to when the short URL is visited from a desktop browser

dateCreatedstring<date-time>required

The date in which the short URL was created in ISO format.

visitsCountintegerrequireddeprecated

[DEPRECATED] Use visitsSummary.total instead.

visitsSummaryobjectrequired
Show child attributes
totalintegerrequired

The total amount of visits.

nonBotsintegerrequired

The amount of visits which were not identified as bots.

botsintegerrequired

The amount of visits that were identified as potential bots.

tagsArray<string>required

A list of tags applied to this short URL

metaobjectrequired
Show child attributes
validSincestring | nullrequired

The date (in ISO-8601 format) from which this short code will be valid

validUntilstring | nullrequired

The date (in ISO-8601 format) until which this short code will be valid

maxVisitsnumber | nullrequired

The maximum number of allowed visits for this short code

domainstring | nullrequired

The domain in which the short URL was created. Null if it belongs to default domain.

titlestring | nullrequired

A descriptive title of the short URL.

crawlablebooleanrequired

Tells if this URL will be included as ‘Allow’ in Shlink’s robots.txt.

forwardQuerybooleanrequired

Tells if this URL will forward the query params to the long URL when visited, as explained in the docs.

400Bad Requestobject

Some of provided data is invalid. Check extra fields to know exactly what.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

invalidElementsArray<string>validSincevalidUntilcustomSlugmaxVisitsfindIfExistsdomain
urlstring

A URL that could not be verified, if the error type is https://shlink.io/api/error/invalid-url

customSlugstring

Provided custom slug when the error type is https://shlink.io/api/error/non-unique-slug

domainstring

The domain for which you were trying to create the new short URL

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

Create a short URL

deprecated
GET
https://s.test/rest/v{version}/short-urls/shorten

[Deprecated] Use Create short URL instead

Parameters

versionstring321requiredpath

The API version to be consumed

apiKeystringrequiredquery

The API key used to authenticate the request

longUrlstringrequiredquery

The URL to be shortened

formatstringtxtjsonquery

The format in which you want the response to be returned. You can also use the “Accept” header instead of this

Response

200OKobject

The list of short URLs

Response fields application/json
shortCodestringrequired

The short code for this short URL.

shortUrlstringrequired

The short URL.

longUrlstringrequired

The original long URL.

deviceLongUrlsobjectrequired
Show child attributes
android | nullrequired
ios | nullrequired
desktop | nullrequired
androidstringrequired

The long URL to redirect to when the short URL is visited from a device running Android

iosstringrequired

The long URL to redirect to when the short URL is visited from a device running iOS

desktopstringrequired

The long URL to redirect to when the short URL is visited from a desktop browser

dateCreatedstring<date-time>required

The date in which the short URL was created in ISO format.

visitsCountintegerrequireddeprecated

[DEPRECATED] Use visitsSummary.total instead.

visitsSummaryobjectrequired
Show child attributes
totalintegerrequired

The total amount of visits.

nonBotsintegerrequired

The amount of visits which were not identified as bots.

botsintegerrequired

The amount of visits that were identified as potential bots.

tagsArray<string>required

A list of tags applied to this short URL

metaobjectrequired
Show child attributes
validSincestring | nullrequired

The date (in ISO-8601 format) from which this short code will be valid

validUntilstring | nullrequired

The date (in ISO-8601 format) until which this short code will be valid

maxVisitsnumber | nullrequired

The maximum number of allowed visits for this short code

domainstring | nullrequired

The domain in which the short URL was created. Null if it belongs to default domain.

titlestring | nullrequired

A descriptive title of the short URL.

crawlablebooleanrequired

Tells if this URL will be included as ‘Allow’ in Shlink’s robots.txt.

forwardQuerybooleanrequired

Tells if this URL will forward the query params to the long URL when visited, as explained in the docs.

Response fields text/plain
string
400Bad Requestobject

The long URL was not provided or is invalid.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Response fields text/plain
string
defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Response fields text/plain
string

Parse short code

GET
https://s.test/rest/v{version}/short-urls/{shortCode}

Get the long URL behind a short URL’s short code.

Parameters

versionstring321requiredpath

The API version to be consumed

shortCodestringrequiredpath

The short code for the short URL.

domainstringquery

The domain in which the short code should be searched for.

Response

200OKobject

The URL info behind a short code.

Response fields application/json
shortCodestringrequired

The short code for this short URL.

shortUrlstringrequired

The short URL.

longUrlstringrequired

The original long URL.

deviceLongUrlsobjectrequired
Show child attributes
android | nullrequired
ios | nullrequired
desktop | nullrequired
androidstringrequired

The long URL to redirect to when the short URL is visited from a device running Android

iosstringrequired

The long URL to redirect to when the short URL is visited from a device running iOS

desktopstringrequired

The long URL to redirect to when the short URL is visited from a desktop browser

dateCreatedstring<date-time>required

The date in which the short URL was created in ISO format.

visitsCountintegerrequireddeprecated

[DEPRECATED] Use visitsSummary.total instead.

visitsSummaryobjectrequired
Show child attributes
totalintegerrequired

The total amount of visits.

nonBotsintegerrequired

The amount of visits which were not identified as bots.

botsintegerrequired

The amount of visits that were identified as potential bots.

tagsArray<string>required

A list of tags applied to this short URL

metaobjectrequired
Show child attributes
validSincestring | nullrequired

The date (in ISO-8601 format) from which this short code will be valid

validUntilstring | nullrequired

The date (in ISO-8601 format) until which this short code will be valid

maxVisitsnumber | nullrequired

The maximum number of allowed visits for this short code

domainstring | nullrequired

The domain in which the short URL was created. Null if it belongs to default domain.

titlestring | nullrequired

A descriptive title of the short URL.

crawlablebooleanrequired

Tells if this URL will be included as ‘Allow’ in Shlink’s robots.txt.

forwardQuerybooleanrequired

Tells if this URL will forward the query params to the long URL when visited, as explained in the docs.

404Not Foundobject

No URL was found for provided short code.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

shortCodestringrequired

The short code with which we tried to find the short URL

domainstring

The domain with which we tried to find the short URL

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

Delete short URL

DELETE
https://s.test/rest/v{version}/short-urls/{shortCode}

Deletes the short URL for provided short code.

Parameters

versionstring321requiredpath

The API version to be consumed

shortCodestringrequiredpath

The short code for the short URL.

domainstringquery

The domain in which the short code should be searched for.

Response

204No Content

The short URL has been properly deleted.

404Not Foundobject

No URL was found for provided short code.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

shortCodestringrequired

The short code with which we tried to find the short URL

domainstring

The domain with which we tried to find the short URL

422Unprocessable Entityobject

The visits threshold in shlink does not allow this short URL to be deleted.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

shortCodestringrequired

The short code with which we tried to find the short URL to delete

domainstring

The domain with which we tried to find the short URL to delete

thresholdnumberrequired

The amount of visits currently configured as threshold to allow deleting short URLs or not

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

Edit short URL

PATCH
https://s.test/rest/v{version}/short-urls/{shortCode}

Update certain meta arguments from an existing short URL.

Body

application/json

Request body.

longUrlstring

The long URL this short URL will redirect to

deviceLongUrlsobject
Show child attributes
android | null
ios | null
desktop | null
androidstring

The long URL to redirect to when the short URL is visited from a device running Android

iosstring

The long URL to redirect to when the short URL is visited from a device running iOS

desktopstring

The long URL to redirect to when the short URL is visited from a desktop browser

validSincestring | null

The date (in ISO-8601 format) from which this short code will be valid

validUntilstring | null

The date (in ISO-8601 format) until which this short code will be valid

maxVisitsnumber | null

The maximum number of allowed visits for this short code

validateUrlbooleandeprecated

[DEPRECATED] Tells if the long URL should or should not be validated as a reachable URL. Defaults to false

tagsArray<string>

The list of tags to set to the short URL.

titlestring | null

A descriptive title of the short URL.

crawlableboolean

Tells if this URL will be included as ‘Allow’ in Shlink’s robots.txt.

forwardQueryboolean

Tells if the query params should be forwarded from the short URL to the long one, as explained in the docs.

Parameters

versionstring321requiredpath

The API version to be consumed

shortCodestringrequiredpath

The short code for the short URL.

domainstringquery

The domain in which the short code should be searched for.

Response

200OKobject

The short URL has been properly updated.

Response fields application/json
shortCodestringrequired

The short code for this short URL.

shortUrlstringrequired

The short URL.

longUrlstringrequired

The original long URL.

deviceLongUrlsobjectrequired
Show child attributes
android | nullrequired
ios | nullrequired
desktop | nullrequired
androidstringrequired

The long URL to redirect to when the short URL is visited from a device running Android

iosstringrequired

The long URL to redirect to when the short URL is visited from a device running iOS

desktopstringrequired

The long URL to redirect to when the short URL is visited from a desktop browser

dateCreatedstring<date-time>required

The date in which the short URL was created in ISO format.

visitsCountintegerrequireddeprecated

[DEPRECATED] Use visitsSummary.total instead.

visitsSummaryobjectrequired
Show child attributes
totalintegerrequired

The total amount of visits.

nonBotsintegerrequired

The amount of visits which were not identified as bots.

botsintegerrequired

The amount of visits that were identified as potential bots.

tagsArray<string>required

A list of tags applied to this short URL

metaobjectrequired
Show child attributes
validSincestring | nullrequired

The date (in ISO-8601 format) from which this short code will be valid

validUntilstring | nullrequired

The date (in ISO-8601 format) until which this short code will be valid

maxVisitsnumber | nullrequired

The maximum number of allowed visits for this short code

domainstring | nullrequired

The domain in which the short URL was created. Null if it belongs to default domain.

titlestring | nullrequired

A descriptive title of the short URL.

crawlablebooleanrequired

Tells if this URL will be included as ‘Allow’ in Shlink’s robots.txt.

forwardQuerybooleanrequired

Tells if this URL will forward the query params to the long URL when visited, as explained in the docs.

400Bad Requestobject

Provided meta arguments are invalid.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

invalidElementsArray<string>longUrlvalidSincevalidUntilmaxVisitsrequired
404Not Foundobject

No URL was found for provided short code.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

shortCodestringrequired

The short code with which we tried to find the short URL

domainstring

The domain with which we tried to find the short URL

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

Tags

Let you handle the list of available tags

List existing tags

GET
https://s.test/rest/v{version}/tags

Returns the list of all tags used in any short URL

Parameters

versionstring321requiredpath

The API version to be consumed

withStatsstringtruefalsedeprecatedquery

[Deprecated] Use GET /tags/stats endpoint to get tags with their stats.

pagenumberquery

The page to display. Defaults to 1

itemsPerPagenumberquery

The amount of items to return on every page. Defaults to all the items

searchTermstringquery

A query used to filter results by searching for it on the tag name.

orderBystringtag-ASCtag-DESCquery

To determine how to order the results.

Response

200OKobject

The list of tags

Response fields application/json
tagsobject
Show child attributes
dataArray<string>required
statsArray<object>

The tag stats will be returned only if the withStats param was provided with value ‘true’

Show child attributes
tagstringrequired

The unique tag name

shortUrlsCountnumberrequired

The amount of short URLs using this tag

visitsSummaryobjectrequired
Show child attributes
totalintegerrequired

The total amount of visits.

nonBotsintegerrequired

The amount of visits which were not identified as bots.

botsintegerrequired

The amount of visits that were identified as potential bots.

visitsCountnumberrequireddeprecated

[DEPRECATED] Use visitsSummary.total instead

paginationobject
Show child attributes
currentPageinteger

The number of current page.

pagesCountinteger

The total number of pages that can be obtained.

itemsPerPageinteger

The number of items for every page.

itemsInCurrentPageinteger

The number of items in current page (could be smaller than itemsPerPage).

totalItemsinteger

The total number of items among all pages.

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

Rename tag

PUT
https://s.test/rest/v{version}/tags

Renames one existing tag

Body

application/json

Request body.

oldNamestringrequired

Current name of the tag

newNamestringrequired

New name of the tag

Parameters

versionstring321requiredpath

The API version to be consumed

Response

204No Content

The tag has been properly renamed

400Bad Requestobject

You have not provided either the oldName or the newName params.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

403Forbiddenobject

The API key you used does not have permissions to rename tags.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

404Not Foundobject

There’s no tag found with the name provided in oldName param.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

409Conflictobject

The name provided in newName param is already in use for another tag.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

Delete tags

DELETE
https://s.test/rest/v{version}/tags

Deletes provided list of tags

Parameters

versionstring321requiredpath

The API version to be consumed

tags[]Array<string>requiredquery

The names of the tags to delete

Response

204No Content

Tags properly deleted

403Forbiddenobject

The API key you used does not have permissions to delete tags.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

Get tags with stats

GET
https://s.test/rest/v{version}/tags/stats

Returns the list of all tags used in any short URL, together with the amount of short URLs and visits for it

Parameters

versionstring321requiredpath

The API version to be consumed

pagenumberquery

The page to display. Defaults to 1

itemsPerPagenumberquery

The amount of items to return on every page. Defaults to all the items

searchTermstringquery

A query used to filter results by searching for it on the tag name.

orderBystringtag-ASCtag-DESCshortUrlsCount-ASCshortUrlsCount-DESCvisits-ASCvisits-DESCnonBotVisits-ASCnonBotVisits-DESCquery

To determine how to order the results.

Important! Ordering by shortUrlsCount, visits or nonBotVisits has a known performance issue which makes loading a subset of the list take as much as loading the whole list.
If you plan to order by any of these fields, it’s worth loading the whole list with no pagination.

Response

200OKobject

The list of tags

Response fields application/json
tagsobject
Show child attributes
dataArray<object>required
Show child attributes
tagstringrequired

The unique tag name

shortUrlsCountnumberrequired

The amount of short URLs using this tag

visitsSummaryobjectrequired
Show child attributes
totalintegerrequired

The total amount of visits.

nonBotsintegerrequired

The amount of visits which were not identified as bots.

botsintegerrequired

The amount of visits that were identified as potential bots.

visitsCountnumberrequireddeprecated

[DEPRECATED] Use visitsSummary.total instead

paginationobject
Show child attributes
currentPageinteger

The number of current page.

pagesCountinteger

The total number of pages that can be obtained.

itemsPerPageinteger

The number of items for every page.

itemsInCurrentPageinteger

The number of items in current page (could be smaller than itemsPerPage).

totalItemsinteger

The total number of items among all pages.

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

Visits

Operations to manage visits on short URLs

Get general visits stats

GET
https://s.test/rest/v{version}/visits

Get general visits stats not linked to one specific short URL.

Parameters

versionstring321requiredpath

The API version to be consumed

Response

200OKobject

Visits stats.

Response fields application/json
visitsobject
Show child attributes
nonOrphanVisitsobjectrequired
Show child attributes
totalintegerrequired

The total amount of visits.

nonBotsintegerrequired

The amount of visits which were not identified as bots.

botsintegerrequired

The amount of visits that were identified as potential bots.

orphanVisitsobjectrequired
Show child attributes
totalintegerrequired

The total amount of visits.

nonBotsintegerrequired

The amount of visits which were not identified as bots.

botsintegerrequired

The amount of visits that were identified as potential bots.

visitsCountnumberrequireddeprecated

[DEPRECATED] Use nonOrphanVisits.total instead

orphanVisitsCountnumberrequireddeprecated

[DEPRECATED] Use orphanVisits.total instead

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

List visits for short URL

GET
https://s.test/rest/v{version}/short-urls/{shortCode}/visits

Get the list of visits on the short URL behind provided short code.

Parameters

versionstring321requiredpath

The API version to be consumed

shortCodestringrequiredpath

The short code for the short URL.

domainstringquery

The domain in which the short code should be searched for.

startDatestringquery

The date (in ISO-8601 format) from which we want to get visits.

endDatestringquery

The date (in ISO-8601 format) until which we want to get visits.

pagenumberquery

The page to display. Defaults to 1

itemsPerPagenumberquery

The amount of items to return on every page. Defaults to all the items

excludeBotsstringtruequery

Tells if visits from potential bots should be excluded from the result set

Response

200OKobject

List of visits.

Response fields application/json
visitsobject
Show child attributes
dataArray<object>
Show child attributes
refererstringrequired

The origin from which the visit was performed

datestring<date-time>required

The date in which the visit was performed

userAgentstringrequired

The user agent from which the visit was performed

visitLocationobjectrequired
Show child attributes
cityNamestring
countryCodestring
countryNamestring
latitudenumber
longitudenumber
regionNamestring
timezonestring
potentialBotboolean

Tells if Shlink thinks this visit comes potentially from a bot or crawler

paginationobject
Show child attributes
currentPageinteger

The number of current page.

pagesCountinteger

The total number of pages that can be obtained.

itemsPerPageinteger

The number of items for every page.

itemsInCurrentPageinteger

The number of items in current page (could be smaller than itemsPerPage).

totalItemsinteger

The total number of items among all pages.

404Not Foundobject

The short code does not belong to any short URL.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

Delete visits for short URL

DELETE
https://s.test/rest/v{version}/short-urls/{shortCode}/visits

Delete all existing visits on the short URL behind provided short code.

Parameters

versionstring321requiredpath

The API version to be consumed

shortCodestringrequiredpath

The short code for the short URL.

domainstringquery

The domain in which the short code should be searched for.

Response

200OKobject

Deleted visits

Response fields application/json
deletedVisitsnumber

Amount of affected visits

404Not Foundobject

The short code does not belong to any short URL.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

List visits for tag

GET
https://s.test/rest/v{version}/tags/{tag}/visits

Get the list of visits on any short URL which is tagged with provided tag.

Parameters

versionstring321requiredpath

The API version to be consumed

tagstringrequiredpath

The tag from which we want to get the visits.

startDatestringquery

The date (in ISO-8601 format) from which we want to get visits.

endDatestringquery

The date (in ISO-8601 format) until which we want to get visits.

pagenumberquery

The page to display. Defaults to 1

itemsPerPagenumberquery

The amount of items to return on every page. Defaults to all the items

excludeBotsstringtruequery

Tells if visits from potential bots should be excluded from the result set

Response

200OKobject

List of visits.

Response fields application/json
visitsobject
Show child attributes
dataArray<object>
Show child attributes
refererstringrequired

The origin from which the visit was performed

datestring<date-time>required

The date in which the visit was performed

userAgentstringrequired

The user agent from which the visit was performed

visitLocationobjectrequired
Show child attributes
cityNamestring
countryCodestring
countryNamestring
latitudenumber
longitudenumber
regionNamestring
timezonestring
potentialBotboolean

Tells if Shlink thinks this visit comes potentially from a bot or crawler

paginationobject
Show child attributes
currentPageinteger

The number of current page.

pagesCountinteger

The total number of pages that can be obtained.

itemsPerPageinteger

The number of items for every page.

itemsInCurrentPageinteger

The number of items in current page (could be smaller than itemsPerPage).

totalItemsinteger

The total number of items among all pages.

404Not Foundobject

The tag does not exist.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

List visits for domain

GET
https://s.test/rest/v{version}/domains/{domain}/visits

Get the list of visits on any short URL which belongs to provided domain.

Parameters

versionstring321requiredpath

The API version to be consumed

domainstringrequiredpath

The domain from which we want to get the visits, or DEFAULT keyword for default domain.

startDatestringquery

The date (in ISO-8601 format) from which we want to get visits.

endDatestringquery

The date (in ISO-8601 format) until which we want to get visits.

pagenumberquery

The page to display. Defaults to 1

itemsPerPagenumberquery

The amount of items to return on every page. Defaults to all the items

excludeBotsstringtruequery

Tells if visits from potential bots should be excluded from the result set

Response

200OKobject

List of visits.

Response fields application/json
visitsobject
Show child attributes
dataArray<object>
Show child attributes
refererstringrequired

The origin from which the visit was performed

datestring<date-time>required

The date in which the visit was performed

userAgentstringrequired

The user agent from which the visit was performed

visitLocationobjectrequired
Show child attributes
cityNamestring
countryCodestring
countryNamestring
latitudenumber
longitudenumber
regionNamestring
timezonestring
potentialBotboolean

Tells if Shlink thinks this visit comes potentially from a bot or crawler

paginationobject
Show child attributes
currentPageinteger

The number of current page.

pagesCountinteger

The total number of pages that can be obtained.

itemsPerPageinteger

The number of items for every page.

itemsInCurrentPageinteger

The number of items in current page (could be smaller than itemsPerPage).

totalItemsinteger

The total number of items among all pages.

404Not Foundobject

The domain does not exist.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

List orphan visits

GET
https://s.test/rest/v{version}/visits/orphan

Get the list of visits to invalid short URLs, the base URL or any other 404.

Parameters

versionstring321requiredpath

The API version to be consumed

startDatestringquery

The date (in ISO-8601 format) from which we want to get visits.

endDatestringquery

The date (in ISO-8601 format) until which we want to get visits.

pagenumberquery

The page to display. Defaults to 1

itemsPerPagenumberquery

The amount of items to return on every page. Defaults to all the items

excludeBotsstringtruequery

Tells if visits from potential bots should be excluded from the result set

Response

200OKobject

List of visits.

Response fields application/json
visitsobject
Show child attributes
dataArray<object>
Show child attributes
visitedUrlstring | nullrequired

The originally visited URL that triggered the tracking of this visit

typestringinvalid_short_urlbase_urlregular_404required

Tells the type of orphan visit

refererstringrequired

The origin from which the visit was performed

datestring<date-time>required

The date in which the visit was performed

userAgentstringrequired

The user agent from which the visit was performed

visitLocationobjectrequired
Show child attributes
cityNamestring
countryCodestring
countryNamestring
latitudenumber
longitudenumber
regionNamestring
timezonestring
potentialBotboolean

Tells if Shlink thinks this visit comes potentially from a bot or crawler

paginationobject
Show child attributes
currentPageinteger

The number of current page.

pagesCountinteger

The total number of pages that can be obtained.

itemsPerPageinteger

The number of items for every page.

itemsInCurrentPageinteger

The number of items in current page (could be smaller than itemsPerPage).

totalItemsinteger

The total number of items among all pages.

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

Delete orphan visits

DELETE
https://s.test/rest/v{version}/visits/orphan

Delete all visits to invalid short URLs, the base URL or any other 404.

Parameters

versionstring321requiredpath

The API version to be consumed

Response

200OKobject

Deleted visits

Response fields application/json
deletedVisitsnumber

Amount of affected visits

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

List non-orphan visits

GET
https://s.test/rest/v{version}/visits/non-orphan

Get the list of visits to any short URL.

Parameters

versionstring321requiredpath

The API version to be consumed

startDatestringquery

The date (in ISO-8601 format) from which we want to get visits.

endDatestringquery

The date (in ISO-8601 format) until which we want to get visits.

pagenumberquery

The page to display. Defaults to 1

itemsPerPagenumberquery

The amount of items to return on every page. Defaults to all the items

excludeBotsstringtruequery

Tells if visits from potential bots should be excluded from the result set

Response

200OKobject

List of visits.

Response fields application/json
visitsobject
Show child attributes
dataArray<object>
Show child attributes
refererstringrequired

The origin from which the visit was performed

datestring<date-time>required

The date in which the visit was performed

userAgentstringrequired

The user agent from which the visit was performed

visitLocationobjectrequired
Show child attributes
cityNamestring
countryCodestring
countryNamestring
latitudenumber
longitudenumber
regionNamestring
timezonestring
potentialBotboolean

Tells if Shlink thinks this visit comes potentially from a bot or crawler

paginationobject
Show child attributes
currentPageinteger

The number of current page.

pagesCountinteger

The total number of pages that can be obtained.

itemsPerPageinteger

The number of items for every page.

itemsInCurrentPageinteger

The number of items in current page (could be smaller than itemsPerPage).

totalItemsinteger

The total number of items among all pages.

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

Domains

Operations to manage domains used on short URLs

List configured domains

GET
https://s.test/rest/v{version}/domains

Returns the list of all domains that have been either used for some short URL, or have explicitly configured redirects.
It also includes the domain redirects, plus the default redirects that will be used for any non-explicitly-configured one.

Parameters

versionstring321requiredpath

The API version to be consumed

Response

200OKobject

The list of domains

Response fields application/json
domainsobjectrequired
Show child attributes
dataArray<object>required
Show child attributes
domainstringrequired
isDefaultbooleanrequired
redirectsobjectrequired
Show child attributes
baseUrlRedirectstring | null

URL to redirect to when a user hits the domain’s base URL

regular404Redirectstring | null

URL to redirect to when a user hits a not found URL other than an invalid short URL

invalidShortUrlRedirectstring | null

URL to redirect to when a user hits an invalid short URL

defaultRedirectsobject
Show child attributes
baseUrlRedirectstring | null

URL to redirect to when a user hits the domain’s base URL

regular404Redirectstring | null

URL to redirect to when a user hits a not found URL other than an invalid short URL

invalidShortUrlRedirectstring | null

URL to redirect to when a user hits an invalid short URL

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

Sets domain “not found” redirects

PATCH
https://s.test/rest/v{version}/domains/redirects

Sets the URLs that you want a visitor to get redirected to for “not found” URLs for a specific domain

Body

application/json

Request body.

domainstringrequired

The domain’s authority for which you want to set redirects

baseUrlRedirectstring | null

URL to redirect to when a user hits the domain’s base URL

regular404Redirectstring | null

URL to redirect to when a user hits a not found URL other than an invalid short URL

invalidShortUrlRedirectstring | null

URL to redirect to when a user hits an invalid short URL

Parameters

versionstring321requiredpath

The API version to be consumed

Response

200OKany & object

The domain’s redirects after the update, when existing redirects have been merged with provided ones.

Response fields application/json
baseUrlRedirectstring | null

URL to redirect to when a user hits the domain’s base URL

regular404Redirectstring | null

URL to redirect to when a user hits a not found URL other than an invalid short URL

invalidShortUrlRedirectstring | null

URL to redirect to when a user hits an invalid short URL

any
400Bad Requestobject

Provided data is invalid.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

invalidElementsArray<string>domainbaseUrlRedirectregular404RedirectinvalidShortUrlRedirectrequired
defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

Integrations

Handle services with which shlink is integrated

Get mercure integration info

GET
https://s.test/rest/v{version}/mercure-info

Returns information to consume updates published by Shlink on a mercure hub. https://mercure.rocks/

Parameters

versionstring321requiredpath

The API version to be consumed

Response

200OKobject

The mercure integration info

Response fields application/json
mercureHubUrlstringrequired

The public URL of the mercure hub that can be used to get real-time updates published by Shlink

jwtstringrequired

A JWT with subscribe permissions which is valid with the mercure hub

jwtExpirationstringrequired

The date (in ISO-8601 format) in which the JWT will expire

501Not Implementedobject

This Shlink instance is not integrated with a mercure hub

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

defaultobject

Unexpected error.

Response fields application/problem+json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

Authorization

ApiKeyapiKey in header

A valid shlink API key

Monitoring

Public endpoints designed to monitor the service

Check healthiness

GET
https://s.test/rest/health

Checks the healthiness of the service, making sure it can access required resources.

Response

200OKobject

The passing health status

Response fields application/json
statusstringpassfail

The status of the service

versionstring

Shlink version

503Service Unavailableobject

The failing health status

Response fields application/json
statusstringpassfail

The status of the service

versionstring

Shlink version

defaultobject

Unexpected error.

Response fields application/json
typestringrequired

A machine unique code

titlestringrequired

A unique title

detailstringrequired

A human-friendly error description

statusnumberrequired

HTTP response status code

URL Shortener

Non-rest endpoints, used to be publicly exposed

Short URL

GET
https://s.test/{shortCode}

Represents a short URL. Tracks the visit and redirects tio the corresponding long URL

Parameters

shortCodestringrequiredpath

The short code for the short URL.

Response

302Found

Visit properly tracked and redirected

Short URL tracking pixel

GET
https://s.test/{shortCode}/track

Generates a 1px transparent image which can be used to track emails with a short URL

Parameters

shortCodestringrequiredpath

The short code for the short URL.

Response

200OKstring<binary>

Image in GIF format

Response fields image/gif
string<binary>

Short URL QR code

GET
https://s.test/{shortCode}/qr-code

Generates a QR code image pointing to a short URL.
Since this is not an API endpoint but an image one, when an invalid value is provided for any of the query params, they will fall to their default values instead of throwing an error.

Parameters

shortCodestringrequiredpath

The short code for the short URL.

sizeinteger[50, 1000]300query

The size of the image to be returned.

formatstringpngsvgpngquery

The format for the QR code image, being valid values png and svg. Not providing the param or providing any other value will fall back to png.

margininteger>= 00query

The margin around the QR code image.

errorCorrectionstringLMQHLquery

The error correction level to apply to the QR code: **[L]**ow, **[M]**edium, **[Q]**uartile or **[H]**igh. See docs.

roundBlockSizestringtruefalsefalsequery

Allows to disable block size rounding, which might reduce the readability of the QR code, but ensures no extra margin is added.

Response

200OKstring<binary>

QR code in PNG format

Response fields image/png
string<binary>
Response fields image/svg+xml
string<binary>