REST API · JSON

Shortaty API documentation

Create and manage your short links programmatically from any application, service, or script — the same capabilities you get in the dashboard, exposed through a simple, predictable REST API.

Base URL
https://short-tool.vercel.app/api/v1

All requests must use HTTPS. . HTTP requests are rejected.

Authentication

Every request must carry a valid API Key and Secret. There are two equivalent ways — pick whichever fits your HTTP client:

1. Dual-header (recommended)
Clearest and most common in API integrations.
curl https://short-tool.vercel.app/api/v1/links \
  -H "X-API-Key: pk_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "X-API-Secret: sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
2. Bearer + Key (for tools that prefer the Authorization header)
Compatible with Postman, Insomnia, most SDKs.
curl https://short-tool.vercel.app/api/v1/links \
  -H "X-API-Key: pk_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Authorization: Bearer sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Response Envelope

All responses follow the same unified envelope. That simplifies error handling in your code.

✓ Success
{
  "data": {
    "id": "abc-123",
    "short_url": "https://ostazna.blog/x7K9p2",
    ...
  }
}
✗ Error
{
  "error": {
    "code": "validation_failed",
    "message": "Invalid target URL"
  }
}

All responses include the header X-Api-Version: v1. . The status code (200 / 201 / 4xx / 5xx) conveys HTTP-level state, and the error.code field conveys the programmatic detail.

Scopes

Each key is provisioned with specific scopes at creation time. If you call an endpoint without the required scope, the response is 403 insufficient_scope.

ScopeAllowsDefault?
links:readRead links and basic stats✓ Default
links:writeCreate and edit links✓ Default
links:deletePermanently delete linksOptional
domains:readList available domains✓ Default
clicks:readRead detailed click logsOptional

The least privilegeprinciple: grant the key only what it needs. The links:delete and clicks:read scopes are non-default by design.

Rate limits & quotas

Active keys per account10
Request body size≤ 100 KB
Slug length1–200 chars
Password length1–200 chars
Title length≤ 200 chars
Per-URL length≤ 2 KB

Currently there's no strict requests-per-minute rate limit — but abuse may auto-disable the key. If you need higher limits, contact the admin.

Endpoints — overview

MethodPathScope
POST/api/v1/linkslinks:write
GET/api/v1/linkslinks:read
GET/api/v1/links/:idlinks:read
PATCH/api/v1/links/:idlinks:write
DELETE/api/v1/links/:idlinks:delete
GET/api/v1/domainsdomains:read
GET/api/v1/domainsscope: domains:read

Returns the domains you can create links on. Admins — all domains. Regular users — only granted domains.

curl https://short-tool.vercel.app/api/v1/domains \
  -H "X-API-Key: pk_..." \
  -H "X-API-Secret: sk_..."

Error codes

StatuscodeMeaning
400invalid_bodyBody isn't valid JSON.
401missing_credentialsX-API-Key or X-API-Secret is missing.
401invalid_keyapi_key not found.
401invalid_secretSecret doesn't match the key.
401revoked_keyThe key was revoked.
401expired_keyThe key has expired.
403insufficient_scopeThe key lacks the required scope.
403forbiddenNot your link.
403domain_not_grantedYou aren't granted access to this domain.
403domain_disabledThe domain is disabled for your account.
404not_foundResource not found.
404domain_not_foundDomain isn't registered.
409slug_takenThe slug is already used on this domain.
422validation_failedA body field is invalid (see message).
422invalid_slugSlug contains illegal chars or is reserved.
422invalid_subdomainSubdomain is invalid or reserved.
422domain_not_verifiedDomain hasn't been verified yet.
422nothing_to_updatePATCH without any field.
500insert_failedUnexpected DB failure.
500slug_generation_failedCouldn't generate a unique slug.

Ready to start?

Create your first key in under a minute and start creating links programmatically.

Create API Key
API Documentation — Shortaty · Shortaty