Skip to main content
SendURL, home
On this page

Getting started

SendURL API

Create and manage short links, and read their clicks, from your own code. The API is REST, speaks JSON and authenticates with an API key from your console.

Base URL
https://api.sendurl.to/api/v1
Format
JSON in, JSON out, over HTTPS
Available on
Every plan, Free included
Get an API key

Getting started

Workspaces, folders and links

Everything you create belongs to a workspace. Every account has one, made at signup with a folder called Default. A workspace holds folders, and every link belongs to exactly one folder (how the console uses them: folders and tags). The API calls these org (as in orgId) and folder.

  • Your API key decides the workspace. URLs never name it, and nothing outside the key's workspace is visible: another workspace's link is a 404.
  • A link created without folderId goes into the Default folder (or a folder-level key's own folder). PATCH /links/:id with folderId moves it.
  • A workspace can have as many folders as its plan allows: 3 on Free, 5 on Starter, 25 on Pro, 100 on Growth and no limit on Enterprise, the Default folder included. Folders can be created through the API and renamed in the console; they can't be deleted.
  • Folders used to be called projects. The old names still work, with the same meaning: /projects for /folders, projectId for folderId, and projectId, project and projects sit next to the new names in every response. They are deprecated: use the new ones. A request with folderId and projectId that differ is 400 validation_error. Error codes keep their names (project_not_found and the rest), and so does the CSV export's project column.

Plan limits

The link limit belongs to the workspace and counts its links across all folders. Creating one more is a 403 link_limit_reached. GET /me and GET /links report the plan and usage. What a key can do on each plan, in one table: URL shortener API.

Links per workspace by plan
PlanLinks per workspace
Free25 in total
Starter250 a month
Pro2,000 a month
Growth5,000 a month
Enterprise25,000 a month

Authentication

Authenticate with an API key

Every request needs an API key, sent as a Bearer token in the Authorization header. Without a valid key the API answers 401.

  1. Create a keyOpen API keys in the console and choose Create key. Give it a name like “Production”.
  2. Choose its access, expiry and permissionsWhole workspace or one folder (below). Expiry: never, 30 days, 90 days or a year. Permissions: Full access, or only the scopes you pick. Keys look like snu_ followed by 32 letters and digits; copy yours from the API keys page.
  3. Send it on every requestAs Authorization: Bearer snu_…, over https:// only. Store it in an environment variable such as SENDURL_API_KEY.

Keep keys secret. Call the API from your server, never from a browser or mobile app: anyone who can read the key can use it. If a key leaks, revoke it on the API keys page and create a new one.

Header

Authorization: Bearer $SENDURL_API_KEY
401 Unauthorized
{
  "error": "invalid_api_key",
  "message": "This API key was revoked"
}

Workspace keys and folder-level keys

What each kind of key can do
EndpointWorkspace keyFolder-level key
Links: create, list, read, update, deleteEvery folder. May pass folderId.Its folder only. Another folderId is 403 project_forbidden on writes, 404 project_not_found on GET /links.
Clicks and daily statsEvery link of the workspace.Links of its folder. Others are 404.
Export links (GET /links/export.csv)Every folder. May pass folderId.Its folder only.
Analytics (/analytics/overview, /breakdown, /clicks)The whole workspace without folderId, or one folder or link.Its folder only. Another folderId is 404 project_not_found, a link outside it 404 link_not_found.
GET /domains, GET /domains/:idYes.Yes: the workspace's domains.
GET / POST /foldersYes.No: 403 project_key_forbidden.
GET /meYes.Yes, with its folder.
  • A key can't create, list or revoke keys. API keys, listing your workspaces (GET /orgs), renaming folders or the workspace, adding, verifying or removing domains, your profile and dashboard reports live in the console only; called with a key, those endpoints answer 403 session_required.
  • A revoked key fails from its next request, and an expired key from its expiry: 401 invalid_api_key, with message “Invalid API key”, “This API key was revoked” or “This API key has expired”.
  • A workspace can have 25 active keys at a time.
  • Links a key creates are recorded as created by the person who made the key (userId).

Key permissions (scopes)

A key has Full access by default: every endpoint below that an API key can call. To limit what a key can do, choose Custom when you create it and tick the permissions it needs. Each endpoint names the one it needs under Permission (scope). A key's permissions can't be changed later: create a new key and revoke the old one.

Key permissions
ScopeAllows
links:readList and retrieve links, their daily clicks and clicks, and export links as CSV.
links:writeCreate links, update them and pick an A/B test's winner.
links:deleteDelete links (on a paid plan).
analytics:readThe analytics endpoints: overview, breakdown and clicks across links.
workspace:readGET /me, list folders, list tags, list and retrieve domains.
folders:writeCreate folders.

A key without the permission an endpoint needs gets 403 with insufficient_scope, and requiredScope names the permission. Its access (workspace or folder) still applies on top: a folder-level key with links:read reads its own folder's links only.

403 Forbidden
{
  "error": "insufficient_scope",
  "message": "This API key doesn't have the analytics:read scope.",
  "requiredScope": "analytics:read"
}

Getting started

Official SDKs for Node.js and Python

The official SDKs call the endpoints on this page for you: typed requests and responses, lists that page themselves, one error class per status with the API's code, and retries for reads only (writes are never retried). Response keys stay camelCase, as below; Python arguments are snake_case. Save the Node.js sample as an .mjs file, an ES module, so its top-level await runs.

A walk-through of both, from the first link to analytics, errors and edge runtimes, is the URL shortener SDK for Node.js and Python.

// index.mjs (an ES module, so top-level await works)
import { SendURL } from "sendurl";

// The key is read from SENDURL_API_KEY
const sendurl = new SendURL();

const link = await sendurl.links.create({
  destinationUrl: "https://example.com/spring",
});
console.log(link.shortUrl); // a random slug on snu.to

for await (const item of sendurl.links.list()) {
  console.log(item.slug, item.totalClicks);
}

Getting started

MCP server for AI assistants

The SendURL MCP server lets AI assistants such as Claude, ChatGPT, Claude Code, Cursor and VS Code create and manage links and read clicks through the Model Context Protocol. Each tool calls one of the endpoints on this page, so the same plan limits, folder scope and error codes apply.

Endpoint
https://api.sendurl.to/mcp
Transport
Streamable HTTP, stateless
Available on
Every plan, Free included
Sign-in
OAuth 2.1 with PKCE, or an API key

Sign in (OAuth)

  • claude.ai, ChatGPT, Claude Code, Codex, Cursor and VS Code open a SendURL page, where a workspace owner or admin picks the workspace, chooses the permissions (any can be unticked, at least one must stay) and approves.
  • The page shows where the app connects from and where it sends the browser back, with a Verified label for an app SendURL has checked. An app that registered itself is marked Unverified, and one named like a well-known brand but not hosted by that brand gets a red warning; Cursor's own app shows both, as expected, since it registers itself.
  • The app then appears under Connected apps on the console's API keys page. Open it there and choose Disconnect: its next call answers 401.
  • An access token lasts 1 hour and the client renews it by itself; a connection left unused for 30 days has to sign in again.
  • claude.ai, ChatGPT and Claude Code identify themselves with a client ID metadata document; other clients register themselves (dynamic client registration). The sign-in must return to an https or localhost address (Cursor's fixed redirects are both); a client that returns to a custom app-link scheme uses an API key instead.

Or an API key

  • Or send an API key: Authorization: Bearer snu_…, as for the REST API. Claude Code, Codex, Cursor, VS Code and scripts can send one; ChatGPT only signs in, and on claude.ai sign in too (a key in its connector's request headers is stored with Claude and, on Claude Team and Enterprise, shared by every member). Use a key with only the permissions the assistant needs, keep it in an environment variable, never in a file you share or commit; a folder-level key reaches only its folder.
  • A console session token is refused at the MCP endpoint, and so is a request from a web page (a browser Origin).

Step-by-step set-up for each client is in the MCP server setup guide; client configurations and issues are on GitHub at sendurl-to/sendurl-mcp.

claude mcp add --transport http sendurl https://api.sendurl.to/mcp
claude mcp login sendurl

Claude Code with a key: run it with the default scope or --scope user, never with --scope project: your shell fills in the key, and project scope writes it into the repository's .mcp.json, where the next commit shares it. To share a key-based connection, commit a .mcp.json that names ${SENDURL_API_KEY} instead (setup guide).

Tools and the permission each needs

MCP tools
ToolWhat it doesPermission
get_accountYour workspace, plan, limits and usageRead-onlyworkspace:read
list_linksFind links by search text, folder, tag or status; newest or most-clicked first, 10 at a timeRead-onlylinks:read
get_linkOne link: destination, status, tags, click total and QR scansRead-onlylinks:read
create_linkCreate a short link: custom back-half, title, folder and tags; expiry or a password on Pro and aboveCreateslinks:write
update_linkChange a link: title, tags, folder, on or off; its destination, expiry or password on Pro and aboveDestructive: marked so the client can ask you to confirm first (most do by default)links:write
delete_linkDelete a link for good (paid plans; Free switches links off instead)Destructive: marked so the client can ask you to confirm first (most do by default)links:delete
pick_ab_test_winnerEnd a link's A/B test: the winning variant becomes its destinationDestructive: marked so the client can ask you to confirm first (most do by default)links:write
get_link_statsA link's all-time clicks per dayRead-onlylinks:read
list_link_clicksA link's clicks one by one, newest first: country, device, browser and referring siteRead-onlylinks:read
get_analytics_overviewClicks for a period: totals, a daily series, the period before, top links, top tags and social sourcesRead-onlyanalytics:read
get_analytics_breakdownClicks ranked by link, country, device, browser, OS, referrer or A/B variant; by city or UTM on Pro and aboveRead-onlyanalytics:read
list_analytics_clicksClicks one by one for a period, across the workspace, a folder or one linkRead-onlyanalytics:read
list_foldersYour folders, Default first (workspace keys and apps only)Read-onlyworkspace:read
create_folderCreate a folder (workspace keys and apps only)Createsfolders:write
list_tagsYour tags, to tag or filter linksRead-onlyworkspace:read
list_domainsYour snu.to subdomains and custom domains, with their statusRead-onlyworkspace:read
get_domainOne domain, with its status and DNS set-upRead-onlyworkspace:read

An API key or a connected app has every permission, or the ones you chose: the same six as key permissions, chosen on the consent page for a connected app. The tool list an assistant sees holds only the tools its permissions allow. A call outside them fails: with an API key, as a tool error (isError) with the code insufficient_scope and requiredScope; with a sign-in, as HTTP 403 with WWW-Authenticate: Bearer error="insufficient_scope", so the client can ask you for the missing permission.

Results, errors and limits

  • 60 tool calls a minute for each key or connected app. Past that a call answers 429 with Retry-After.
  • Analytics tools run one at a time for each key or app: a second call while one runs answers analytics_busy, and a busy moment answers analytics_unavailable with a retry time.
  • A tool's result is the endpoint's JSON, as structured content, and as text after a one-line summary. The list_* tools come 10 at a time with a cursor for the next page; get_analytics_breakdown returns up to 50 rows, with no cursor.
  • list_link_clicks gives each click's time, country, city, device, browser, OS, source and variant, and the referring site's host only: never the user agent or the full referrer URL. get_link_stats gives { days: [{ date, count }] }.
  • An endpoint's error becomes a tool error with the same code and message, such as plan_upgrade_required (with the plan that unlocks the feature) or link_limit_reached.
  • A tool call stops after 15 seconds. The Cloudflare limit of the API (below) applies to the MCP endpoint too.
  • No tool returns a link's password, an API key or a click's IP address; on Free a click's city is withheld, as in the API.

Links

Pick an A/B test's winner

POST/api/v1/links/:id/ab-test/winner

Makes one variant of the link's running A/B test its destination and ends the test, in one step: destinationUrl becomes the variant's URL and abTest becomes null. Every visitor goes there from the next visit.

The test's results stay in the console's analytics.

AccessAny API key, for links in the folder or workspace it reaches.

Permission (scope)links:write

Path parameters

iduuidRequired
The link's id. Anything that isn't a link of the key's scope is 404 link_not_found.

Body parameters

variantIdstringRequired
The winning variant's id: a, b, c or d, one of the running test's.

Response

200 OK. The updated link object.

Errors

Pick an A/B test's winner: errors
StatusCodeMeaning
400validation_errorvariantId isn't one of the running test's variants.
404link_not_foundNo such link in the key's workspace (or, for a folder-level key, its folder).
409ab_test_not_runningThe link has no A/B test.
422unsafe_destinationOne of our own rules catches the winner's URL, when it differs from the current destinationUrl. The body adds field (destinationUrl), provider (own_rules) and threatType. Nothing is changed and the test keeps running. A threat-intelligence service never answers this error: the same URLs are checked right after the link is saved, and a listed link is taken down, usually within seconds, and at the latest the next time we check all links (moderated becomes true and active false).

cURL

curl -X POST "https://api.sendurl.to/api/v1/links/5d8f2a1c-7b3e-4c9d-a0e1-6f2b8c4d1e7a/ab-test/winner" \
  -H "Authorization: Bearer $SENDURL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "variantId": "b"
  }'
200 OK
{
  "id": "5d8f2a1c-7b3e-4c9d-a0e1-6f2b8c4d1e7a",
  "slug": "x7Kp2",
  "destinationUrl": "https://example.com/blog/launch-b",
  "iosUrl": null,
  "androidUrl": null,
  "title": "Launch post",
  "active": true,
  "moderated": false,
  "expiresAt": "2030-12-31T23:59:59.000Z",
  "passwordProtected": false,
  "visitsCount": 0,
  "visitsLimit": null,
  "guestToken": null,
  "folderId": "3f6a1d2c-8e4b-4f7a-9c0d-1b2e3a4f5c6d",
  "projectId": "3f6a1d2c-8e4b-4f7a-9c0d-1b2e3a4f5c6d",
  "orgId": "9b2e4c1a-5f3d-4e8b-a1c7-2d6f8e0b3a95",
  "domainId": null,
  "domain": null,
  "userId": "e1a2b3c4-d5e6-4f70-8a9b-0c1d2e3f4a5b",
  "createdAt": "2026-10-13T09:12:44.123Z",
  "updatedAt": "2026-10-14T10:05:31.904Z",
  "shortUrl": "https://snu.to/x7Kp2",
  "qrUrl": "https://snu.to/x7Kp2?q",
  "abTest": null
}

Clicks

List clicks

GET/api/v1/links/:id/clicks

Every recorded visit of the link, newest first, one page at a time. Use GET /links/:id for the total.

AccessAny API key, for links in the folder or workspace it reaches.

Permission (scope)links:read

Path parameters

iduuidRequired
The link's id. Anything that isn't a link of the key's scope is 404 link_not_found.

Query parameters

limitintegerOptional
Page size, 1 to 10. Default 10.
cursorstringOptional
pagination.nextCursor from the previous page. Leave it out for the first page.

Response

200 OK. Click objects. There is no total here.

Errors

List clicks: errors
StatusCodeMeaning
404link_not_foundNo such link in the key's workspace (or, for a folder-level key, its folder).
400validation_errorlimit outside 1–10, a cursor this API didn't issue, or offset sent.

cURL

curl "https://api.sendurl.to/api/v1/links/5d8f2a1c-7b3e-4c9d-a0e1-6f2b8c4d1e7a/clicks?limit=1" \
  -H "Authorization: Bearer $SENDURL_API_KEY"
200 OK
{
  "clicks": [
    {
      "id": "a4c6e8f0-1b3d-4e5f-9a7b-2c4d6e8f0a1b",
      "linkId": "5d8f2a1c-7b3e-4c9d-a0e1-6f2b8c4d1e7a",
      "userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Mobile/15E148 Safari/604.1",
      "referer": null,
      "country": "DE",
      "city": "Berlin",
      "cityLocked": false,
      "device": "mobile",
      "deviceVendor": "Apple",
      "deviceModel": "iPhone",
      "browser": "Mobile Safari",
      "browserVersion": "18.6",
      "browserMajor": "18",
      "browserType": null,
      "engineName": "WebKit",
      "engineVersion": "605.1.15",
      "os": "iOS",
      "osVersion": "18.6",
      "cpuArchitecture": null,
      "source": "qr",
      "clickedAt": "2026-10-14T08:03:11.482Z"
    }
  ],
  "pagination": {
    "limit": 1,
    "nextCursor": "WyIyMDI2LTEwLTE0VDA4OjAzOjExLjQ4MjkxM1oiLCJhNGM2ZThmMC0xYjNkLTRlNWYtOWE3Yi0yYzRkNmU4ZjBhMWIiXQ",
    "hasMore": true
  }
}

Clicks

Retrieve a click

GET/api/v1/links/:id/clicks/:clickId

One click of the link, however old.

AccessAny API key, for links in the folder or workspace it reaches.

Permission (scope)links:read

Path parameters

iduuidRequired
The link's id. Anything that isn't a link of the key's scope is 404 link_not_found.
clickIduuidRequired
The click's id, from the clicks list.

Response

200 OK. A click object.

Errors

Retrieve a click: errors
StatusCodeMeaning
404link_not_foundNo such link in the key's workspace (or, for a folder-level key, its folder).
404click_not_foundNo click with that id on this link.

cURL

curl "https://api.sendurl.to/api/v1/links/5d8f2a1c-7b3e-4c9d-a0e1-6f2b8c4d1e7a/clicks/a4c6e8f0-1b3d-4e5f-9a7b-2c4d6e8f0a1b" \
  -H "Authorization: Bearer $SENDURL_API_KEY"
200 OK
{
  "id": "a4c6e8f0-1b3d-4e5f-9a7b-2c4d6e8f0a1b",
  "linkId": "5d8f2a1c-7b3e-4c9d-a0e1-6f2b8c4d1e7a",
  "userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Mobile/15E148 Safari/604.1",
  "referer": null,
  "country": "DE",
  "city": "Berlin",
  "cityLocked": false,
  "device": "mobile",
  "deviceVendor": "Apple",
  "deviceModel": "iPhone",
  "browser": "Mobile Safari",
  "browserVersion": "18.6",
  "browserMajor": "18",
  "browserType": null,
  "engineName": "WebKit",
  "engineVersion": "605.1.15",
  "os": "iOS",
  "osVersion": "18.6",
  "cpuArchitecture": null,
  "source": "qr",
  "clickedAt": "2026-10-14T08:03:11.482Z"
}

Analytics

Analytics overview

GET/api/v1/analytics/overview

The dashboard of a date range: clicks, unique visitors, daily average and QR scans with the previous period, the clicks over time, the top links, tags and social sources, and the top devices, browsers, systems, countries and referrers.

For the whole workspace (a workspace key without folderId), one folder, or one link.

AccessAny API key, over the folder or workspace it reaches: a folder-level key reads its own folder only.

Permission (scope)analytics:read

Query parameters

fromdateRequired
First day, YYYY-MM-DD, in tz. Not before the plan's history window (limits.earliest): else 400 range_outside_history.
todateRequired
Last day, inclusive, YYYY-MM-DD, in tz. Not before from; tomorrow is answered as today, later is 400.
tzstringOptional
The time zone days are counted in: UTC (default) or an IANA name such as Europe/Berlin. range.tz echoes the name used.
folderIduuidOptional
Only this folder's links. Without it, a workspace key reads the whole workspace and a folder-level key its own folder; another folder is 404 project_not_found.
projectIduuidOptional
Deprecated: the old name of folderId.
linkIduuidOptional
Only this link (in folderId when both are given). A link outside the key's scope is 404 link_not_found.
comparebooleanOptional
true (default) adds the previous period of the same length: previous, kpis.previous and each row's previousClicks and change.

Response

200 OK. On Starter (30 days of history). Breakdown rows are the top 7; rest is the other values' clicks, unknown the clicks without one.

  • Analytics keep today and the days before it that the plan allows: Free 7 days, Starter 30 days, Pro 180 days, Growth 365 days, Enterprise lifetime. limits in every answer says the window (historyDays, earliest). GET /links/:id/stats and the clicks endpoints keep the whole history.
  • On Free, unique visitors, cities and UTM breakdowns are Starter and above: uniqueVisitors is null, locked says what is withheld, and city is null with cityLocked: true on each click.
  • A click counts toward its link's current folder; deleted links' clicks are left out. Crawlers and link-preview fetchers count. Unique visitors are an approximation (distinct addresses); no address is ever returned.
  • Every answer is Cache-Control: private, no-store.
  • A workspace key without folderId reads the whole workspace, which is slower; pass folderId or linkId when you can. API keys share analytics capacity with the dashboard and get a smaller share of it, counted on each API server: one request of a workspace's keys runs at a time and two across all keys, and at most 2 more of a workspace's keys (10 across all keys) wait in line for up to 3 seconds; beyond that a request is refused at once. Send analytics requests one after another, never in parallel, and on a 503 analytics_unavailable wait the Retry-After seconds before retrying.
  • series is by hour for a range of two days or less, else by day, in tz; its clicks add up to kpis.clicks. share is a fraction of the clicks (0–1), change the change from the previous period (0.25 = +25 %), null when the previous period had none.
  • topLinks, topTags and links are null with linkId. A click counts toward every tag of its link, so tag shares can add up past 1. olderClicks (Free only, else null) says whether there are clicks before the window.

Errors

Analytics overview: errors
StatusCodeMeaning
400validation_errorA parameter breaks a rule (a date that doesn't exist, to before from, an unknown tz); issues says which.
400range_outside_historyfrom is before the plan's history window. The body adds historyDays and earliest.
404project_not_foundfolderId isn't a folder of the workspace, or isn't a folder-level key's own folder.
404link_not_foundlinkId isn't a link in the key's scope.
503analytics_unavailableToo busy or too slow just now. Retry after Retry-After seconds.

cURL

curl "https://api.sendurl.to/api/v1/analytics/overview?from=2026-10-12&to=2026-10-14&tz=UTC" \
  -H "Authorization: Bearer $SENDURL_API_KEY"
200 OK
{
  "range": {
    "from": "2026-10-12",
    "to": "2026-10-14",
    "tz": "UTC",
    "days": 3,
    "granularity": "day",
    "start": "2026-10-12T00:00:00.000Z",
    "end": "2026-10-15T00:00:00.000Z"
  },
  "previous": {
    "start": "2026-10-09T00:00:00.000Z",
    "end": "2026-10-12T00:00:00.000Z"
  },
  "limits": {
    "historyDays": 90,
    "earliest": "2026-07-16"
  },
  "kpis": {
    "clicks": 42,
    "uniqueVisitors": 31,
    "dailyAverage": 14,
    "qrScans": 5,
    "previous": {
      "clicks": 35,
      "uniqueVisitors": 27,
      "dailyAverage": 11.7,
      "qrScans": 3
    }
  },
  "locked": {
    "uniqueVisitors": false,
    "city": false,
    "utm": false
  },
  "links": {
    "total": 12,
    "created": 2,
    "createdPrevious": 1
  },
  "topLinks": [
    {
      "link": {
        "id": "5d8f2a1c-7b3e-4c9d-a0e1-6f2b8c4d1e7a",
        "slug": "x7Kp2",
        "title": "Autumn launch",
        "shortUrl": "https://snu.to/x7Kp2",
        "active": true,
        "moderated": false,
        "expiresAt": null,
        "passwordProtected": false
      },
      "clicks": 30,
      "previousClicks": 24,
      "share": 0.714,
      "change": 0.25
    }
  ],
  "topTags": {
    "rows": [
      {
        "tag": {
          "id": "0e7b1c2d-3a4f-4b5c-8d6e-7f8091a2b3c4",
          "name": "Campaigns",
          "color": "blue"
        },
        "clicks": 18,
        "previousClicks": 12,
        "share": 0.429,
        "change": 0.5
      }
    ],
    "untagged": {
      "clicks": 24,
      "previousClicks": 23,
      "share": 0.571,
      "change": 0.043
    }
  },
  "social": {
    "rows": [
      {
        "key": {
          "kind": "host",
          "host": "instagram.com",
          "source": "instagram",
          "label": "Instagram"
        },
        "clicks": 6,
        "previousClicks": null,
        "share": 1,
        "change": null
      }
    ],
    "total": 6,
    "previousTotal": null
  },
  "olderClicks": null,
  "series": [
    {
      "start": "2026-10-12T00:00:00.000Z",
      "local": "2026-10-12",
      "clicks": 14
    },
    {
      "start": "2026-10-13T00:00:00.000Z",
      "local": "2026-10-13",
      "clicks": 19
    },
    {
      "start": "2026-10-14T00:00:00.000Z",
      "local": "2026-10-14",
      "clicks": 9
    }
  ],
  "breakdowns": {
    "device": {
      "rows": [
        {
          "key": "mobile",
          "clicks": 28
        },
        {
          "key": "desktop",
          "clicks": 14
        }
      ],
      "unknown": 0,
      "rest": 0,
      "total": 42
    },
    "browser": {
      "rows": [
        {
          "key": "Chrome",
          "clicks": 25
        },
        {
          "key": "Safari",
          "clicks": 17
        }
      ],
      "unknown": 0,
      "rest": 0,
      "total": 42
    },
    "os": {
      "rows": [
        {
          "key": "Android",
          "clicks": 20
        },
        {
          "key": "iOS",
          "clicks": 12
        },
        {
          "key": "Windows",
          "clicks": 10
        }
      ],
      "unknown": 0,
      "rest": 0,
      "total": 42
    },
    "country": {
      "rows": [
        {
          "key": "IN",
          "clicks": 22
        },
        {
          "key": "US",
          "clicks": 15
        }
      ],
      "unknown": 5,
      "rest": 0,
      "total": 42
    },
    "referrer": {
      "rows": [
        {
          "key": {
            "kind": "direct",
            "host": null,
            "source": null,
            "label": "Direct"
          },
          "clicks": 31
        },
        {
          "key": {
            "kind": "host",
            "host": "instagram.com",
            "source": "instagram",
            "label": "Instagram"
          },
          "clicks": 6
        },
        {
          "key": {
            "kind": "qr",
            "host": null,
            "source": null,
            "label": "QR scan"
          },
          "clicks": 5
        }
      ],
      "rest": 0,
      "total": 42
    }
  },
  "generatedAt": "2026-10-14T16:20:05.118Z"
}

Analytics

Analytics breakdown

GET/api/v1/analytics/breakdown

One dimension of a date range, ranked by clicks: links, countries, cities, devices, browsers, systems, referrers, UTM values, an A/B test's variants or a link's country rules, each with its unique visitors, share, the previous period and a sparkline.

AccessAny API key, over the folder or workspace it reaches: a folder-level key reads its own folder only.

Permission (scope)analytics:read

Query parameters

fromdateRequired
First day, YYYY-MM-DD, in tz. Not before the plan's history window (limits.earliest): else 400 range_outside_history.
todateRequired
Last day, inclusive, YYYY-MM-DD, in tz. Not before from; tomorrow is answered as today, later is 400.
tzstringOptional
The time zone days are counted in: UTC (default) or an IANA name such as Europe/Berlin. range.tz echoes the name used.
folderIduuidOptional
Only this folder's links. Without it, a workspace key reads the whole workspace and a folder-level key its own folder; another folder is 404 project_not_found.
projectIduuidOptional
Deprecated: the old name of folderId.
linkIduuidOptional
Only this link (in folderId when both are given). A link outside the key's scope is 404 link_not_found.
dimensionstringRequired
link, country, city, device, browser, os, referrer, utm, variant or geo_rule. link ranks every link in scope, those without clicks too, and refuses linkId; variant and geo_rule need linkId. geo_rule (every plan) keys each row by the country rule's id (a string), adds rule: { countries, url } as the link has it now (null for a rule removed since) and has no unique visitors (null); its body adds the link's geoTargets. city and utm are Starter and above.
orderstringOptional
desc (default) or asc.
limitintegerOptional
Rows, 1–50. Default 25.
bystringOptional
dimension=utm only: source (default), medium or campaign, read from each link's destination URL.
categorystringOptional
dimension=referrer only: social keeps the social networks.

Response

200 OK. On Pro. On Free each uniqueVisitors is null.

  • Analytics keep today and the days before it that the plan allows: Free 7 days, Starter 30 days, Pro 180 days, Growth 365 days, Enterprise lifetime. limits in every answer says the window (historyDays, earliest). GET /links/:id/stats and the clicks endpoints keep the whole history.
  • On Free, unique visitors, cities and UTM breakdowns are Starter and above: uniqueVisitors is null, locked says what is withheld, and city is null with cityLocked: true on each click.
  • A click counts toward its link's current folder; deleted links' clicks are left out. Crawlers and link-preview fetchers count. Unique visitors are an approximation (distinct addresses); no address is ever returned.
  • Every answer is Cache-Control: private, no-store.
  • A workspace key without folderId reads the whole workspace, which is slower; pass folderId or linkId when you can. API keys share analytics capacity with the dashboard and get a smaller share of it, counted on each API server: one request of a workspace's keys runs at a time and two across all keys, and at most 2 more of a workspace's keys (10 across all keys) wait in line for up to 3 seconds; beyond that a request is refused at once. Send analytics requests one after another, never in parallel, and on a 503 analytics_unavailable wait the Retry-After seconds before retrying.
  • A row's key is the value (null for unknown); link rows add link, city keys are { country, city }, referrer keys { kind, host, source, label }. spark has one count per hour or day of the range. restClicks is the clicks of the rows past limit.

Errors

Analytics breakdown: errors
StatusCodeMeaning
400validation_errorA parameter breaks a rule (a date that doesn't exist, to before from, an unknown tz); issues says which.
400range_outside_historyfrom is before the plan's history window. The body adds historyDays and earliest.
403plan_upgrade_requireddimension=city or utm on Free (feature: "advanced_analytics", requiredPlan: "pro").
404project_not_foundfolderId isn't a folder of the workspace, or isn't a folder-level key's own folder.
404link_not_foundlinkId isn't a link in the key's scope.
503analytics_unavailableToo busy or too slow just now. Retry after Retry-After seconds.

cURL

curl "https://api.sendurl.to/api/v1/analytics/breakdown?from=2026-10-12&to=2026-10-14&dimension=country&limit=2" \
  -H "Authorization: Bearer $SENDURL_API_KEY"
200 OK
{
  "dimension": "country",
  "order": "desc",
  "range": {
    "from": "2026-10-12",
    "to": "2026-10-14",
    "tz": "UTC",
    "days": 3,
    "granularity": "day",
    "start": "2026-10-12T00:00:00.000Z",
    "end": "2026-10-15T00:00:00.000Z"
  },
  "previous": {
    "start": "2026-10-09T00:00:00.000Z",
    "end": "2026-10-12T00:00:00.000Z"
  },
  "limits": {
    "historyDays": 90,
    "earliest": "2026-07-16"
  },
  "rows": [
    {
      "key": "IN",
      "clicks": 22,
      "uniqueVisitors": 16,
      "share": 0.524,
      "previousClicks": 18,
      "change": 0.222,
      "spark": [
        7,
        10,
        5
      ]
    },
    {
      "key": "US",
      "clicks": 15,
      "uniqueVisitors": 11,
      "share": 0.357,
      "previousClicks": 12,
      "change": 0.25,
      "spark": [
        5,
        6,
        4
      ]
    }
  ],
  "rowCount": 3,
  "total": {
    "clicks": 42,
    "uniqueVisitors": 31
  },
  "restClicks": 5,
  "locked": {
    "uniqueVisitors": false,
    "city": false,
    "utm": false
  }
}

Analytics

Analytics clicks

GET/api/v1/analytics/clicks

The clicks of a date range across every link in scope, newest first, one page at a time. For one link's whole history, use GET /links/:id/clicks.

AccessAny API key, over the folder or workspace it reaches: a folder-level key reads its own folder only.

Permission (scope)analytics:read

Query parameters

fromdateRequired
First day, YYYY-MM-DD, in tz. Not before the plan's history window (limits.earliest): else 400 range_outside_history.
todateRequired
Last day, inclusive, YYYY-MM-DD, in tz. Not before from; tomorrow is answered as today, later is 400.
tzstringOptional
The time zone days are counted in: UTC (default) or an IANA name such as Europe/Berlin. range.tz echoes the name used.
folderIduuidOptional
Only this folder's links. Without it, a workspace key reads the whole workspace and a folder-level key its own folder; another folder is 404 project_not_found.
projectIduuidOptional
Deprecated: the old name of folderId.
linkIduuidOptional
Only this link (in folderId when both are given). A link outside the key's scope is 404 link_not_found.
limitintegerOptional
Page size, 1 to 10. Default 10.
cursorstringOptional
pagination.nextCursor from the previous page. Leave it out for the first page.

Response

200 OK. On Pro.

  • Analytics keep today and the days before it that the plan allows: Free 7 days, Starter 30 days, Pro 180 days, Growth 365 days, Enterprise lifetime. limits in every answer says the window (historyDays, earliest). GET /links/:id/stats and the clicks endpoints keep the whole history.
  • On Free, unique visitors, cities and UTM breakdowns are Starter and above: uniqueVisitors is null, locked says what is withheld, and city is null with cityLocked: true on each click.
  • A click counts toward its link's current folder; deleted links' clicks are left out. Crawlers and link-preview fetchers count. Unique visitors are an approximation (distinct addresses); no address is ever returned.
  • Every answer is Cache-Control: private, no-store.
  • A workspace key without folderId reads the whole workspace, which is slower; pass folderId or linkId when you can. API keys share analytics capacity with the dashboard and get a smaller share of it, counted on each API server: one request of a workspace's keys runs at a time and two across all keys, and at most 2 more of a workspace's keys (10 across all keys) wait in line for up to 3 seconds; beyond that a request is refused at once. Send analytics requests one after another, never in parallel, and on a 503 analytics_unavailable wait the Retry-After seconds before retrying.
  • Each click is { id, linkId, slug, shortUrl, clickedAt, country, city, cityLocked, device, browser, os, referrer }; referrer is the referring site ({ kind, host, source, label }), never the full referring URL. pagination.total is on the first page only.

Errors

Analytics clicks: errors
StatusCodeMeaning
400validation_errorA parameter breaks a rule (a date that doesn't exist, to before from, an unknown tz, limit outside 1–10, a cursor this API didn't issue); issues says which.
400range_outside_historyfrom is before the plan's history window. The body adds historyDays and earliest.
404project_not_foundfolderId isn't a folder of the workspace, or isn't a folder-level key's own folder.
404link_not_foundlinkId isn't a link in the key's scope.
503analytics_unavailableToo busy or too slow just now. Retry after Retry-After seconds.

cURL

curl "https://api.sendurl.to/api/v1/analytics/clicks?from=2026-10-12&to=2026-10-14&limit=1" \
  -H "Authorization: Bearer $SENDURL_API_KEY"
200 OK
{
  "clicks": [
    {
      "id": "a4c6e8f0-1b3d-4e5f-9a7b-2c4d6e8f0a1b",
      "linkId": "5d8f2a1c-7b3e-4c9d-a0e1-6f2b8c4d1e7a",
      "slug": "x7Kp2",
      "shortUrl": "https://snu.to/x7Kp2",
      "clickedAt": "2026-10-14T08:03:11.482Z",
      "country": "IN",
      "city": "Bengaluru",
      "cityLocked": false,
      "device": "mobile",
      "browser": "Chrome",
      "os": "Android",
      "referrer": {
        "kind": "host",
        "host": "instagram.com",
        "source": "instagram",
        "label": "Instagram"
      }
    }
  ],
  "pagination": {
    "limit": 1,
    "nextCursor": "WyIyMDI2LTEwLTE0VDA4OjAzOjExLjQ4MjkxM1oiLCJhNGM2ZThmMC0xYjNkLTRlNWYtOWE3Yi0yYzRkNmU4ZjBhMWIiXQ",
    "hasMore": true,
    "total": 42
  }
}

Domains

List domains

GET/api/v1/domains

The workspace's custom domains (go.yourbrand.com) and subdomains on snu.to (yourbrand.snu.to), newest first, one page at a time, with how many of each the plan allows. Removed domains are left out.

Adding, verifying and removing a domain is done in the console, by the workspace's owners and admins; those endpoints answer an API key with 403 session_required.

AccessAny API key. A folder-level key sees the workspace's domains: it needs their ids for POST /links.

Permission (scope)workspace:read

Query parameters

limitintegerOptional
Page size, 1 to 10. Default 10.
cursorstringOptional
pagination.nextCursor from the previous page. Leave it out for the first page.

Response

200 OK. Domain objects, the workspace's usage, and pagination with total.

  • status is active (links on it open), pending (waiting for the DNS records or the HTTPS certificate) or failed (cloudflare.message says what to fix). Only an active domain takes new links.
  • dns is set for custom domains: the CNAME and TXT records to create. dns.txt.value is always null for an API key; the workspace's owners and admins see it in the console. dns.txt.verified says whether the TXT record was found.
  • usage counts each type separately against the plan's limit. After a move to a smaller plan used can be above limit: existing domains keep working, and no new one of that type can be added.

Errors

List domains: errors
StatusCodeMeaning
400validation_errorlimit outside 1–10, a cursor this API didn't issue, or offset sent.
503domains_unavailableDomains are switched off for now. Retry later.

cURL

curl "https://api.sendurl.to/api/v1/domains" \
  -H "Authorization: Bearer $SENDURL_API_KEY"
200 OK
{
  "domains": [
    {
      "id": "d3f5b7c9-e1a3-4b5d-8f7a-9b1c3d5e7f9a",
      "type": "custom",
      "hostname": "go.yourbrand.com",
      "hostnameUnicode": "go.yourbrand.com",
      "status": "pending",
      "linksCount": 0,
      "createdAt": "2026-10-27T09:04:51.027Z",
      "verifiedAt": null,
      "checkedAt": "2026-10-27T09:05:58.614Z",
      "dns": {
        "cname": {
          "name": "go.yourbrand.com",
          "target": "snu.to"
        },
        "txt": {
          "name": "_sendurl.go.yourbrand.com",
          "value": null,
          "verified": false
        },
        "advice": "If your DNS is on Cloudflare, set the CNAME to DNS only (grey cloud)."
      },
      "cloudflare": {
        "status": null,
        "sslStatus": null,
        "message": "Waiting for the TXT record"
      }
    },
    {
      "id": "c2e4a6b8-d0f2-4a4c-9e6f-8a0b2c4d6e8f",
      "type": "subdomain",
      "hostname": "yourbrand.snu.to",
      "hostnameUnicode": "yourbrand.snu.to",
      "status": "active",
      "linksCount": 4,
      "createdAt": "2026-10-27T09:00:12.381Z",
      "verifiedAt": "2026-10-27T09:00:12.381Z",
      "checkedAt": null,
      "dns": null,
      "cloudflare": null
    }
  ],
  "usage": {
    "subdomains": {
      "used": 1,
      "limit": 1
    },
    "customDomains": {
      "used": 1,
      "limit": 1
    }
  },
  "subdomainParent": "snu.to",
  "cnameTarget": "snu.to",
  "pagination": {
    "limit": 10,
    "nextCursor": null,
    "hasMore": false,
    "total": 2
  }
}

Domains

Retrieve a domain

GET/api/v1/domains/:id

One domain of the workspace, with its DNS records and status.

AccessAny API key.

Permission (scope)workspace:read

Path parameters

iduuidRequired
The domain's id. Anything that isn't a live domain of the key's workspace is 404 domain_not_found.

Response

200 OK. A domain object.

Errors

Retrieve a domain: errors
StatusCodeMeaning
404domain_not_foundNo such domain in the key's workspace, or it was removed.
503domains_unavailableDomains are switched off for now. Retry later.

cURL

curl "https://api.sendurl.to/api/v1/domains/c2e4a6b8-d0f2-4a4c-9e6f-8a0b2c4d6e8f" \
  -H "Authorization: Bearer $SENDURL_API_KEY"
200 OK
{
  "id": "c2e4a6b8-d0f2-4a4c-9e6f-8a0b2c4d6e8f",
  "type": "subdomain",
  "hostname": "yourbrand.snu.to",
  "hostnameUnicode": "yourbrand.snu.to",
  "status": "active",
  "linksCount": 4,
  "createdAt": "2026-10-27T09:00:12.381Z",
  "verifiedAt": "2026-10-27T09:00:12.381Z",
  "checkedAt": null,
  "dns": null,
  "cloudflare": null
}

Workspace

List folders

GET/api/v1/folders

The workspace's folders: Default first, then by name (ignoring case), each with its link count.

AccessWorkspace keys only. A folder-level key gets 403 project_key_forbidden.

Permission (scope)workspace:read

Query parameters

limitintegerOptional
Page size, 1 to 10. Default 10.
cursorstringOptional
pagination.nextCursor from the previous page. Leave it out for the first page.

Response

200 OK. Folder objects and pagination with total (projects, the same items, left out here).

  • GET /projects is the deprecated old path of this endpoint: same answer.
  • The body also carries projects, the same items under their old name (deprecated). Read folders.

Errors

List folders: errors
StatusCodeMeaning
400validation_errorlimit outside 1–10, a cursor this API didn't issue, or offset sent.
403project_key_forbiddenCalled with a folder-level key.

cURL

curl "https://api.sendurl.to/api/v1/folders" \
  -H "Authorization: Bearer $SENDURL_API_KEY"
200 OK
{
  "folders": [
    {
      "id": "3f6a1d2c-8e4b-4f7a-9c0d-1b2e3a4f5c6d",
      "name": "Default",
      "isDefault": true,
      "linksCount": 9,
      "createdAt": "2026-09-02T14:21:07.315Z",
      "updatedAt": "2026-09-02T14:21:07.315Z"
    },
    {
      "id": "7c1e5a9b-2d4f-4e6a-8b3c-0f9d1e2a3b4c",
      "name": "Marketing",
      "isDefault": false,
      "linksCount": 3,
      "createdAt": "2026-10-01T10:00:00.000Z",
      "updatedAt": "2026-10-01T10:00:00.000Z"
    }
  ],
  "pagination": {
    "limit": 10,
    "nextCursor": null,
    "hasMore": false,
    "total": 2
  }
}

Workspace

Create a folder

POST/api/v1/folders

Adds a folder to the workspace, up to its plan's limit (3 on Free, 5 on Starter, 25 on Pro, 100 on Growth and no limit on Enterprise, the Default folder included). Folders can't be deleted or renamed through the API; renaming is in the console.

AccessWorkspace keys only. A folder-level key gets 403 project_key_forbidden.

Permission (scope)folders:write

Body parameters

namestringRequired
1–100 characters after trimming spaces. Unique in the workspace, ignoring case.

Response

201 Created. The new folder.

  • POST /projects is the deprecated old path of this endpoint: same answer.

Errors

Create a folder: errors
StatusCodeMeaning
400validation_errorA field breaks a rule; issues says which.
403project_key_forbiddenCalled with a folder-level key.
403project_limit_reachedThe workspace already has as many folders as its plan allows.
409project_name_takenA folder with that name (in any letter case) exists.

cURL

curl -X POST "https://api.sendurl.to/api/v1/folders" \
  -H "Authorization: Bearer $SENDURL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Marketing"
  }'
201 Created
{
  "id": "7c1e5a9b-2d4f-4e6a-8b3c-0f9d1e2a3b4c",
  "name": "Marketing",
  "isDefault": false,
  "linksCount": 0,
  "createdAt": "2026-10-01T10:00:00.000Z",
  "updatedAt": "2026-10-01T10:00:00.000Z"
}

Workspace

Check your key

GET/api/v1/me

Who the key is: its workspace, its folder (null for a workspace key; project is the same, deprecated), the plan, how many links the workspace uses, and how many of them have used half or all of their click limit. A cheap way to test a key.

AccessAny API key.

Permission (scope)workspace:read

Response

200 OK. role is always null for a key. keyPrefix is the key's first 12 characters, never the key. The usage counts cover the whole workspace, even for a folder-level key. linksUsed counts every link, disabled and expired ones included. linksAtVisitLimit counts active, unexpired links whose clicks reached their limit (they answer 410); linksOverHalfVisitLimit counts active, unexpired links that have used half their clicks or more, those at the limit included.

Errors

Only the 401s every request can get.

cURL

curl "https://api.sendurl.to/api/v1/me" \
  -H "Authorization: Bearer $SENDURL_API_KEY"
200 OK
{
  "via": "key",
  "org": {
    "id": "9b2e4c1a-5f3d-4e8b-a1c7-2d6f8e0b3a95",
    "name": "Acme's workspace"
  },
  "role": null,
  "folder": null,
  "project": null,
  "plan": {
    "name": "Free",
    "linksLimit": 25,
    "visitsLimitPerLink": null,
    "subdomainsLimit": 1,
    "customDomainsLimit": 1
  },
  "usage": {
    "linksUsed": 12,
    "linksAtVisitLimit": 0,
    "linksOverHalfVisitLimit": 1
  },
  "key": {
    "id": "b7d9f1a3-c5e7-4f9a-8b1c-3d5e7f9a1b2c",
    "name": "Production",
    "keyPrefix": "snu_XXXXXXXX",
    "expiresAt": null
  }
}

Reference

The click object

One visit of the short URL that was redirected. Device, browser, engine and OS fields are parsed from the user agent and are null when it doesn't say.

Click fields
FieldTypeDescription
iduuidThe click's id.
linkIduuidThe link that was visited.
clickedAtstringISO 8601, UTC.
sourcestring | null"qr" when the visit came through the QR code (?q), else null.
variantstring | nullThe A/B test variant the visit was sent to (a–d), null for a link without a test, an app link or a bot.
geoRulenumber | nullThe id of the link's country rule that sent the visit to its URL, null when no rule matched.
countrystring | nullTwo-letter ISO 3166-1 country code from Cloudflare's geolocation (T1 for Tor), null when unknown.
citystring | nullThe visitor's city, as Cloudflare estimates it; null when unknown and for older clicks. Always null on Free: Starter and above shows it.
cityLockedbooleantrue when the workspace's plan doesn't show cities (Free), so city is null whatever was recorded; false on Starter and above.
refererstring | nullThe visitor's Referer header, if the browser sent one.
userAgentstring | nullThe visitor's User-Agent header.
devicestring | nullDevice type parsed from the user agent: desktop, mobile, tablet, …
deviceVendor, deviceModelstring | nulle.g. Apple, iPhone.
browser, browserVersion, browserMajor, browserTypestring | nulle.g. Chrome, 141.0.0.0, 141.
engineName, engineVersionstring | nullRendering engine, e.g. Blink.
os, osVersionstring | nulle.g. Android, 15.
cpuArchitecturestring | nullWhen the user agent says, e.g. amd64.

Reference

The domain object

A custom domain or a subdomain on snu.to, as GET /domains and GET /domains/:id return it. A link on it has the domain's id as domainId.

Domain fields
FieldTypeDescription
iduuidThe domain's id: domainId on POST /links.
typestringsubdomain (a name on snu.to) or custom (your own domain).
hostnamestringThe name links use, lower case, e.g. go.yourbrand.com. An internationalised name is in its ASCII (xn--) form.
hostnameUnicodestringThe same name as people read it.
statusstringactive, pending or failed. Only an active domain takes new links and opens them.
linksCountintegerLinks on the domain, deleted ones left out.
createdAtstringISO 8601, UTC.
verifiedAtstring | nullWhen the domain first turned active; null before.
checkedAtstring | nullWhen the DNS records and the certificate were last checked (custom domains).
dnsobject | nullCustom domains: { cname: { name, target }, txt: { name, value, verified }, advice }, the two records to create and a sentence to show with them (advice: the Cloudflare DNS-only tip). txt.value is null for an API key. null for a subdomain.
cloudflareobject | nullCustom domains: { status, sslStatus, message }, the hostname's and the certificate's state at our edge (both null until the TXT record matches: no hostname is set up before that), and in message what to do next. null for a subdomain.

Reference

Pagination

Every list (GET /links, GET /links/:id/clicks, GET /domains, GET /folders) is cursor-paginated, at most 10 items per page. Pass pagination.nextCursor back as cursor until hasMore is false. The CSV export (GET /links/export.csv) is not a page: it streams every matching row.

Query parameters

limitintegerOptional
1 to 10, default 10. Anything else (0, 11, 1.5, abc) is 400 validation_error.
cursorstringOptional
Opaque: use it as given. A cursor this API didn't issue is 400 validation_error.

The pagination object

limit
The page size used.
nextCursor
The next page's cursor, or null on the last page.
hasMore
Whether another page follows.
total
Items in scope, on links and folders. Clicks have no total; GET /links/:id has totalClicks.
  • Pages don't shift when links or clicks are added in between: the cursor marks a position, not a count. The exception is GET /links with sort=clicks_desc or clicks_asc: a link's click count changes with every visit, so a link clicked between two pages can be skipped or repeated. Dedupe by id.
  • offset is not supported and is refused with 400 validation_error. Other unknown parameters are ignored.

cURL · next page

curl "https://api.sendurl.to/api/v1/links?limit=2&cursor=WyIyMDI2LTEwLTEzVDA5OjEyOjQ0LjEyMzQ1NloiLCI1ZDhmMmExYy03YjNlLTRjOWQtYTBlMS02ZjJiOGM0ZDFlN2EiXQ" \
  -H "Authorization: Bearer $SENDURL_API_KEY"

Reference

Errors

Errors have a non-2xx status and one JSON shape: error, a stable code to branch on; message, a sentence for people that may be reworded; and, on validation_error only, issues, the list of what failed, each with a path naming the field. Some codes add fields of their own: link_limit_reached carries limit and current, insufficient_scope carries requiredScope.

400 · Schema rules
{
  "error": "validation_error",
  "message": "Invalid request",
  "issues": [
    {
      "validation": "url",
      "code": "invalid_string",
      "message": "Invalid url",
      "path": [
        "destinationUrl"
      ]
    },
    {
      "validation": "regex",
      "code": "invalid_string",
      "message": "Slug must be 1-256 characters: letters, digits, '-' or '_'",
      "path": [
        "slug"
      ]
    }
  ]
}
400 · Expiry and password rules
{
  "error": "validation_error",
  "message": "Expiry must be in the future",
  "issues": [
    {
      "code": "custom",
      "path": [
        "expiresAt"
      ],
      "message": "Expiry must be in the future"
    }
  ]
}
403 · Link limit
{
  "error": "link_limit_reached",
  "message": "You have reached the maximum of 25 links on the Free plan.",
  "limit": 25,
  "current": 25
}
Error codes
StatusCodeMeaning
400validation_errorA body field, query parameter or cursor breaks a rule. issues lists them.
400invalid_jsonThe body isn't valid JSON.
400bad_requestThe request couldn't be read, e.g. a body cut short. The status is the one that fits: 400, or 415 for an unsupported charset or Content-Encoding.
400range_outside_historyAn analytics from before the plan's history window. The body adds historyDays and earliest.
401missing_tokenNo Authorization: Bearer … header.
401invalid_tokenThe Bearer token is neither an API key (snu_…) nor a valid console session.
401invalid_api_keyAn snu_ key that isn't valid. message: “Invalid API key” (malformed or unknown), “This API key was revoked” or “This API key has expired”.
403session_requiredA console-only endpoint: API key management, listing workspaces (GET /orgs), renaming folders or the workspace, adding, verifying or removing a domain, profile, reports.
403insufficient_scopeThe key wasn't given the permission (scope) this endpoint needs. requiredScope names it. Create a key with that permission, or with Full access.
403project_forbiddenA folder-level key named another folder in a write.
403project_key_forbiddenA folder-level key called /folders (or /projects).
403link_limit_reachedThe workspace has used all its plan's links.
403project_limit_reachedThe workspace has as many folders as its plan allows.
403plan_upgrade_requiredA feature your plan doesn't include: deleting a link on Free, changing a link's destination after creating it on Free, or a Starter or Pro feature (the body names it in feature and the lowest plan that has it in requiredPlan).
403link_moderatedRe-enabling or deleting a link disabled by moderation.
404link_not_foundNo such link in the key's scope.
404click_not_foundNo such click on that link.
404project_not_foundNo such folder in the workspace (or the key's scope).
404domain_not_foundNo such domain in the workspace, or it was removed.
404not_foundNo such endpoint.
409slug_takenThe custom back-half is in use on that domain, or (rarely) a random slug collided: retry.
409project_name_takenA folder with that name exists.
409domain_not_activeCreating a link on a domain that isn't active yet.
413payload_too_largeThe body is too large.
422unsafe_destinationCreating or editing a link whose URL one of our own rules flags as unsafe. The body adds field, provider and threatType. A URL a threat-intelligence service lists is not refused: the link is saved and taken down, usually within seconds, and at the latest the next time we check all links (moderated: true, active: false).
422too_many_urlsCreating or editing a link so it holds more than 15 web URLs in total (its destinations plus the web URLs inside them, each counted once), or with one URL over its own limits (more than 8 web URLs in one address, nested too deep, or too complex to check). The body adds limit, current and reason (link, urls, depth or work), and field and fieldLimit for one URL over its own limits; the message names the limit.
429domain_rate_limitedAdding a domain in the console after 5 were added in the last hour (removed ones count). Retry after retryAfterSeconds (also sent as Retry-After). Adding domains is console-only, so an API key never gets it.
500internal_errorSomething failed on our side.
503service_unavailableWe couldn't check the key just now. Retry.
503analytics_unavailableAnalytics are too busy or too slow just now. Retry after Retry-After seconds.
503export_unavailableAn export is already running (one per workspace, a few per server). Retry after retryAfterSeconds (also sent as Retry-After).
503domains_unavailableDomains are switched off for now. Retry later.

Reference

Rate limits

There is no per-key limit (the MCP server has its own, above). Cloudflare, in front of the API, allows 50 requests per 10 seconds from one IP address; past that it answers 429 for 10 seconds. That response comes from Cloudflare, not the API, so it isn't in the JSON error shape. Wait and retry with backoff.