Skip to content

CLI and API reference

Last updated November 8, 2026

On this page

OrchKernel has two ways in besides the web workspace: the ok command line, and the HTTP API the workspace itself uses. This page lists both in one place. Each line points to the guide page that explains the command or route in full, so use it to find your way, then read the page it names.

The examples use the demo company from the Quickstart: ada the admin, maya the support lead, alice a sales rep, erin the engineering lead, pat the product lead, fiona the founder, and sam, tom and eli. People sign in to the workspace with a password (in the demo, by picking themselves under Demo people); each person's API token, for curl and scripts, is printed when ok demo serve starts and is valid for 7 days.

The examples use 127.0.0.1:8080, the address ok demo serve listens on unless you pass --bind. Change the port if you started it elsewhere.

The command line#

Where a command works#

Most ok commands do not talk to a server. They open the state file (the SQLite file that holds the whole company; the demo's is orchkernel-demo/state.db) directly. A running server keeps the company in memory and holds a lock beside the file (state.db.lock) for as long as it runs, so the command line never writes under it:

Command Works on While the server runs
ok serve, ok demo serve Starts the server, holding the lock A second one exits 75: "Another server is running on ..."
ok backup, ok audit ..., ok doctor Reads the file without writing it Works
Commands that only read: ok actor list, ok agent library, ok playbook show, ok blueprint list, ok pack list, ok catalog list, ok app list, ok app show, ok gateway agent list/show, ok gateway actions, ok gateway work-sessions, ok brain collections/describe/catalog/query/history/flags/recall/quarantine, ok brain totals (without --rebuild), ok search, ok inbox, ok tasks, ok runs, ok replay, ok log, ok threads, ok directory ..., ok schema proposals, ok changes list, ok policy export/diff/explain, ok token list, ok user list, ok user sessions, ok mail show, ok auth settings (no flag), ok connection list, ok context sources A snapshot of the file, never written Work, and see what the server has saved
ok policy ... --server <url>, ok user ... --server, ok mail show/test --server, ok kill ... --server, ok changes ... --server The running server, with your token in OK_TOKEN Work
ok tenant ..., ok operator ... A tenancy root's files, or its operator listener with --server See Hosting several organizations
Everything else (ok init, ok actor add-human, ok token issue, ok kill, ok tick, ok ask, ok secrets rotate, ...) Changes the file, holding the lock until it exits Refused with exit status 75 and nothing written

A refused command says who holds the file and what to do instead:

text
The server is running on orchkernel-demo/state.db (pid 4121, since 09:30 UTC).
Use the workspace or the API (add --server http://127.0.0.1:8080), or stop the server, then run this again.

A command that only reads writes nothing at all, not even the refusals it meets: "note: 1 refusal was not recorded: commands that only read do not write the file".

To change the demo from the command line, work in the folder where you ran ok demo (the one that holds orchkernel-demo):

  1. Stop ok demo serve with Ctrl+C. The server writes the file after every change, so nothing is lost.
  2. Run the command with the demo's state file and the person you act as: ok --state orchkernel-demo/state.db --as ada kill actor:eli. You should see "actor:eli engaged".
  3. Start the demo again with ok demo serve. It prints new API tokens and revokes the ones it printed last time. Tokens you issued yourself keep working.

Reading needs no stop: ok --state orchkernel-demo/state.db --as maya brain query tickets works while the demo runs and shows its five support tickets as JSON, the first one T-1042, "Refund for a double charge on the September invoice".

Global flags#

Every command takes these, except -V, which only ok itself takes.

Flag Environment variable Default What it does
--state <path> OK_STATE ./.orchkernel/state.db The state file. ok demo ignores it and uses <dir>/state.db.
--as <id> OK_AS your login name ($USER) The person or agent you act as. Every check is made for this actor.
--tenant <name> OK_TENANT none Act on one tenant of a tenancy root. With --server, sent as the x-ok-tenant header.
--tenants-dir <dir> OK_TENANTS_DIR none The tenancy root.
--dev-echo-tools OK_DEV_ECHO_TOOLS off Answer every tool call with an echo and ignore mcp.yaml. Development only.
--no-lock off Break glass: change the state without the lock, only where the file system refuses locks. Refused while a live process holds the lock. See Operations.
-h, --help Help for any command or subcommand: ok brain query --help.
-V, --version Prints the version (ok 0.1.0).

Two things catch people out:

  • Without --state, a command that changes the state in a folder with no .orchkernel/state.db creates a new, empty company there and works on that. A command that only reads refuses instead: "no state at .orchkernel/state.db; run ok init first, or set OK_STATE".
  • An --as that names nobody is refused by commands that check what you may do, such as ok brain query and ok kill ("Error: unknown actor nobody"). Others do not check: ok inbox, ok tasks and ok threads print nothing and succeed, and ok log prints the log. Without --as, the command acts as your computer login name, which the demo does not know either.

Environment variables#

The settings a server reads are listed in full in Operations. These are the ones the command line itself reads.

Variable Used by What it does
OK_STATE, OK_AS, OK_TENANT, OK_TENANTS_DIR, OK_DEV_ECHO_TOOLS Every command As the global flags above.
OK_SERVER ok policy, ok user, ok mail The server URL, instead of --server. It must be https, or http to a loopback address such as 127.0.0.1.
OK_TOKEN ok policy, ok user and ok mail with a server Your API token. It is never taken on the command line.
OK_OPERATOR_TOKEN ok tenant and ok operator with --server An operator token.
OK_BIND ok serve Where it listens. ok demo serve ignores it and takes --bind.
OK_SECRETS_KEY Every command that opens a state file, the server The key that seals connection secrets, two-step seeds, the SMTP password and model keys. When unset, the one in secrets.key beside the state file, which ok init, the first ok serve and ok demo create. See Production hardening.
OK_SECRETS_FILE As OK_SECRETS_KEY Another path for the key file.
OK_WEBHOOK_SECRET ok serve The shared webhook secret; when unset, the one in secrets.key.
OK_SQLITE_SYNC Every command that changes a state file, the server normal (default) or full. See Operations.
OK_PUBLIC_URL ok init, ok user, the server The https address people open; sign-in links point there. See Production hardening.
OK_SMTP_HOST, OK_SMTP_PORT, OK_SMTP_SECURITY, OK_SMTP_USERNAME, OK_SMTP_PASSWORD, OK_SMTP_FROM, OK_SMTP_FROM_NAME The server The mail server used when the company has no email settings of its own. See Setting up a company.
OK_PASSWORD_DENYLIST The server A file of further passwords to refuse, one per line.
OK_DEV_AUTH ok connection, the server Lets connections use plain http to a loopback address. Development only.
ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY or GOOGLE_API_KEY, OLLAMA_HOST, OK_LLM_CONFIG ok ask, ok doctor, the server Model providers. See Models.
OK_LLM_CHECK ok serve, ok demo serve 0 skips the key check at start.

Commands#

One line per command; run it with --help for its flags. The last column is the page that explains it.

Getting started and running

Command What it does Page
ok demo [--dir D] [--force] Creates the demo company in ./orchkernel-demo Quickstart
ok demo serve [--dir D] [--bind A] [--dev-auth] Starts the demo's local fakes and server with the Demo people picker, and prints an API token per person Quickstart
ok init [--admin id] [--email a] [--name n] [--blueprint b] Creates a state file and its first admin, optionally a whole company; prints the admin's setup link Company setup
ok serve Runs the API and the web workspace; --domain or --tls-cert/--tls-key for HTTPS Install, Production hardening
ok backup <path> A plain copy of the state file alone, safe while the server runs; the copy is 0600 Operations
ok backups list|run|verify|prune|recovery-key|decrypt Encrypted backups: list, back up now, check one, prune, make a recovery key, open one without restoring Operations
ok restore <file or id> [--identity F] [--yes] [--confirm NAME] [--replace-config] Restores a backup with the server stopped, or onto an empty folder Operations
ok embed fetch --dir DIR Downloads the search-by-meaning model for offline use Operations
ok doctor [--fix-permissions] Checks the build, the state file, its lock, private files, the secrets and each model key; exits 1 on an error, such as no model ("error Agents cannot run until a model is connected: an admin connects one in the workspace (Models in the sidebar), ...") Operations
ok schemas Prints the JSON Schema of every definition type (agents, skills, packs) Packs and skills

Company, people and tokens

Command What it does Page
ok blueprint list, ok blueprint install <id or file> Lists and installs blueprints Company setup
ok actor list Everyone in the directory Company setup
ok actor add-human <id> --role <r>, ok actor add-team <team:id> Adds a person or a team Company setup
ok actor offboard <id> Offboards a person or agent Company setup
ok actor hire <file>, ok actor trust <id> <tier> Hires an agent from YAML; sets its trust tier Agents
ok directory find [--skills a,b] [--humans], ok directory cards Who can do something; every agent's card Company setup, Agents
ok user list, invite, edit, sign-in-link, reset-password, reset-two-step, unlock, deactivate, reactivate, offboard, sessions, sign-out People and their sign-in, as on the people panel Company setup
ok mail show, ok mail set, ok mail test, ok mail clear The company's email settings (the password from an environment variable only) Company setup
ok auth settings [--require-two-step] [--session-days] ... The sign-in settings Production hardening
ok token issue --for <id> [--ttl] [--label] [--scope] Issues an API token on the state file, printed once; valid 30 days unless --ttl says otherwise (7d). Tokens are for the API only Company setup
ok token list, ok token revoke, ok token scope Lists, revokes or narrows tokens Company setup

Agents and work

Command What it does Page
ok ask --agent <id> "<text>" [--plan file] Asks an agent in your own conversation. Needs a model or --plan: the demo's stub planner answers only in the workspace, so without a model key the run fails with "no model provider is configured" Asking agents
ok ask --agent <a> --agent <b> "<text>" [--each] [--combine id] [--ask-whom id] [--wait 4h] [--limit 5.00] [--from d --to d] [--no-wait] [--verbose] Asks several agents together and waits for the answer; exits 0 when every agent answered, 3 when some did, 1 when none did Asking several agents together
ok ask --lead <a> --agent <b> --agent <c> "<text>" One leads: asks <a>, which may ask the other agents named, and prints its answer One leads
ok group <id> An ask to several agents: its state, each agent's and its note Asking several agents together
ok repeats [list --all], ok repeats pause|resume|run|delete <id> Your repeats; pause, resume, run now or delete one (delete --stop also stops the run in progress) Repeats
ok tasks [--archived], ok runs [--archived] Tasks and runs, live or archived Asking agents
ok tick [--now t] Advances the clock once: triggers, SLAs, stalls, pending runs Asking agents
ok webhook <source> [--payload json] Delivers an event to webhook triggers, unsigned Apps
ok inbox [--all] Your inbox Inbox and approvals
ok approve <id> [--reject] [--note] Decides an approval Inbox and approvals
ok answer <run> "<text>" Answers the question a run waits on Inbox and approvals
ok threads [--show id] Lists threads, or one thread's transcript Threads
ok agent library, ok agent fork <id> --slug <s> Every agent the company can have; a fork (a copy working for nobody, made off) Agents
ok template list [--app a], ok template show <app>/<agent> [--version n] An app's agent templates Templates and copies
ok copy make, list, show, set, update, pause, resume, archive, restore, history Copies of templates: make one, change its settings, take or leave a template update Templates and copies
ok permission list, grant manage-agents --to <id> | --role <r> --teams a,b | --company, approve <id>, revoke <id> The manage agents permission Manage agents
ok playbook show <id> An agent's or skill's playbook Agents
ok playbook propose <id> <file> --reason <r> Proposes a playbook change Changes and evals
ok changes list, review, canary, promote (--server <url> for a running server) The change pipeline Changes and evals
ok delegate --to <id> [--scope] [--authority] [--budget-cents] [--tools] Delegates authority to someone Delegations

Data

Command What it does Page
ok brain collections, describe <c>, catalog <phrase> Collections, one collection's fields, collections matching a phrase The brain
ok brain query <c>, upsert <c> --fields json, history, rollback, flag, flags Records and their versions The brain
ok brain recall [topics], quarantine, accept <id>, reject-knowledge <id> Knowledge entries Knowledge and decisions
ok schema proposals, apply <id>, reject <id>, steward Schema proposals The brain
ok search "<text>" [--collections] [--kinds] [--limit] Keyword search over what you may read The brain
ok context sources, run, optin, optout, forget Context capture Context capture

Governance and audit

Command What it does Page
ok policy export, check, diff, apply, source Policy as code Policy
ok policy explain [op] [target] --actor <id> What the gate would decide, step by step How the gate decides
ok kill <scope> [--off] [--server <url>] Engages or releases a kill switch: global, actor:<id>, tool:<id>, team:<id>; with --server, on a running server as the holder of OK_TOKEN Policy
ok log [--type t] [--limit n] The newest events of the whole log Events and audit
ok replay --run <id> (or --task, --thread) One run, task or thread from the log Events and audit
ok audit verify, head, checkpoints Checks the tamper-evident chain Events and audit

Apps, connections and outside agents

Command What it does Page
ok catalog list, upload <file>, retire <id> The apps catalog Apps
ok app list, show, enable, set, pause, resume, reconcile, adopt, update Enabled apps; update <app> [--to n] shows the update card or updates (ok module, the name before the rename, still works) Apps
ok pack list, ok pack install <dir> Packs installed directly Packs and skills
ok connection add, update, set-secret, list, test, remove Connections to outside systems Connections
ok secrets rotate [--new-key-env V] Re-seals every stored secret under a new key, server stopped. With secrets.key, the new key replaces it and the old one is kept as secrets.key.<key id> Production hardening
ok gateway agent add, list, show, set Registers and changes outside agents Outside agents
ok gateway token issue <agent> Issues an outside agent's token Outside agents
ok gateway actions --agent, work-sessions --agent An outside agent's actions and work sessions Outside agents
ok gateway callback rotate, test An outside agent's signed callbacks Outside agents

Several organizations on one host

Command What it does Page
ok tenant create, adopt, list, show, set Tenants of a tenancy root Hosting several organizations
ok tenant suspend, resume, delete, undelete A tenant's lifecycle Hosting several organizations
ok tenant admin-token, rotate-key Break-glass token; the tenant's secrets key Hosting several organizations
ok tenant backup, backups, restore, upgrade, check, registry rebuild Backups, upgrades and health Hosting several organizations
ok operator token issue, list, revoke; ok operator rotate-key Operator tokens and key Hosting several organizations

The HTTP API#

This part is for people writing scripts or tools against a running server. Everything the web workspace does, it does through this API.

Base path#

Every route is under /api on the server's own address, for example http://127.0.0.1:8080/api/me. Two exceptions sit at the root: the MCP endpoint POST /mcp for outside agents, and the operator API on its own listener when the server hosts several organizations. Any other path that is not under /api serves the web workspace. An /api path no route serves answers 404 not_found, "no such API route".

Bodies are JSON and need content-type: application/json (a file upload, POST /api/files, sends the raw bytes instead). GET /api/health needs no token and answers { "ok": true, "dev_auth": false, "password_sign_in": true }.

Tokens#

The web workspace signs people in with a password (and two-step sign-in when it is on) and keeps them signed in with a session cookie. Scripts send a token in every request: Authorization: Bearer <token>. Tokens are for the API only: no route turns a token into a workspace session, and the routes that change a person's own sign-in (password, two-step, sessions, issuing a token) answer a token with 403 session_required. So do the settings that act like credentials: granting or revoking manage agents, connecting a channel to the inbox assistant (and its Slack sign-in), every /me/inbox-assistant route, and a person's download of their own agent's data. Several of these also need a sign-in within the last ten minutes.

Token Looks like Reaches
A person's token orchk_... Every /api route but the session-only ones, with that person's rights
A scoped token orchk_..., issued with scopes Only the routes its scopes allow (below)
An outside agent's token orchk_ag_... Only the agent-facing gateway routes and /mcp. Anywhere else: 403 agent_token_scope
An operator token orchk_op_... Only the operator API. A tenant's token is 401 there

To get a token for a script from the workspace (alice, in the demo):

  1. Sign in as Alice and open your profile: choose your name, Alice Chen, at the bottom of the sidebar. On a phone, open the menu (the button at the top left) first. The page is titled Profile.
  2. Under API tokens, choose New token. It needs a sign-in in the last ten minutes; Confirm it is you asks otherwise.
  3. Type a Label ("Report script"), pick how long it is valid (up to your company's longest, 90 days by default) and, if you like, limit it to Read, Policy or Changes (below), then issue it. Your new token shows it once, under "Copy it now: it is shown once. It expires ..." with a Copy button.
  4. The token now has its own row under API tokens, with its label, its dates and Revoke.
  5. Try it: curl -s -H "Authorization: Bearer $TOKEN" http://127.0.0.1:8080/api/me returns Alice's directory entry with "admin": false.

Everyone issues their own tokens; nobody issues a person's token for them (403 own_tokens_only), and an admin sees and revokes them in a person's drawer on People. Tokens are valid 30 days unless you choose otherwise; the server keeps only a hash, so a lost token cannot be shown again. A deactivated person's tokens stop working until they are reactivated. The full table of ways to issue and revoke is in Operations.

Scopes. A token can be limited to some routes: tick Read, Policy or Changes when you issue it on your profile, or use POST /api/tokens with "scopes", or ok token issue --scope with the server stopped. A scope can later be narrowed but never widened. On the profile page a scoped token's row says "limited to Read" (or the scopes it has); an unscoped one says "can do what its holder can".

Scope Reaches
read Every GET route, as the holder sees it. Not POST reads such as a collection query.
changes POST /changes, and the holder's own proposals: GET /changes, GET /changes/:id/diff, POST /changes/:id/reject.
policy POST /policy/check, POST /policy/diff, POST /policy/proposals, GET /policy/applied, and the holder's own proposals as above. Not /policy/explain.
none Everything the holder may do.

No scope reaches the audit routes. A route outside a token's scopes answers 403 token_scope, "this token's scopes do not reach /brain/collections/:name/query".

Failed tokens. A missing or bad token is 401. From the 61st failed credential in a minute, the address gets 429 rate_limited, "too many failed authentications from this address", with a Retry-After header for the rest of the minute. A valid token from the same address still works, and a request with no token at all is not counted and still gets 401.

Errors and status codes#

An error is JSON with a short code and a sentence:

json
{ "error": "denied", "message": "brain: access denied: ada may not read tickets" }

Some errors add a field: problems (a list of what is wrong) on 422 invalid, approval (its id) on 202 needs_approval, and evals (the case names) on evals_failing and evals_not_run.

Status Codes When
200 Done.
202 needs_approval The action waits for a person. Body: { "error": "needs_approval", "approval": "<id>", ... }. Erin offboarding Eli gets this. Webhook deliveries and loop runs also answer 202, with their own bodies.
400 bad_request A bad query value, such as a cursor the server did not issue ("invalid cursor").
401 unauthorized "missing bearer token", "invalid token", "not a bearer token", or a webhook without a valid signature.
403 denied, not_approver, token_scope, agent_token_scope, not_external_agent, not_owner, ... The policy or a rule refuses you.
404 not_found It does not exist, or you may not see it. The two read the same: "thread nope not found", "unknown actor ghost".
409 conflict and named codes (evals_failing, last_approver, module_paused, ...) The thing is in the wrong state for this.
422 invalid and named codes The request is well formed but not acceptable, such as GET /api/traces?since=yesterday: "since "yesterday" is neither an RFC 3339 time nor a YYYY-MM-DD date".
429 rate_limited Too many failed credentials, or a rate limit in the policy.
503 audit_unavailable and others The server cannot do it now.

Not every error has this shape. A body that is not JSON (400), a JSON body missing a required field (422), a missing content-type (415) and a wrong method (405) answer in plain text or with an empty body, for example "Failed to deserialize the JSON body into the target type: missing field goal". See Known problems.

The named codes each route can return are listed in the For developers section of the page that covers it.

Paging#

Long lists come a page at a time. Ask with ?limit= (default 200, at most 1000). When there is more, the answer carries an x-next-cursor header; send its value back as ?cursor= for the next page. The last page has no header.

  1. curl -si -H "Authorization: Bearer $ADA" "http://127.0.0.1:8080/api/delegations?limit=2" returns two delegations and an x-next-cursor: MDky... header.
  2. Repeat with &cursor=MDky.... You get the next two, and a new cursor.
  3. Stop when a page comes back without the header.

A cursor stays valid when items are added or removed in between, with no repeats. Paged lists: /threads, /inbox, /approvals, /tasks, /runs, /traces, /knowledge, /decisions, /changes, /delegations, /views, /apps, /catalog, /connections and the gateway's action lists. /traces has its own limit (default 50, at most 200).

GET /events is not paged this way. It takes since (an event number) and limit, and without either returns the newest 200 events with last_seq, the newest event number in the log. The workspace polls /events?since=<last_seq> every two seconds.

Reads of a collection kept in another system can stop early (at 5,000 rows or after 60 seconds). The answer then carries x-ok-partial: true and names the vendor's adapter in x-ok-partial-from. When the other system limits requests or does not answer, the read fails at once with 429 rate_limited or 503 vendor_unavailable (or vendor_busy, every call to it in flight), with retry_after in the body and a Retry-After header. GET /traces also sends x-ok-partial: true when it cut the archived runs short. The demo has no collection kept in another system, so this was not tried there. See Connections.

The live event stream#

GET /api/events/stream sends new events as server-sent events as they are written, only those you may see. Each message has the event number as id, the event type as event, and the event as JSON in data:

id: 422
event: knowledge_proposed
data: {"seq":422,"actor":"maya","event":{"type":"knowledge_proposed",...}}
  • It starts at the newest event. Add since=<n> to start after event n.
  • It takes the same filters as GET /events: type (comma-separated), run, thread, task, actor.
  • A browser's EventSource cannot set headers, so this route alone also accepts the token as ?token=. On any other route a token in the address is ignored and the request gets 401. The workspace's own stream uses its session cookie.
  • The stream ends when what opened it ends: the session signed out or ended, the token revoked or expired, or the person deactivated.

To watch Maya's new knowledge entries: curl -N "http://127.0.0.1:8080/api/events/stream?token=$MAYA&type=knowledge_proposed", then add an entry as Maya. It arrives within a second.

When a connection drops, reconnect with since= set to the last id you received. The Last-Event-ID header a browser sends on reconnect is ignored, so events written while you were away are missed unless you pass since.

Route map#

All paths below are under /api. Each area's page has the bodies, answers and error codes in its For developers section.

Area Routes Page
You and the company GET /me, GET/PUT /company (with the time zone), GET /health Company setup, Workspace tour
Sign-in GET /auth/config, POST /auth/sign-in, /two-step, /demo, /forgot, /link, /link/complete, /confirm-email, GET /auth/session, POST /auth/sign-out, /reauth Operations
Your own sign-in GET /me/sessions, DELETE /me/sessions/:id, POST /me/sessions/sign-out-others, PUT /me/password, POST /me/email, PUT /me/name, POST /me/two-step/start, /confirm, /recovery-codes, DELETE /me/two-step Workspace tour
The people panel GET /people, POST /people/invites, /people/invites/:id/resend, DELETE /people/invites/:id, PATCH /people/:id, POST /people/:id/deactivate, /reactivate, /offboard, GET /people/:id/offboard-preview, POST /people/:id/sign-in-link, /unlock, DELETE /people/:id/two-step, GET/DELETE /people/:id/sessions, GET /people/:id/tokens, POST /people/legacy-tokens/revoke Company setup
Sign-in and email settings GET/PUT /settings/sign-in, GET/PUT/DELETE /settings/mail, POST /settings/mail/test Company setup
People and agents GET/POST /actors, GET /actors/:id, POST /actors/:id/offboard, POST /actors/:id/trust, GET /directory/find, GET /directory/cards Company setup, Agents
Blueprints GET/POST /blueprints Company setup
Tokens GET/POST /tokens, DELETE /tokens/:actor, DELETE/PATCH /tokens/id/:id Company setup
Asking and work GET /me/agents, GET /me/spend, GET /me/assignable, POST /ask, POST /models/help, POST /models/help/:id/keep, GET/POST /tasks, GET /tasks/:id, POST /tasks/:id/assign, /run, /complete, /refs, GET /runs, GET /runs/:id, POST /runs/:id/stop, /answer, /feedback, /retry, GET /traces Asking agents
Asks to several agents GET /groups/:id, POST /groups/:id/stop, /combine, /retry, /members, /members/:agent/retry, /members/:agent/use, GET /threads/:id/audience, GET /periods/resolve Asking several agents together
Repeats POST /threads/:id/repeats, GET/POST /repeats, GET /repeats/suggestions, GET/PATCH/DELETE /repeats/:id, GET /repeats/:id/runs, POST /repeats/:id/pause, /resume, /run-now, /give, GET /schedules/preview, GET/PUT /settings/asks Repeats
Threads GET/POST /threads, GET /threads/:id, GET /threads/:id/runs, POST /threads/:id/messages, /ask, /artifacts, /decide, /close, /participants, /pin, /read, POST /threads/:id/messages/:message/refs, /decisions/:decision/refs, DELETE /threads/:id/pin, DELETE /threads/:id/participants/:actor, GET /thread-templates, PUT /artifacts/:id Threads
Files POST /files, GET /files/limits, GET/PATCH/DELETE /files/:id, GET /files/:id/content, /preview/thumb, /preview/view, /text, GET /threads/:id/files, PUT /threads/:id/data-class, GET /brain/collections/:name/records/:id/files, GET/PUT /settings/files Files
Inbox and approvals GET /inbox, POST /inbox/:id/read, GET /approvals, GET/POST /approvals/:id, GET /approvals/:id/explain, GET /questions, GET /questions/:id, POST /questions/:id/answer, /forward Inbox and approvals
Agents and playbooks GET /library/agents, POST /library/agents/:id/fork, GET /agents/:id/playbook, POST /agents/:id/playbook/propose, /convert, GET /agents/:id/scorecard Agents
Templates and copies GET /templates, GET /templates/:pack/:agent, POST /templates/:pack/:agent/required, /required/pause, /pause-all, /resume-all, GET/POST /copies, POST /copies/updates, GET/PATCH /copies/:id, POST /copies/:id/changes, GET/POST /copies/:id/update, POST /copies/:id/update/leave, /pause, /resume, /archive, /restore, /accept, GET /copies/:id/history, POST /copies/:id/history/restore, GET/POST /copies/:id/parent-update, POST /copies/:id/parent-update/leave, POST /me/copies/:id, GET /me/copies/:id/export, GET/POST /apps/:pack/update Templates and copies
Manage agents and requests GET/POST /permissions, DELETE /permissions/:id, POST /permissions/:id/approve, /full, GET /permissions/roles, /lead-offers, GET/PUT /permissions/personal-templates, GET /me/permissions, GET/POST /me/agent-requests, POST /me/agent-requests/check, DELETE /me/agent-requests/:id, POST /agent-requests/:id/decide, GET /people/search Manage agents, Your own agents
Team schedules and your time GET/POST /copies/:id/schedules, PUT/DELETE /schedules/:id, POST /schedules/:id/pause, /resume, /run-now, /me, /ask-time-zones, GET /schedules/:id/days, PUT /me/time-zone, PUT /me/leave, PUT /company/scheduling Team schedules
The inbox assistant /me/inbox-assistant... (the person's own, signed in), GET/POST /me/channels, DELETE /me/channels/:id, POST /me/channels/:id/on, /off, GET /channels, POST /channels/:id/off, GET /connections/oauth/:provider/start, /callback, /channels/whatsapp/:connection/..., GET/PUT /settings/inbox, /inbox-assistants/... (admins), POST /data/erase/preview then POST /data/erase (the one erase form; POST /governance/erase answers 410 moved) The inbox assistant, Your own agents
Changes GET/POST /changes, POST /changes/:id/review, /evals, /canary, /promote, /reject, GET /changes/:id/diff Changes and evals
The brain /brain/collections... (query, aggregate, records, history, rollback, flag, semantics, reassign), GET /brain/records/:id, GET /brain/catalog, GET /brain/flags, GET /refs/:collection/:id, GET /search, GET /search/index-status, /schema/proposals..., POST /schema/steward, GET /views, GET /views/:id, POST /views/preview The brain
Knowledge and decisions GET/POST /knowledge, GET /knowledge/quarantine, POST /knowledge/:id/accept, /reject, GET /decisions Knowledge and decisions
Context capture /context/sources..., /context/optins..., /context/identities/:actor, POST /context/forget, GET /context/inbox, GET /context/functions, /context/flags..., GET /context/curation, POST /context/items/:id/curate, GET /context/items/:id/links Context capture
Delegations GET/POST /delegations, DELETE /delegations/:id Delegations
Policy GET /policy, GET /policy/export, POST /policy/check, /diff, /proposals, GET /policy/applied, /drift, PUT /policy/source, POST /kill Policy
The gate POST /policy/explain, GET /approvals/:id/explain How the gate decides
Events and audit GET /events, GET /events/stream, GET /audit/head, GET /audit/checkpoints, POST /audit/verify Events and audit
Models GET /models, GET /models/status, POST /models/test, PUT/DELETE /models/providers/:name, PUT /models/providers/:name/models/:model/clearance, PUT /models/default, PUT /models/search, GET /llm/models Models
The first-run wizard GET /setup, POST /setup/steps/:id, /setup/finish, /setup/reopen Company setup
Backups GET /backups, GET /backups/status, GET/PUT /backups/settings, POST /backups/settings/test, /backups/recovery-key, /backups/run, /backups/:id/stage, /backups/restore, DELETE /backups/staged, DELETE /backups/:id Operations
Apps GET /catalog, POST /catalog/uploads, /drafts, DELETE /catalog/:id, /catalog/proposals/:id/..., GET /apps, /apps/:pack... (defaults, enable, pause, resume, reconcile, adopt, webhook secrets; the same routes answer at /modules..., their name before the rename, with the same bodies and codes), POST /tick, POST /webhooks/:source Apps
Connections GET/POST /connections, PUT/DELETE /connections/:id, POST /connections/:id/test, GET /adapters, POST /webhooks/connections/:id Connections
Packs and skills GET/POST /packs, GET /skills, GET /tools, GET /schemas Packs and skills
Outside agents /gateway/agents... (admin), POST/GET /actions, GET /actions/:id, POST /actions/:id/cancel, /gateway/work-sessions..., GET /gateway/tools, and POST /mcp at the root Outside agents
Several organizations x-ok-tenant header or tenant subdomain; operator API under /operator/... on the operator listener Hosting several organizations

POST /tick is for admins only; anyone else gets 403 "policy denied tick: admins only". POST /webhooks/:source takes a signature instead of a token (see Operations); without a secret configured for the source it answers 401 "no webhook secret is configured for this source".

Known problems#

Found while writing this page; reported for fixing.

  • A forgotten --state makes a new company. In a folder without .orchkernel/state.db, a command that changes the state quietly creates an empty one (one that only reads refuses).
  • An unknown --as is not always caught. ok inbox, ok tasks and ok threads print nothing and exit 0, and an empty inbox or thread list prints nothing either, so the two look alike. ok log prints the whole log for an actor that does not exist.
  • Some framework errors are not JSON. Malformed JSON, a missing field, a missing content-type and a wrong method answer in plain text or empty, not with error and message.
  • Last-Event-ID is ignored on the event stream; pass since when you reconnect.
  • Token kind has two shapes. POST /tokens answers "kind": "api"; GET /tokens lists "kind": {"type": "api"}.
  • Help text. Many subcommands (ok runs, ok actor list, every ok brain subcommand, ok directory, ok schema, ok changes) show no description in --help, and some help lines cite internal design sections such as "(T§5)", "(SC§5.7)" or "(PC§7)".
  • A demo that cannot start still prints tokens. When the port is taken, ok demo serve prints the tokens and "OrchKernel serving on ..." before it fails with "Address already in use", and the tokens it printed do not work against whatever holds the port.

Not possible yet#

  • Running the state-file commands against a server: only ok policy, ok user, ok mail, ok tenant and ok operator take --server.
  • Resuming the event stream from Last-Event-ID.
  • A published OpenAPI description of the API. GET /api/schemas describes definitions (agents, skills, packs), not routes.