API and MCP server

Everything the form does, the API does too. Rate-limited per IP without a key; with an account key the limit is higher and links are saved to the account.

Quick start

One POST with a JSON body. The response is the link object; for anonymous links it also contains edit_token, which you should keep if you want to edit or delete the link later.

curl -X POST https://skrat.im/api/v1/links \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer skrat_…" \
  -d '{"url": "https://example.com/dlha/adresa", "alias": "moja-akcia", "domain": "krat.im"}'
{
  "id": "5d1c…",
  "domain": "krat.im",
  "slug": "moja-akcia",
  "short_url": "https://krat.im/moja-akcia",
  "url": "https://example.com/dlha/adresa",
  "status": "active",
  "clicks": 0,
  "preview_url": "https://krat.im/moja-akcia+",
  "qr_png_url": "https://krat.im/moja-akcia.png",
  "stats_url": "https://skrat.im/api/v1/links/5d1c…/stats"
}
curl -X PATCH https://skrat.im/api/v1/links/5d1c… \
  -H "Content-Type: application/json" -H "X-Edit-Token: …" \
  -d '{"url": "https://example.com/nova/adresa"}'

Authentication and limits

Without a key: 60 links per hour and 300 per day per IP address. With an API key (Authorization: Bearer skrat_… header): 1000 per hour and links belong to the account. Create a key in the account settings. Over the limit you get 429 with a Retry-After header.

Endpoints

MethodPathDescription
POST/api/v1/linksCreate a link. Body: url, alias?, domain?, title?, expires_in_days?, expires_at?, max_clicks?, password?, public_stats?, utm_*
GET/api/v1/linksLinks of the account (key required).
GET/api/v1/links/{id}Link detail (owner key or X-Edit-Token).
PATCH/api/v1/links/{id}Edit: url, title, expires_at | expires_in_days, max_clicks, password ("" removes), public_stats.
DELETE/api/v1/links/{id}Delete the link.
GET/api/v1/links/{id}/statsStatistics (public unless the owner hides them).
GET/api/v1/check?slug=&domain=Alias availability, including the other domain.
POST/api/v1/bulkBulk: urls (array or one per line), max. 20 without a key, 200 with one.
GET/api/shorten?url=Plain-text endpoint: returns only the short link.
GET/{alias}+Link preview (HTML).
GET/{alias}.jsonPublic link info (JSON).
GET/{alias}.png | .svgQR code (size, fg, bg, margin).

Errors

Errors always look like { "error": { "code", "message" } }. The message follows ?lang= or Accept-Language. Codes: invalid_url, unsupported_scheme, private_host, self_reference, unsafe_url, slug_invalid, slug_reserved, slug_taken, domain_invalid, rate_limited, not_found, unauthorized, forbidden, too_many.

MCP server for AI agents

The /mcp endpoint speaks the Model Context Protocol over Streamable HTTP (JSON-RPC 2.0, stateless). Tools: shorten_url, check_alias, get_link_info, qr_code. Without a key the per-IP limit applies; with a key in the Authorization header links are saved to the account.

Claude Code:

claude mcp add --transport http skrat https://skrat.im/mcp

Configuration (Claude Desktop, Cursor and similar):

{
  "mcpServers": {
    "skrat": {
      "type": "http",
      "url": "https://skrat.im/mcp",
      "headers": { "Authorization": "Bearer skrat_…" }
    }
  }
}

Bookmarklet

Drag the link to your bookmarks bar. Click it on any page and skrat.im opens with the address filled in.

Shorten on skrat.im

More

The terms of use for the API are the same as for the website.