Skip to content

Documentation

The Snip API

Getting started

The Snip API is one HTTPS host, https://snip.link. Every endpoint returns JSON and every error uses the same shape, so you can write one error handler and be done.

1. Create a key

Every account gets one, the free plan included. Sign up, then open API keys and create one. The key is shown once. Store it as an environment variable, never in source control.

2. Send it with every request

Use the Authorization header. If your client cannot set it, send the same value in X-API-Key instead.

Authorization: Bearer snip_live_4Qm7xB2vTnK9pLdW3sHc8YrJf6QaZ1eU5oM

3. Read the meta block

Every tool response is { result, meta }. The meta block carries meta.credits_charged, meta.balance, meta.latency_ms and meta.request_id. The request id is also in the X-Request-Id response header. Log it: it is the fastest way to get an answer about a specific call.

Errors

Every error is JSON with the same three fields, plus optional per-field details on validation failures.

{
  "code": "insufficient_credits",
  "message": "Your balance is 0 credits and this call costs 1. Buy a top-up or upgrade your plan.",
  "request_id": "b9d4d1a2-6a4e-4f1e-9d0a-1d2f3e4c5b6a"
}
StatusCodeWhat to do
400validation_failedFix the body. The details object names each field.
401invalid_api_keyThe key is missing, malformed or revoked. Create a new one.
402insufficient_creditsBuy a top-up pack or move up a plan, then retry.
413input_too_largeThe input is over your plan's size per run. The details carry the size, the limit and the unit; split the input or move up a plan.
429rate_limitedBack off for the number of seconds in Retry-After, then retry.
502upstream_failedSomething the tool depends on failed and the credits were refunded. Retry shortly.
500internal_errorRetry once, then quote the request id if it persists.

Rate limits and credits

Each key has its own requests-per-second ceiling, counted in a sliding one-second window. Your plan sets the maximum; you can set a lower value per key, which is how most people keep a staging key from spending production budget.

Credits are shared across every key on the account and the website. What a run costs is part of each tool's description: QR code generator, 1 credit per code. Calls to /v1/usage and /v1/me are free.

Response headers

HeaderMeaning
X-Request-IdUnique id for this call. Present on every response.
X-Cachehit, miss or off, matching meta.cache.
X-Credits-RemainingCredits left after this call.
Retry-AfterSeconds to wait. Sent with every 429.

Model Context Protocol

AI agents call the same tools over MCP, with the same key, credits and limits. Set it up in Claude, Cursor and other clients.

/llms.txt describes the product and its API in plain text for agents that prefer to read rather than introspect, and /openapi.json is the machine-readable spec this page is generated from.

A scannable QR code as SVG for a link or text, in your style and colours.

POST/v1/qr_codeTools

Encodes a link or text as a static QR code and returns it as a standalone SVG. Picks the smallest version that fits, draws rounded or square modules in your colours, sets the error correction level and quiet zone, and reports the contrast between the colours with a warning when phones may struggle to scan it. Costs 1 credit per code. Input size is counted in characters; the per-run limit depends on the plan. Also available as the MCP tool snip_qr_code.

Request body

JSON, sent with Content-Type: application/json.

FieldTypeRequiredDescription
datastringrequiredWhat the code holds: a link, plain text, or a Wi-Fi, vCard, mailto: or tel: payload. 1 to 2,953 bytes of UTF-8; the most it can hold drops at higher error correction. Size limits are counted in characters and depend on your plan.
stylerounded | squareoptionalModule shape: rounded dots with rounded finder rings, or classic squares. Default rounded.
fgstringoptionalDark module colour as #rrggbb. Default #111111.
bgstringoptionalBackground colour as #rrggbb. Default #ffffff.
eccL | M | Q | HoptionalError correction: L 7%, M 15%, Q 25%, H 30% of the code can be damaged and still scan. Default M.
marginintegeroptionalQuiet zone around the code, in modules. The standard asks for 4. Default 4.
sizeintegeroptionalWidth and height attributes of the SVG, in pixels. The drawing is vector and scales without loss. Default 1024.

Example request

curl -s "https://snip.link/v1/qr_code" \
  -H "Authorization: Bearer $SNIP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data":"https://snip.link/spring-menu?qr=1"}'

Errors

StatusMeaning
400The body is missing or invalid. `details` names each field.
401The API key is missing, malformed or revoked.
402The account has too few credits for this run. Buy a top-up or upgrade the plan.
413The input is larger than the plan allows per run. `details` carries the size, the limit and the unit.
429The key exceeded its requests-per-second limit. Honor the Retry-After header.
502An upstream the tool depends on failed. The credits were refunded.
504The run took longer than the tool's time limit. The credits were refunded.

Current period usage

GET/v1/usageAccount

Balance and usage for the current UTC month, plus the calling key's own request count. Free to call.

Parameters

This endpoint takes no parameters.

Example request

curl -s "https://snip.link/v1/usage" \
  -H "Authorization: Bearer $SNIP_KEY"

Errors

StatusMeaning
401The API key is missing, malformed or revoked.

Key metadata

GET/v1/meAccount

Describes the calling key and its plan. Useful for verifying a key before shipping it in a deployment. Free to call.

Parameters

This endpoint takes no parameters.

Example request

curl -s "https://snip.link/v1/me" \
  -H "Authorization: Bearer $SNIP_KEY"

Errors

StatusMeaning
401The API key is missing, malformed or revoked.

Schemas

The spec defines 7 schemas: QrCodeResponse, QrCodeResult, RunMeta, Error, QrCodeInput, UsageResponse, MeResponse. Generate a typed client from /openapi.json rather than hand writing types.