API
API
Clankie's HTTP API is the local service the CLI and apps talk to. This overview covers the base URL, credentials, errors and where each group of routes is documented.
Clankie runs one service on your machine. The clankie CLI, the apps, the worker plugins and the extensions all talk to it over HTTP, and you can call the same routes yourself. The pages in this section list every route the service answers, written from its route handlers.
Base URL
http://127.0.0.1:4310The service listens on the loopback address only. Set PORT in the service's environment to change the port. There is no index page: / answers 404, and GET /health is the public probe.
curl -sS http://127.0.0.1:4310/healthMost paths start with /v1/. The conversation dispatch route is /operator/v1/dispatch.
Credentials
Send a credential as a bearer token:
curl -sS http://127.0.0.1:4310/v1/devices \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Each endpoint names the credentials it takes.
| Credential | Who holds it | What it reaches |
|---|---|---|
| Operator token | You, on the machine that runs Clankie. The CLI uses it for every owner command. | Owner routes: settings, devices, accounts, work, evidence, reviews and the fleet. |
| Device session | A paired phone, Mac or app. Pairing returns it; see Pairing and devices. | The device's own routes, and owner routes when the device has Take Control. |
| Account token | Someone you gave a clk_… token with read scopes. |
Read-only account routes. |
| Lead token | Clankie's lead agent. | Conversation dispatch and the lead's own routes. |
| Discord bridge token | The Discord extension's own processes. | The Discord routes they call. |
| Worker seat | Clankie's worker plugin, inside a worker it hired. No bearer token works. | The routes under /v1/fleet/seats/. |
The service never returns a stored secret. Connected-account tokens and extension credentials stay in its credential store.
clankie operator-credential rotate replaces the operator token and ends every session that used the old one.
Requests and responses
- Request and response bodies are JSON unless an endpoint says otherwise. Send
Content-Type: application/jsonwith a body. - Timestamps are ISO 8601 strings in UTC.
- Most request schemas are strict: a field the endpoint doesn't list is refused, not ignored.
- Many settings carry a
revision. Send the value you read back asexpectedRevisionwhen you write; if the setting changed in between, the write answers409and saves nothing.
Errors
An error is a JSON object with an error code, and sometimes more fields that explain it:
{ "error": "authentication_required" }Each endpoint lists its own codes. These apply across the service:
| Status | error |
When |
|---|---|---|
401 |
authentication_required |
No credential, or one this route doesn't take. |
401 |
device_authentication_required |
The route needs a device session. |
401 |
expired, revoked |
The device session ran out, or its device was revoked. |
403 |
forbidden |
The credential is valid but lacks the grant this route needs. |
503 |
authentication_unavailable |
The service can't check credentials right now. Retry. |
503 |
route_unavailable |
This service doesn't serve the route. |
503 |
body_dormant |
Clankie has moved to another machine. This one answers only /health, device sign-in and the move routes. |
Pagination
There is no single pagination scheme. A route that pages says so and names its own parameters:
- Conversation
replayandtailtake acursorand alimit; see Conversations. GET /v1/evidence/recenttakeslimitandcursor, and returnsnextCursorwhile more records remain; see Work, reviews and evidence.- Other list routes that cap their results take a
limitparameter, documented on the route.
Every other list returns the whole set.
Reference
| Page | Routes |
|---|---|
| Pairing and devices | Health, pairing, devices, owner keys, support grants, account tokens, owner asks |
| Machines and fleet | Joined machines, the agent host, fleet capacity, checkouts, updates, moving Clankie to another machine |
| Settings and accounts | Owner settings, worker models and accounts, extension switches, persona, voice, appearance, connected accounts |
| Conversations | Conversation dispatch and its operations, conversation heads, Auto rounds, metrics, memory |
| Work, reviews and evidence | Work items, tracker calls, Linear and GitHub settings, the review gate, the evidence store |
| Extension routes | Discord, voice, computer, media and browser |
| Worker and lead routes | The routes Clankie's worker plugin and lead call, and the MCP endpoints |