REST API
Base: https://tkt.ideathon.me/v1, JSON in and out; /v1/projects/** takes Authorization: Bearer atk_….
The store API endpoints are served only with AITODO_STORE_API=1, and only to a connection on a loopback address or a Unix socket. Schemas: https://tkt.ideathon.me/openapi.json.
Details1 items
POST /v1/projects is open. Production serves /v1/meta, /v1/healthz, /v1/projects/**, /v1/operator/**, /v1/feedback/** and these docs. The list is generated from the server's routes; Swagger UI: https://tkt.ideathon.me/docs/api.
Endpoints#
| endpoint | summary | role |
|---|---|---|
GET /v1/healthz | Liveness, always 200 (#424, owner decision: a busy database must not restart the container); status is degraded when the database cannot be read or its write lock is held, and db says which (server_db.probe: never waits, no token or secret) | |
GET /v1/meta | Published vocabularies: hint types, action types, enums, context guard and package version; who may register a project here (registration: open, invite or closed, #145); and the version of the feedback template (feedback_template_version, #149); error codes, environment variables and the tkt commands (#236) | |
POST /v1/projects | Register a project; the response carries its first admin token, once | |
GET /v1/projects/{project_id} | The project's settings (read), with its server AI budget (#334: the plan, granted, the share used; never tokens) | read |
PATCH /v1/projects/{project_id} | Switch the server LLM on or off (admin, #131; on needs an LLM or an embedding endpoint on the server (#323), else 503), and its answer cache (#178; off deletes the project's cached answers) | admin |
DELETE /v1/projects/{project_id} | Delete the project and everything the server keeps for it, in one transaction (admin, #143): its tokens, LLM usage, caps and cached answers, id counters and claim leases | admin |
GET /v1/projects/{project_id}/whoami | The calling token: name, role, llm grant, expiry (any valid token) | read |
POST /v1/projects/{project_id}/tokens | Create a named token (admin); the response carries the token, once | admin |
GET /v1/projects/{project_id}/tokens | The project's tokens, revoked ones included: never a token value (admin) | admin |
PATCH /v1/projects/{project_id}/tokens/{name} | Change a token's role, llm grant or expiry (admin) | admin |
DELETE /v1/projects/{project_id}/tokens/{name} | Revoke a token; its name stays reserved (admin) | admin |
POST /v1/projects/{project_id}/store | Create the project's store on the server (admin): an empty tkt store in its own git repository; the location becomes server | admin |
GET /v1/projects/{project_id}/store | Where the store lives (repo, server, moving), its version (the HEAD of a server store) and when it last moved | read |
POST /v1/projects/{project_id}/cli | Run tkt <argv> on the project's server store: {exit_code, stdout, stderr, files, store_version}, plus stage1 for ticket get, next and report context (the client runs Stage 2 on its own worktree) | read |
POST /v1/projects/{project_id}/store:import | Move the store here from the repo (admin): {tar, bundle?, forceClaims?}; checked with tkt doctor while moving, then server | admin |
POST /v1/projects/{project_id}/store:export | Freeze the store for its way back to the repo (admin): moving, and its files as a tar | admin |
POST /v1/projects/{project_id}/store:release | The client has the store (admin): repo; the server copy goes to stores/.archive/ | admin |
POST /v1/projects/{project_id}/llm:complete | Forward {prompt, schema} to the server's LLM; the answer object (an llm grant) | |
POST /v1/projects/{project_id}/llm/cache:lookup | The stored answers of the client's item keys (#179; an llm grant): {cache: on|off, entries: {key: {answer, generatedAt}}} | |
GET /v1/projects/{project_id}/llm/limits | The project's and its tokens' caps, in input + output tokens, and the cache switch (admin) | admin |
PUT /v1/projects/{project_id}/llm/limits | Set the project's caps, or a token's with token; only the fields sent change, null clears one (admin) | admin |
GET /v1/projects/{project_id}/llm/status | Whether the caller's LLM calls can run, without one (#324, any token): the project's switch, the token's llm grant, whether the server has an LLM, its provider and place, why a call would be refused now (quota: its message, else null) and the plan's budget (#334: the plan, granted, the share used per month and day, the resets; never tokens) | read |
GET /v1/projects/{project_id}/llm/usage | The plan's budget as a share used (#334: never tokens), the calls made today and this month (UTC), the cache switch and its hits, and with byToken each token's calls (admin) | admin |
GET /v1/projects/{project_id}/embed | The server's embedding endpoint for this project: {id, model, place} (an llm grant) | |
POST /v1/projects/{project_id}/embed | One vector per text, in order: {id, place, vectors} (an llm grant) | |
POST /v1/projects/{project_id}/ids | Reserve the next number of a counter (write): above the counter and above floor | read |
GET /v1/projects/{project_id}/ids | The last number a counter handed out, taking nothing (read); 0 when none | read |
GET /v1/projects/{project_id}/claims | The live leases, oldest first (read); mine marks the caller's token's | read |
POST /v1/projects/{project_id}/claims/{ulid} | Create a lease (201), or renew or take over one (200); 409 ERR_ALREADY_CLAIMED | read |
PUT /v1/projects/{project_id}/claims/{ulid} | Renew the caller's own lease (write); 404 when it is gone, 409 for another owner | read |
DELETE /v1/projects/{project_id}/claims/{ulid} | Release a lease: its token, from any worktree, or an admin (write); 404 when none | read |
GET /v1/operator/projects | Every project: id, name, created, created by, how (an invite id, open (#145) or operator (#158)), token counts, last use, its AI plan and use (#334: plan {name, default}, ai {enabled, calls, monthCredits}, calls ever), what it takes on the disk (#261: diskBytes, its store with the history, archives, an import being built): never a token | operator |
POST /v1/operator/projects | A project registered by the operator, whatever AITODO_REGISTRATION says (#158): the name rules of POST /v1/projects, its first admin token (as) in the reply, once; listed as created via operator | operator |
DELETE /v1/operator/projects/{project_id} | What tkt server project-delete does: the project and every server row of it, in one transaction | operator |
POST /v1/operator/projects/{project_id}/admin-token | What tkt server admin-token does (recovery): a new admin token, shown once | operator |
POST /v1/operator/invites | A one-time registration code (arc_…), shown once; the server keeps only its hash | operator |
GET /v1/operator/invites | Every invite with its status (open, used, expired, revoked): never a code | operator |
DELETE /v1/operator/invites/{invite_id} | Revoke an unused invite; the row stays (revoked) | operator |
POST /v1/operator/projects/{project_id}/store:unfreeze | A move to the repo left half-done (moving): back to server, the store as it was | operator |
POST /v1/operator/projects/{project_id}/store:release | A move left half-done (moving): finish it to repo; the server copy is archived | operator |
GET /v1/operator/prices | Every model's price: credits per 1M input and per 1M output tokens | operator |
PUT /v1/operator/prices | Set a model's price (new or changed); calls book their credits by it from then on | operator |
GET /v1/operator/plans | Every plan with its values, whether it is the default and how many projects are on it | operator |
POST /v1/operator/plans | A new plan: a name, monthly credits and daily credits (-1 unlimited, 0 none) | operator |
PATCH /v1/operator/plans/{name} | Change a plan's values; its projects spend by them from their next call | operator |
DELETE /v1/operator/plans/{name} | Delete a plan that no project and not the default uses (409 ERR_PLAN_IN_USE) | operator |
PUT /v1/operator/default-plan | Make a plan the default: every project without a plan of its own spends by it | operator |
PUT /v1/operator/projects/{project_id}/plan | Put the project on a plan; null puts it back on the default plan | operator |
GET /v1/feedback/template | The report template: kinds bug and idea, their sections (required, help), the title rule, the sections tkt feedback fills in itself, and the version | |
POST /v1/feedback/cli | Run a reporter's call on the intake store | write |