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"
}| Status | Code | What to do |
|---|---|---|
| 400 | validation_failed | Fix the body. The details object names each field. |
| 401 | invalid_api_key | The key is missing, malformed or revoked. Create a new one. |
| 402 | insufficient_credits | Buy a top-up pack or move up a plan, then retry. |
| 413 | input_too_large | The 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. |
| 429 | rate_limited | Back off for the number of seconds in Retry-After, then retry. |
| 502 | upstream_failed | Something the tool depends on failed and the credits were refunded. Retry shortly. |
| 500 | internal_error | Retry 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
| Header | Meaning |
|---|---|
X-Request-Id | Unique id for this call. Present on every response. |
X-Cache | hit, miss or off, matching meta.cache. |
X-Credits-Remaining | Credits left after this call. |
Retry-After | Seconds 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.
/v1/qr_codeToolsEncodes 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.
| Field | Type | Required | Description |
|---|---|---|---|
data | string | required | What 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. |
style | rounded | square | optional | Module shape: rounded dots with rounded finder rings, or classic squares. Default rounded. |
fg | string | optional | Dark module colour as #rrggbb. Default #111111. |
bg | string | optional | Background colour as #rrggbb. Default #ffffff. |
ecc | L | M | Q | H | optional | Error correction: L 7%, M 15%, Q 25%, H 30% of the code can be damaged and still scan. Default M. |
margin | integer | optional | Quiet zone around the code, in modules. The standard asks for 4. Default 4. |
size | integer | optional | Width 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
| Status | Meaning |
|---|---|
| 400 | The body is missing or invalid. `details` names each field. |
| 401 | The API key is missing, malformed or revoked. |
| 402 | The account has too few credits for this run. Buy a top-up or upgrade the plan. |
| 413 | The input is larger than the plan allows per run. `details` carries the size, the limit and the unit. |
| 429 | The key exceeded its requests-per-second limit. Honor the Retry-After header. |
| 502 | An upstream the tool depends on failed. The credits were refunded. |
| 504 | The run took longer than the tool's time limit. The credits were refunded. |
Current period usage
/v1/usageAccountBalance 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
| Status | Meaning |
|---|---|
| 401 | The API key is missing, malformed or revoked. |
Key metadata
/v1/meAccountDescribes 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
| Status | Meaning |
|---|---|
| 401 | The 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.