Statin

Endpoint reference

POST/links

Shorten a link

Create a branded short URL for any destination. Returns the link id you need for the metrics endpoint.

Open playground to send a live request →

Description

Sends a long URL to statin and receives a short link on your default domain (or a domain you specify). Optionally set a custom slug; otherwise one is generated automatically.

Request

POST https://statin.io/api/v1/links
Content-Type: application/json
Authorization: Bearer la_...

{
  "url": "https://example.com/landing-page",
  "slug": "summer-sale",
  "domainId": "optional-domain-id"
}
FieldTypeDescription
urlstringRequired. Destination URL to shorten.
slugstringOptional custom short code.
domainIdstringOptional. Defaults to your primary domain.

Response

Returns 201 Created with the new link object:

{
  "link": {
    "id": "64f1a2b3c4d5e6f7a8b9c0d1",
    "url": "https://example.com/landing-page",
    "slug": "summer-sale",
    "shortUrl": "https://statin.io/summer-sale",
    "clicks": 0,
    "createdAt": "2026-06-26T12:00:00.000Z",
    "updatedAt": "2026-06-26T12:00:00.000Z"
  }
}

Save link.id — use it with Link metrics to fetch analytics.

cURL

curl -X POST "https://statin.io/api/v1/links" \
  -H "Authorization: Bearer la_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com","slug":"my-link"}'

JavaScript

const res = await fetch("https://statin.io/api/v1/links", {
  method: "POST",
  headers: {
    Authorization: "Bearer la_YOUR_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://example.com",
    slug: "my-link",
  }),
});

if (!res.ok) throw new Error(await res.text());
const { link } = await res.json();
console.log(link.shortUrl, link.id);

Python

import requests

response = requests.post(
    "https://statin.io/api/v1/links",
    headers={"Authorization": "Bearer la_YOUR_KEY"},
    json={"url": "https://example.com", "slug": "my-link"},
    timeout=30,
)
response.raise_for_status()
link = response.json()["link"]
print(link["shortUrl"], link["id"])