Shlink

Shlink REST API

Shlink, the self-hosted URL shortener

E-commerce#openapi

Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.

Overview

Shlink, the self-hosted URL shortener

Endpoints 27

Short URLs

  • GETList short URLs/rest/v:version/short-urlsReturns the list of short URLs.
  • POSTCreate short URL/rest/v:version/short-urlsCreates a new short URL.<br></br>Param findIfExists: This new param allows to force shlink to return existing short URLs when found based on provided params,…
  • GETCreate a short URL/rest/v:version/short-urls/shorten?apiKey=string&longUrl=stringDeprecated. [Deprecated] Use Create short URL instead
  • GETParse short code/rest/v:version/short-urls/:shortCodeGet the long URL behind a short URL's short code.
  • DELETEDelete short URL/rest/v:version/short-urls/:shortCodeDeletes the short URL for provided short code.
  • PATCHEdit short URL/rest/v:version/short-urls/:shortCodeUpdate certain meta arguments from an existing short URL.

Redirect rules

  • GETList short URL redirect rules/rest/v:version/short-urls/:shortCode/redirect-rulesReturns the list of redirect rules for a short URL.
  • POSTSet short URL redirect rules/rest/v:version/short-urls/:shortCode/redirect-rulesSets redirect rules for a short URL, with priorities matching the order in which they are provided.

Tags

  • GETList existing tags/rest/v:version/tagsReturns the list of all tags used in any short URL
  • PUTRename tag/rest/v:version/tagsRenames one existing tag
  • DELETEDelete tags/rest/v:version/tags?tags[]=stringDeletes provided list of tags
  • GETGet tags with stats/rest/v:version/tags/statsReturns the list of all tags used in any short URL, together with the amount of short URLs and visits for it

Visits

  • GETGet general visits stats/rest/v:version/visitsGet general visits stats not linked to one specific short URL.
  • GETList visits for short URL/rest/v:version/short-urls/:shortCode/visitsGet the list of visits on the short URL behind provided short code.
  • DELETEDelete visits for short URL/rest/v:version/short-urls/:shortCode/visitsDelete all existing visits on the short URL behind provided short code.
  • GETList visits for tag/rest/v:version/tags/:tag/visitsGet the list of visits on any short URL which is tagged with provided tag.
  • GETList visits for domain/rest/v:version/domains/:domain/visitsGet the list of visits on any short URL which belongs to provided domain.
  • GETList orphan visits/rest/v:version/visits/orphanGet the list of visits to invalid short URLs, the base URL or any other 404.
  • DELETEDelete orphan visits/rest/v:version/visits/orphanDelete all visits to invalid short URLs, the base URL or any other 404.
  • GETList non-orphan visits/rest/v:version/visits/non-orphanGet the list of visits to any short URL.

Domains

  • GETList configured domains/rest/v:version/domainsReturns the list of all domains that have been either used for some short URL, or have explicitly configured redirects.<br/>It also includes the domain…
  • PATCHSets domain "not found" redirects/rest/v:version/domains/redirectsSets the URLs that you want a visitor to get redirected to for "not found" URLs for a specific domain

Integrations

  • GETGet mercure integration info/rest/v:version/mercure-infoReturns information to consume updates published by Shlink on a mercure hub. https://mercure.rocks/

Monitoring

  • GETCheck healthiness/rest/healthChecks the healthiness of the service, making sure it can access required resources.

URL Shortener

  • GETShort URL/:shortCodeRepresents a short URL. Tracks the visit and redirects tio the corresponding long URL
  • GETShort URL tracking pixel/:shortCode/trackGenerates a 1px transparent image which can be used to track emails with a short URL
  • GET[Deprecated] Short URL QR code/:shortCode/qr-codeDeprecated. [Deprecated] Use an external mechanism to generate QR codes. Shlink dashboard and shlink-web-client provide their own.

API details

Authentication
An API key in the X-Api-Key header
Operations
27 operations on 19 pathsGET 18DELETE 4POST 2PATCH 2PUT 1
2 marked deprecated
Main resources
Visits 8Short URLs 6Tags 4URL Shortener 3Domains 2Redirect rules 2Integrations 1Monitoring 1
Response formats
application/problem+json application/json text/plain image/gif
Description format
OpenAPI 3.1.0, API version 3.0

How to test the Shlink REST API in Swastik Codes

  1. Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
  2. Fork it into your workspaceChoose a workspace. You get your own copy of the Shlink REST API collection, without the publisher's secrets.
  3. Add your credentialsThis API uses an API key in the X-Api-Key header. Add yours in the collection's variables or an environment; the requests already reference it.
  4. Send a requestPick an endpoint, for example “List short URLs” (GET /rest/v:version/short-urls), and press Send. Check the response, add tests and run the whole collection with the runner.

Frequently asked questions

What is the Shlink REST API?

Shlink, the self-hosted URL shortener It is listed under E-commerce and has 27 endpoints.

Who publishes the Shlink REST API?

It is listed from Shlink's public API description (an OpenAPI document), not published by Shlink on Swastik Codes. Anyone who controls shlink.io can claim the profile by adding a DNS TXT record.

How do I authenticate with the Shlink REST API?

With an API key in the X-Api-Key header.

How many endpoints does the Shlink REST API have?

27 operations on 19 paths (18 GET, 4 DELETE, 2 POST, 2 PATCH, 1 PUT). The largest groups are Visits, Short URLs, Tags, URL Shortener.

Is forking the Shlink REST API free?

Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.

Suggest an API

Tell us which public API is missing. We check it, then add it here with its endpoints when it has an OpenAPI (Swagger) description.