curl-able knowledge: the REST API for your base
Base URL https://the-snip.com/api/v1. Authenticate with a workspace API key — Authorization: Bearer snip_..., generated in Settings → API keys. Same service layer, same review gate as MCP: CI scripts, bots and cron jobs use the identical eight operations.
Reads are free — any agent can search the base on the Free plan. Agent writes (create and update) need Pro & Team, $8/user/mo.
The eight operations
| Method | Path | Request fields | Response |
|---|---|---|---|
| POST | /api/v1/search | all optional: query, type (snippet | api | doc), language, collectionId, tags, sort (relevance | updated | created | title), limit | 200 — matching items |
| POST | /api/v1/snippets | title, language, code · optional: description, collectionId, sampleOutput, tags (≤10 names; absent → up to 3 suggested) | 201 — created item, status in review |
| POST | /api/v1/apis | title, method, url · optional: description, collectionId, headers (JSON), requestBody, sampleResponse | 201 — created item, status in review |
| POST | /api/v1/docs | title, body · optional: description, collectionId — [[wikilinks]] supported in body | 201 — created item, status in review |
| GET | /api/v1/items/{id} | none — the id is the path; take ids from search results, never guess them | 200 — full item · 404 not found |
| PATCH | /api/v1/items/{id} | any create field, all optional (a patch) | 200 — updated item · 404 not found |
| GET | /api/v1/collections | none | 200 — the workspace's collections (id and name) |
| POST | /api/v1/collections | name · optional: description | 201 — created collection (no review; doesn't count against the item cap) |
Search is a POST with a JSON body, not a query-string read — a bare read probe on the search path answers 405 with the method contract. There are no delete endpoints on the v1 surface today: these eight operations are the whole API, and this page documents all of it.
First call in one paste
curl -X POST https://the-snip.com/api/v1/search \
-H "Authorization: Bearer snip_YOUR_KEY" -H "Content-Type: application/json" \
-d '{"query":"retry with backoff","type":"snippet"}'Returns an array of matching items (truncated):
[
{
"id": "0198f2c1-4e2a-7d31-b3a4-9c6d2f8e1a07",
"workspaceId": "…",
"type": "snippet",
"status": "approved",
"title": "Retry with exponential backoff",
"language": "typescript",
"code": "export async function retry(fn, tries = 3) { /* ... */ }",
"updatedAt": "2026-07-12T09:30:00.000Z",
...
}
]curl -X POST https://the-snip.com/api/v1/snippets \
-H "Authorization: Bearer snip_YOUR_KEY" -H "Content-Type: application/json" \
-d '{"title":"Retry with exponential backoff","language":"typescript","code":"export async function retry(fn, tries = 3) { /* ... */ }"}'Returns 201 with the created item — agent writes land in review ("status": "in_review") until a human approves:
{
"id": "0198f2c1-9b57-7aa2-8c11-2e5f7d4b6c93",
"workspaceId": "…",
"type": "snippet",
"status": "in_review",
"createdVia": "agent",
"title": "Retry with exponential backoff",
"language": "typescript",
"createdAt": "2026-07-12T09:31:00.000Z",
...
}curl -X PATCH https://the-snip.com/api/v1/items/ITEM_ID \
-H "Authorization: Bearer snip_YOUR_KEY" -H "Content-Type: application/json" \
-d '{"description":"Adds jitter between attempts."}'Returns 200 with the updated item — updates are re-gated to review — or 404 when the id is not visible in your workspace.
Error shapes — exactly what failure looks like
Every error is {"error":{"code","message"}} plus machine-actionable fields. These are the real bodies, verbatim:
{"error":{"code":"invalid_json","message":"Body must be valid JSON"}}Send a JSON body with Content-Type: application/json — watch for shell quoting eating your quotes.
{"error":{"code":"invalid_request","message":"Invalid request","details":[{"path":"title","message":"..."}]}}The details array names the exact field and message — agents can self-correct from the body alone. Schemas are strict: unknown fields (including status) are rejected, not ignored.
{"error":{"code":"unauthorized","message":"Missing API key"}}
{"error":{"code":"unauthorized","message":"Invalid API key"}}Send Authorization: Bearer snip_... — keys are generated in Settings → API keys.
{"error":{"code":"forbidden","message":"Agent writes need the Pro & Team plan — reads are free. Upgrade at https://the-snip.com/upgrade"}}
{"error":{"code":"forbidden","message":"Free plan cap reached (25 items). Upgrade for unlimited: https://the-snip.com/upgrade"}}Reads never 403 for plan — writes do. Both bodies name the remedy: upgrade at the-snip.com/upgrade and the same key starts writing.
{"error":{"code":"rate_limited","message":"Rate limit exceeded (60/min per workspace). Retry in 21s","retry_after_sec":21}}The response also carries a Retry-After header with the same seconds value — back off and retry.
{"error":{"code":"not_found","message":"Not found"}}Returned for unknown ids and for ids in other workspaces — existence is never disclosed across tenants.
Rate limit: 60 requests per minute per workspace, across all eight operations.
Hand this API to your LLM
Download a Markdown file that teaches any AI assistant this whole API — the eight operations, the review gate, the error contract. Paste it into your CLAUDE.md, project instructions, or system prompt.
The CLI
A zero-dependency, single-file CLI (Node >= 20, built-in fetch — nothing to install beyond Node) that wraps the same API. It adds no operations of its own.
curl -fsSL https://the-snip.com/cli -o ~/.local/bin/the-snip && chmod +x ~/.local/bin/the-snip
Windows: iwr https://the-snip.com/cli -OutFile the-snip.mjs then run commands as node the-snip.mjs <command> — no chmod or shebang on Windows.
Quickstart: the-snip login snip_...with a key from Settings → API keys, then you're in.
| Command | What it does |
|---|---|
| the-snip login snip_... | store your workspace API key (~/.the-snip/config.json) |
| the-snip search "query" | search the base — --limit, --type snippet|api|doc |
| the-snip get <id> | print an item's raw code/body/url to stdout — pipeable |
| the-snip create snippet --title T -l lang [file] | file a snippet from a file or stdin — --description, --tags a,b |
| the-snip whoami | masked key, base URL, and a validity probe |
Add --json to any command to get the raw response body for scripts. Errors print the real server message — including upgrade URLs and retry_after on a 429.
Same base, native protocol
Prefer MCP? The hosted MCP server exposes the same eight operations as native tools for Claude Code, Cursor, OpenClaw, Hermes and any MCP client. The REST surface fits a shared team API request library and anything that can run curl.
Start your base — free.
Free: 25 items, no card. Pro & Team: $8/user/mo — unlimited items, REST API, review workflow, and the hosted MCP server.