API reference
The engine's HTTP API. On the hosted service the base address is https://app.trycountersign.ai. An engine you run yourself serves the same routes at its own address.
Every route in this page is defined in server/http.go.
The same routes are described for tools in an OpenAPI 3.1 file. The engine serves it at /openapi.yaml, and its source is server/openapi.yaml. A test fails when a route the engine registers is missing from the file, or the file names a route that is gone. The request and response shapes in it are written by hand and are not tested, so where the file and the engine disagree, the engine is right. The file also lists the single sign-on routes under /v1/sso/, which this page does not describe.
Conventions
- Request and response bodies are JSON, except
GET /v1/export, which returns CBOR. - Keys, hashes and signatures are lower-case hex text.
- Times are Unix seconds.
- Money amounts are whole numbers in minor units.
- A request body may be at most 1 MB, and less on some routes: 64 KB for an ask, 8 KB for an outcome, 64 KB for an enrolment and 96 KB for a published receipt. A larger body gets status 413. A field the route does not know is an error.
- Every response carries a
Countersign-Latestheader with the engine's build. The command-line tool sends its own build in aCountersign-CLIheader. See Updating. - An error has an HTTP status other than 200 and the body
{"error": "..."}. - A caller over a rate limit gets status 429 with a
Retry-Afterheader.
Authentication
| Label in this page | What the request must carry |
|---|---|
| None | Nothing. |
| Bearer | Authorization: Bearer <credential>. The credential is the workspace's API key (it starts with cs_) or a console session token (it starts with ss_). |
| Bearer + owner signature | As Bearer, and the body carries a signature made with the owner's signing key. The engine checks it against the owner key recorded in the workspace's first ledger entry. |
| Agent signature | No Authorization header. The body carries a signature made with the agent's key, checked against the passport. |
| Enrolment signature | No Authorization header. The body carries a signature made with a fleet rollout's enrolment key. |
The API key alone cannot issue a passport, change policy, create a rollout or approve an action. Those routes need the owner's signature as well. See Security and limits for what the API key can do by itself.
From build 2026.11.29.2 the API key alone also cannot change what is paid for or delete the workspace. Four routes need the owner in person: POST /v1/billing/plan, POST /v1/billing/packs, POST /v1/billing/portal and POST /v1/workspace/delete. A console session of the owner is enough. A request made with the API key must carry the owner's signature in two headers:
| Header | Value |
|---|---|
Countersign-Signed-At | The time the request was signed, in seconds since 1970. It must be within five minutes of the engine's clock. |
Countersign-Owner-Sig | An Ed25519 signature by the workspace owner's signing key, in hex, under the tag countersign.owner-request.v1, over four fields: the workspace id, the method and path with one space between them (for example POST /v1/billing/packs), the time as written in the other header, and the SHA-256 of the request body exactly as sent. |
Each signature is taken once. Without the headers the answer is 403. countersign plan and countersign workspace delete build the signature for you.
Service
| Method | Route | Auth | Purpose |
|---|---|---|---|
GET | /healthz | None | Reports that the process is up. |
GET | /readyz | None | Reports that the database answers. Status 503 when it does not. |
GET | /v1/info | None | Returns the service name, the signer kind (software), the pack format, what this engine can check against the Agent Name Service, cli_build (the engine's build, which is the newest command-line build it hands out) and cli_min (the oldest build it still serves, empty for any). |
GET | /v1/public-mail | None | Returns domains: the mail providers anyone can get an address at. The sign-up page uses it to tell a work address from a personal one. Nobody is refused for their address. |
Workspaces and accounts
| Method | Route | Auth | Purpose |
|---|---|---|---|
POST | /v1/signup | None | Creates a workspace with no console account. Body: name, email (may be empty), principal_pub. Returns tenant, api_key, decision_pub, signer. The API key is shown once. Used by countersign start and countersign init. When the engine sends customer email and email is given, the address is mailed a link to confirm it. |
POST | /v1/workspace/email | Bearer (API key) | Sets the address of a workspace that has no console account, and mails it a link to confirm it. Body: email. Returns ok and mailed. 409 when the workspace has an owner's account. Used by countersign email. |
POST | /v1/register | None | Creates a workspace with a console account. Body: workspace, name, email, auth, key_blob, principal_pub, and optionally recover_auth and recover_blob. Returns the account and a session. Used by the console's sign-up. The answer has the same shape whether or not the address is already in use. confirmed says whether the account's address is confirmed, and mail whether this engine sends customer email. |
POST | /v1/confirm | None | Confirms an address with the code from a mailed link. Body: code. Returns email and workspace. A code works once, for 24 hours. 404 when it has expired or been used. |
POST | /v1/login | None | Signs in. Body: email, auth. Returns the account, a session and the encrypted signing key (key_blob). |
POST | /v1/logout | Bearer (session) | Ends the session. |
POST | /v1/account/key | Bearer (session of an account) | Returns the account's encrypted signing key again, on proof of the password. Body: auth. |
POST | /v1/account/recovery | Bearer (session of an account) | Creates or replaces the recovery code's stored copy, on proof of the password. Body: auth, recover_auth, recover_blob. |
GET | /v1/account/passkeys | Bearer (session of an account) | Lists the account's passkeys: cred_id, name, created and blob, the copy of the signing key that passkey opens. |
POST | /v1/account/passkeys | Bearer (session of an account) | Stores a passkey's copy of the signing key. Body: cred_id (hex), name, blob (hex). At most 10 for an account. |
POST | /v1/account/passkeys/remove | Bearer (session of an account) | Removes one. Body: cred_id. |
GET | /v1/account | Bearer (session of an account) | The signed-in person's own account: email, mail (this engine sends customer email), confirmed, workspace_confirmed, lost_address (another account confirmed the address this one was made with), address_held (a confirmed account has the address, so this one cannot confirm it), terms_changed, terms (the version in force), has_password, has_recovery, role, status, and prefs with approval and usage. |
POST | /v1/account/confirm/send | Bearer (session of an account) | Mails a new confirmation link. At most 3 an hour for an account. |
POST | /v1/account/ack | Bearer (session of an account) | Records that the person has seen a notice. Body: what, either terms (accepts the version in force) or lost. |
POST | /v1/account/recovery-kit | Bearer (session of an account) | Records that the person saved their recovery kit. Body: how, one of download, copy or paper. Returns recovery_saved_at. The code is never sent. Storing a new recovery code sets it back to not saved. GET /v1/account returns recovery_saved_at (0 when not saved) and created. |
GET | /v1/setup | Bearer (session) | The first-run answers. workspace: for (me, team, company or skipped), size, agent_types. me: skipped (first jobs put aside), verified, seen, kit_check, agent. |
PUT | /v1/setup | Bearer (session of an account) | Stores the parts given, workspace or me or both, each as a whole. The workspace's answers need the owner or an admin. Returns the same as GET /v1/setup. |
POST | /v1/onboarding/choice | Bearer (session) | Counts one choice made in first-run setup, the first time a workspace makes it. Body: choice (door or tab) and door (self, handoff, test) or tab (command, prompt). |
POST | /v1/handoffs/preview | Bearer (session of the owner) | Returns to, subject and text: the email that POST /v1/handoffs would send, word for word. Sends nothing. Same body. |
POST | /v1/handoffs | Bearer (session of the owner) | Emails a one-use setup command to someone. Body: enrollment (the setup command's id), to, name, note (up to 400 characters), agent and token (the one-use token the browser made for that command). The owner's own address must be confirmed. The token must be the one for that command on this service, and the command must still be open. Counts toward the 50 people a workspace can email in a day. The token is kept in the queue until the email has gone and stored nowhere else. One reminder, without the command, follows a day later if it has not been run. |
GET | /v1/handoffs | Bearer (session of the owner or an admin) | Lists the commands that were emailed: id, enrollment, to, sent, reminded, cancelled. Revoking the command (POST /v1/enrollments/{id}/revoke) cancels the reminder. |
POST | /v1/mail/off | None | Turns the setting-up email off for the account a link in such an email was made for. Body: code, from the link. Returns email. It can do nothing else. |
POST | /v1/account/mail | Bearer (session of an account) | Sets which optional email the person gets. Body: approval, usage (both true or false). |
POST | /v1/account/password | Bearer (session of an account) | Changes the password, on proof of the current one, and ends every other session of the account. Body: auth, new_auth, key_blob (the signing key encrypted under the new password). |
GET | /v1/sessions | Bearer (session of an account) | Lists the account's sessions: id, kind, agent (the kind of browser), created, seen (right to the hour) and current. The owner also sees sessions opened with countersign open, with kind link. |
POST | /v1/sessions/end | Bearer (session of an account) | Ends sessions. Body: id for one, or others: true for every session but the caller's. Returns ended, a count. |
POST | /v1/recover/start | None | Returns the recovery copy of the signing key to a caller who proves they hold the recovery code. Body: email, recover_auth. Returns recover_blob. |
POST | /v1/recover/finish | None | Sets a new password after recovery, ends every other session and signs in. Body: email, recover_auth, auth, key_blob. |
POST | /v1/release/info | None | What a mailed release link would do, without doing it. Body: code. Returns email, workspace, owner (the account owns the workspace) and cancelled. |
POST | /v1/release | None | Releases an address from an account whose password and recovery code are lost: removes the account, ends its sessions and cancels a subscription its workspace has. Body: code. A code works once, for 7 days, and is made by the operator with countersign release. |
GET | /v1/tenant | Bearer | Returns the workspace summary: tenant, name, signer, decision_pub, principal_pub, events, counts, policy_version, policy_hash, ans. |
POST | /v1/apikey | Bearer | Replaces the workspace's API key and returns the new one once. The old key stops working. |
POST | /v1/console-links | Bearer | Returns a one-time code that a browser can trade for a session, and expires_in (300 seconds). Used by countersign open. |
POST | /v1/console-links/redeem | None | Trades a one-time code for a console session that holds no signing key. Body: code. |
auth, recover_auth, key_blob and recover_blob are made in the browser. The password and the recovery code themselves are never sent. See Security and limits.
The account routes act on the caller's own account, whatever their role in the workspace.
Until the address is confirmed. On an engine that sends customer email, a workspace whose address is not confirmed gets status 403 from POST /v1/members/invites, POST /v1/shares, POST /v1/billing/plan, POST /v1/billing/packs and the routes under POST /v1/settings/notify (turning something off is still allowed). Everything else works, asks included. An engine that sends no customer email treats every address as confirmed.
POST /v1/mail/inbound is called by the mail provider when a message arrives for one of the service's own addresses, such as support@. It is refused unless it carries the provider's signature. It is not part of the API for customers.
Agents: asking and reporting
| Method | Route | Auth | Purpose |
|---|---|---|---|
POST | /v1/asks | Agent signature | Decides one ask and records the answer. Body: ask, agent_sig. |
POST | /v1/asks/late | Agent signature | Records an action that ran while the engine could not be reached: the ask the agent signed at the time, handed in afterwards. Body: ask, agent_sig, as for /v1/asks. It is recorded as action_late, never as a decision. Returns seq, passport (valid, revoked or expired at the time it arrived), would and rule (what the policy in force then makes of the action), and already: true with the earlier entry's seq when the engine had that request_id already. |
POST | /v1/asks/held | Agent signature | Says how one of the agent's own held asks stands. Nothing is recorded. Body: mandate_id, request_id, at (the agent's clock, refused when more than 15 minutes from the engine's), agent_sig. The agent signs the tag countersign.held-state.v1 over tenant, mandate_id, request_id and u64be(at). Returns state (waiting, approved, declined, used when the approval has been used, or revoked when the passport was), at (when the person decided), by and note (the name they decided under and the note they left) and now. Status 404 when no action is held under that request id for this passport: an ask made under another passport is answered the same way. |
POST | /v1/outcomes | Agent signature | Records the agent's report of what an allowed action did. Body: mandate_id, request_id, status (ok or error), result_hash, agent_sig. Returns seq. |
The ask
{
"ask": {
"tenant": "tn_...",
"mandate_id": "md_...",
"request_id": "rq_...",
"tool": "payments.send",
"target": "vendor/northwind",
"args_hash": "<64 hex characters>",
"attrs": { "payee_on_file": "true" },
"cost": 184000,
"currency": "USD",
"parent": "",
"session": "",
"at": 1794520000
},
"agent_sig": "<hex>"
}
| Field | Meaning |
|---|---|
tenant, mandate_id | The workspace and the passport. Both are in the agent's credential. |
request_id | An id you choose. It must be unique per ask. Required. |
tool | The tool name. Required. |
target | What the action touches. May be empty. |
args_hash | A 32-byte hash that commits to the action's arguments. Required. |
attrs | Facts for policy to read. Names and values are text. |
cost, currency | The cost in minor units and its currency. Leave currency empty when cost is 0. |
parent | The request id of an approved held action this ask re-attempts. Otherwise empty. |
session | A session id of your choice. May be empty. |
at | The caller's clock. |
The answer
| Field | Meaning |
|---|---|
request_id | The ask's request id. |
effect | allow, deny or escalate. Empty when the ask was refused. |
rule | The rule that decided. |
reason | The rule's reason, or the refusal in words. |
refused | Empty, or one of mandate_revoked, mandate_expired, request_identity_conflict, invalid_attempt_link. |
seq | The receipt number of the recorded entry. |
replay | True when this is the original answer to an ask that was sent again. |
receipt | The receipt for the entry: event, head and proof. |
ticket | Present only when effect is allow. See Receipt checks. |
A decided or refused ask returns status 200. Read effect and refused to tell which.
Other statuses:
| Status | Meaning |
|---|---|
| 400 | The ask is missing request_id, tool or a 32-byte args_hash, or has a negative cost or time. |
| 401 | The signature does not match the passport. Nothing is recorded. |
| 404 | The passport is unknown. |
| 409 | The workspace has no active policy. |
Sending the same ask again with the same request_id returns the original answer with replay set to true. Sending a different ask with a request_id that was already used is refused as request_identity_conflict.
The signature
The agent signs a message built from a tag and a list of byte fields:
u32be(len(tag)) || tag || u32be(number of fields) || for each field: u32be(len(field)) || field
u32be is a 4-byte big-endian length. u64be below is an 8-byte big-endian number.
For an ask, the tag is countersign.ask.v1 and the fields are, in order:
tenantmandate_idrequest_idtooltargetargs_hash, as its 32 raw bytes- the facts, as one field: a message built the same way with the tag
countersign.attrs.v1, whose fields are each name followed by its value, with names sorted by their bytes cost, asu64becurrencyparentsessionat, asu64be
For an outcome, the tag is countersign.outcome.v1 and the fields are tenant, mandate_id, request_id, status, and result_hash as raw bytes.
The signature is Ed25519, sent as hex. An agent that signs with its ANS identity key uses ECDSA P-256 over SHA-256 and sends the 64 bytes R followed by S.
sdk/node/countersign.mjs and sdk/python/countersign.py are short and can be read as the reference.
Passports
| Method | Route | Auth | Purpose |
|---|---|---|---|
GET | /v1/mandates | Bearer | Lists every passport with its hash, whether it is revoked, the amount spent, its version count, the rollout it came from, and any ANS binding. Also returns the workspace's ANS setting. |
POST | /v1/mandates | Bearer + owner signature | Issues a passport. Body: mandate, principal_sig. Returns seq and mandate_id. Status 402 when the plan's agent allowance is used up. |
POST | /v1/mandates/{id}/amend | Bearer + owner signature | Replaces a passport's terms. The agent key and id stay the same. Body: mandate, principal_sig. |
POST | /v1/mandates/{id}/revoke | Bearer | Revokes a passport. Body: reason, and optionally principal_sig. With the signature the revocation is the owner's own. Without it, the entry carries no owner signature and stands as the operator's act. |
A passport (mandate) has these fields: id, tenant, principal, principal_pub, agent_name, agent_pub, tools, escalate, per_action_cap, escalate_over, budget, currency, not_after, legal_basis, and optionally ans_name and ans_cert. See Concepts.
The owner signs the passport's deterministic CBOR encoding. The CLI and the console do this for you.
Policy
| Method | Route | Auth | Purpose |
|---|---|---|---|
GET | /v1/policy | Bearer | Returns the active policy: version, source, hash. |
POST | /v1/policy | Bearer + owner signature | Activates a new policy version. Body: source, principal_sig. Returns version. |
GET | /v1/starter | None | The starter policy for a coding agent, as the Policy page offers it: guards, each with id, label, effect, its rules, and stops and passes, one example of each. Built from the same list countersign guard on uses. Also gateway, in the same shape: the rules offered for an agent behind an MCP gateway. They are not part of the starter policy. See Tool risk in the MCP gateway. |
POST | /v1/policy/validate | Bearer | Checks that a policy source compiles and is within the size limits below. Body: source. Returns ok, and error when it does not. Nothing is recorded. |
POST | /v1/policy/test | Bearer | Tries a draft policy against one imagined action. Body: source, mandate_id, tool, target, attrs, cost, peer_status. Returns ok, effect, rule, reason, revoked. Nothing is recorded. |
Approvals
| Method | Route | Auth | Purpose |
|---|---|---|---|
GET | /v1/integrations | Bearer | What the ledger shows about each way agents connect. Each entry has app, platform, actions, week, first_at, last_at, last_tool, last_seq, agents. An ask with no app fact is counted under direct. |
GET | /v1/exposures | Bearer | Keys and tokens the hooks saw, newest first. Each entry has seq, at, agent, app, tool, kinds, places, target, cwd, outcome (blocked, held or allowed), rule, monitor, repeat, session. Also returns kinds, the list of kinds the check knows. No entry holds a value. |
GET | /v1/pending | Bearer | Lists held asks that have no approval yet. Each has request_id, seq, agent, rule, content_hash, ask, at. |
POST | /v1/approvals | Bearer + owner signature | Records an approval of one held ask. Body: request_id, content_hash, approver, note, approver_pub, approver_sig. Returns seq. |
POST | /v1/declines | Bearer + signature | Records a person declining one held ask. It closes the ask. Same body as an approval. The signature is over the tag countersign.decline.v1 and the fields workspace id, request_id, content_hash, note. Needs the approver role or higher. Returns seq. |
Ledger and evidence
| Method | Route | Auth | Purpose |
|---|---|---|---|
GET | /v1/events | Bearer | Returns ledger entries in order, and size, the number of entries in the ledger. See the query parameters below. |
GET | /v1/events/counts | Bearer | Numbers, not entries: how many actions one agent session has on the record. Query: session (without it every action is counted) and back, how many of the newest entries to look at (default 2000, at most 20000). Returns actions, flagged (a risk rule names it), blocked (a rule stopped it), last (the receipt number of the newest), more (the session may have more than was looked at), looked and size. |
GET | /v1/receipts/{seq} | Bearer | Returns the receipt for one entry: event, head, proof. |
GET | /v1/head | Bearer | Returns the current signed head: tenant, size, root, at, sig. |
GET | /v1/export | Bearer | Returns the full evidence pack as application/cbor. A pack over 3 MB is not sent whole (status 413): ask for it in parts with ?part=0, ?part=1 and so on, and join the bytes. Every answer carries Countersign-Pack-Parts, Countersign-Pack-Size and Countersign-Pack-Sha256, the hash of the whole pack. From build 2026.11.29.1 it also carries Countersign-Pack-Entries and Countersign-Pack-At: how many entries the pack holds and the time on its signed head. Those two numbers name the pack. Ask for every part after the first with them, as ?part=1&entries=E&at=T, and the engine builds that same pack again, whatever has been recorded since. Without them each part is cut from the pack as it stands at that second, which is a different pack, and the parts do not join. A pack can be asked for again for 15 minutes after the time on its head. After that, or when the two numbers do not match the ledger, the answer is 409: start again from ?part=0. Check the joined bytes against the hash. countersign export does all of this for you. |
Query parameters for GET /v1/events:
| Parameter | Meaning |
|---|---|
after | Return entries after this receipt number. Default 0. |
limit | How many entries to return. Default 100. At most 500. |
tail | When set, return the newest limit entries instead of the oldest. |
since | A Unix time. Start at the first entry at or after it. |
Each entry has seq, kind, at, leaf (the entry's hash) and body.
Fleet
| Method | Route | Auth | Purpose |
|---|---|---|---|
GET | /v1/enrollments | Bearer | Lists rollouts, each with whether it is closed and how many passports it has issued. |
POST | /v1/enrollments | Bearer + owner signature | Creates a rollout. Body: enrollment, principal_sig. Returns seq. |
POST | /v1/enrollments/{id}/revoke | Bearer | Closes a rollout. Body: reason. Passports it already issued keep working. |
GET | /v1/enroll/{id} | None | Returns a rollout's terms, the owner's public key and the workspace name, for a machine about to enrol. Status 410 when the rollout has been closed. |
POST | /v1/enroll | Enrolment signature | Issues a passport that a machine signed for itself with the rollout's enrolment key. Body: enrollment_id, mandate, sig. Returns seq and mandate_id. |
A rollout (enrollment) has these fields: id, tenant, name, enroll_pub, tools, escalate, per_action_cap, escalate_over, budget, currency, passport_days, max_devices, not_after, legal_basis.
Controls
See Controls report for what each figure counts.
| Method | Route | Auth | Purpose |
|---|---|---|---|
GET | /v1/controls | Bearer | The report for one period. Query: from and to in unix seconds. With neither, the last 30 days. A period is at most 366 days. Returns registry, total, tiers, human, audit, rules, frameworks, exposures, coverage, agents (the 100 busiest passports), days and not_counted. A rate is a number from 0 to 1, or -1 when there is nothing to divide by. |
GET | /v1/controls/decisions.csv | Bearer | Every decision in the period as CSV, one row each with its ledger entry number. Same from and to. |
GET | /v1/reviews/sample | Bearer | The autonomous allowed actions picked for review. Query: from, to, and n (default 25, at most 200). Returns population, size and rows. Each row has request_id, seq, at, agent, owner, tier, tool, target, attrs, cost, currency, rule, ask_hash, and once reviewed verdict, reviewer, note, review_seq, review_at. |
POST | /v1/reviews | Bearer + signature | Records a finding on one allowed action. Body: request_id, ask_hash, verdict (pass or breach), note, reviewer, reviewer_pub, reviewer_sig. The signature is over the tag countersign.review.v1 and the fields workspace id, request_id, ask_hash, verdict, note. Needs the approver role or higher. An action is reviewed once. Returns seq. |
Amending a passport in a way that removes its owner or tier is refused with 409 unless the body also has "clear_register": true. This stops a command-line tool from before those fields existed from removing them by accident.
A passport and a rollout each accept two optional fields, owner (120 characters at most) and tier (low, medium, high or critical). They are part of the signed bytes only when set.
Coverage
| Method | Route | Auth | Purpose |
|---|---|---|---|
POST | /v1/coverage/check | Bearer | Compares actions a tool recorded with the allowed actions in the ledger. Body: window_seconds, observations. Each observation has at, tool, and optionally target, actor, note. Returns total, covered, uncovered, window_seconds. At most 50,000 observations. |
See Fleet rollout and Coverage.
Public receipts
| Method | Route | Auth | Purpose |
|---|---|---|---|
GET | /v1/shares | Bearer | Lists the receipts this workspace has published and not taken down. |
POST | /v1/shares | Bearer | Publishes one entry of this workspace's ledger. Body: seq. Returns id and path. Status 422 when the entry looks like it holds a credential. |
POST | /v1/shares/{id}/revoke | Bearer | Takes a published receipt down. |
POST | /v1/public/receipts | None | Publishes a receipt signed by another engine, such as one on the publisher's own machine. Body: receipt, decision_pub, workspace. The engine verifies the receipt against the key it arrives with. Returns id, path and revoke_token. |
GET | /v1/public/receipts/{id} | None | Returns a published receipt: id, receipt, decision_pub, signer, workspace, witness, created. witness is hosted when this engine made the decision and self when the publisher's own engine did. Status 410 when it was taken down. |
POST | /v1/public/receipts/{id}/revoke | None | Takes down a receipt published through /v1/public/receipts. Body: token, the revoke_token returned at publishing. |
The page for a published receipt is at /r/{id}.
Agent Name Service
| Method | Route | Auth | Purpose |
|---|---|---|---|
POST | /v1/settings/ans | Bearer | Turns ANS support on or off for the workspace. Body: enabled. Returns enabled, authorities, trusted_logs. |
POST | /v1/ans/inspect | Bearer | Reads an ANS Identity Certificate before it goes into a passport. Body: cert_pem. Returns identity, cert and chain (verified, failed or unchecked). Status 400 when ANS support is off for the workspace. |
Plan and usage
| Method | Route | Auth | Purpose |
|---|---|---|---|
GET | /v1/billing | Bearer | Returns the current plan, the number of active agents, the number of recorded actions this month (actions, with test actions left out, and tests, how many were left out), when the month resets, the list of plans, and checkout. It also returns packs (action packs held), allowance (recorded actions a month with the packs added in, 0 for no limit), packs_max and pack_sale: direct when a pack change applies at once with no charge, stripe when it is added to the subscription, and empty when packs cannot be bought through the API. Each plan in the list carries pack_actions and pack_price, both 0 for a plan that sells no packs. checkout is none when no payment provider is connected and stripe when card checkout is connected. With a subscription it also returns billing: status, until (end of the paid period), ends (true when the subscription stops at until instead of renewing) and portal. |
POST | /v1/billing/plan | Owner in person | Changes the workspace's plan. Body: plan: free, pro or team. For a workspace that already pays, asking for the other paid plan changes the price on its subscription at once, with no checkout: the reply is the same as GET /v1/billing, the payment provider works out the difference for the days left, and the old plan's action packs come off. Asking for free, or for the plan it already has, returns url: the billing page. When checkout is none it applies at once with no charge. When checkout is stripe and the change needs a payment or a cancellation, nothing changes yet and the reply is url: the Stripe page to send the owner to. The plan changes when Stripe confirms. A workspace has one checkout page at a time: asking again while it is open returns the same url. On the hosted service, status 503 when card checkout is not available: nothing changes and nothing is given away. |
POST | /v1/billing/packs | Owner in person | Sets the number of action packs the workspace holds. Body: packs, from 0 to packs_max. Only on a plan that sells packs (Team). When pack_sale is stripe, each added pack is charged in full at once to the subscription's card and then becomes a line on the workspace's subscription. Status 402 when that payment does not go through; nothing changes. Removing packs charges and refunds nothing. Returns the same reply as GET /v1/billing. A purchase is charged once however often it is sent: sending the same count again finishes the purchase that is open and does not start another. Status 502 with "not finished yet" means the payment provider did not answer and nobody knows yet whether the payment went through. Nothing is charged twice. Ask again, or call POST /v1/billing/sync, and the purchase is finished or cancelled. Status 409 when another change to the packs is being made. |
POST | /v1/billing/portal | Owner in person | Returns url: the Stripe billing page for the workspace, for the card, invoices and cancelling. Needs an existing subscription. |
POST | /v1/billing/sync | Bearer | Reads the subscription from Stripe again and returns the same reply as GET /v1/billing. Body: session, the checkout session id the browser came back with, or an empty string. A session that belongs to another workspace is refused. With an empty session it also finishes a pack purchase that was cut off. |
POST | /v1/stripe/webhook | Stripe signature | Called by Stripe, not by you. A request without a valid Stripe-Signature is refused. |
POST | /v1/billing/contact | Bearer | Records a request to be contacted about a plan. Body: note. |
Downloads and the console
| Method | Route | Auth | Purpose |
|---|---|---|---|
GET | /install.sh | None | A script that installs the CLI to ~/.countersign/bin after checking its SHA-256. Arguments after sh -s -- are run as a CLI command once it is installed. |
GET | /start.sh | None | The install script followed by countersign start. |
GET | /openapi.yaml | None | The OpenAPI description of this API. |
GET | /dl/{file} | None | CLI builds named countersign-<os>-<arch> and their .sha256 files. |
| any | / and every other path | None | The console and its files. This includes the SDK files under /sdk/, the browser verifier at /verify.wasm, the one-time link page at /link and published receipts at /r/{id}. |
Team members
Roles are owner, admin, approver and viewer. Every role reads the record: the ledger, receipts, the export, passports, policy, pending approvals and the controls report. Members, the plan, integrations, rollouts, alert settings, exposures and published links are read by the owner and admins. Each route that changes something needs at least the role shown. A request from a role that is not enough gets status 403.
| Route | Needs | Purpose |
|---|---|---|
GET /v1/members | admin | List the people in the workspace, with role and status. GET /v1/account gives any member their own role and status. |
POST /v1/members/invites | owner | Make a one-time invitation code for a role. Body: role (admin, approver or viewer) and optionally email. With an email the invitation is mailed to that address and can only be taken up with it. Returns code, expires and mailed. At most 50 mailed invitations a day for a workspace. |
POST /v1/join/info | none | What an invitation is for. Body: code. Returns the workspace name, the role and, for a mailed invitation, the email it is for. |
POST /v1/join | none | Create the invited person's account. Body: code, name, email, auth, and for a role that signs key_blob, pub, recover_auth, recover_blob. |
POST /v1/members/confirm | owner | Record the owner's signature over a pending member's key. Body: email, principal_sig. |
POST /v1/members/remove | owner | Remove a member. Body: email, and principal_sig when the member's key is in the ledger. |
POST /v1/members/role | owner | Change a member's role. Body: email, role (admin, approver or viewer), and principal_sig when the member's key is in the ledger: over the new role (tag countersign.member-role.v1; fields: workspace id, the member's key, the role, and role_seq from GET /v1/members as a decimal string), or over the key's removal when the role is viewer. |
POST /v1/account/signing-key | the member | Store the signing key a member made after being moved from viewer to a role that signs. Body: pub, recover_auth, recover_blob, and for an account with a password auth and key_blob. The owner then confirms the key. GET /v1/account returns make_key while a key is still to be made. |
POST /v1/join/offers | a proven address | The workspaces the caller could ask to join: those whose owner has a confirmed address at the same company domain. The address is proven by ticket and bind from single sign-on, or by a console session of a confirmed account sent as the bearer. Returns workspaces (id and name), asked and email. |
POST /v1/join/asks | a proven address | Ask to join one of them. Body: tenant, and ticket and bind when there is no session. Tells the owner. Makes no account. |
GET /v1/join/asks | owner | Who is waiting to be let in, and whether the workspace takes such requests. |
POST /v1/join/asks/decide | owner | Body: id, let_in, and role when letting in (approver when left out). Letting in makes an invitation to the person's address: mailed, or returned as code when the engine sends no mail. |
POST /v1/workspace/join-open | owner | Body: on. Turns on or off whether colleagues are offered this workspace. |
What other routes need: POST /v1/approvals needs approver. POST /v1/coverage/check, POST /v1/policy, passports (/v1/mandates...), rollouts (/v1/enrollments...), receipt links (/v1/shares...) and POST /v1/console-links need admin. The API key, plan, settings, members and deleting the workspace need the owner. The workspace API key acts as the owner, except for the four routes that need the owner in person (see Authentication): the plan, the packs, the billing page and deleting the workspace.
Alerts, replay and deleting a workspace
| Route | Needs | Purpose |
|---|---|---|
GET /v1/settings/notify | any role | Whether Slack alerts are on, the channel name when it is known, and connect: whether this engine offers Add to Slack. The address is never returned in full. |
POST /v1/settings/notify | owner | Set or remove the Slack address. Body: slack_url (empty removes it), on_block, on_secret (post exposed keys and tokens; leave it out to keep the current setting), keep (change the tick boxes only). |
POST /v1/settings/notify/slack | owner | Start Add to Slack. Returns url, the Slack page to send the browser to. 404 when the engine has no Slack app set. |
GET /v1/slack/callback | none | Where Slack sends the browser back. Redirects to /settings#slack=<ticket>, or #slack_error=<message>. Turns nothing on by itself. |
POST /v1/settings/notify/slack/finish | owner | Turn alerts on with the ticket. Body: ticket. Refused unless the ticket was made for the caller's workspace. One use, ten minutes. |
POST /v1/settings/notify/test | owner | Post a test message. |
GET /v1/settings/notify/approve | any role | Approving from Slack: available (this engine can take Slack's button presses), on, the key's pub and name, and people. |
POST /v1/settings/notify/approve/start | owner | Make the key the service will hold. Returns member for the owner to sign. Counts for nothing until confirmed. |
POST /v1/settings/notify/approve/confirm | owner | Body: principal_sig, the owner's signature over that member. Records member_added and switches it on. |
POST /v1/settings/notify/approve/off | owner | Body: principal_sig over the key's removal. Records member_removed and deletes the service's copy of the key. |
POST /v1/settings/notify/approve/people | owner | Body: team, user, allow. Allows someone who has pressed Approve, or takes them off the list. |
POST /v1/slack/actions | Slack's signature | Where Slack sends button presses. Refused with 401 unless signed with SLACK_SIGNING_SECRET in the last five minutes. |
POST /v1/policy/replay | any role | Run a policy over past asks. Body: source, days (1 to 90, default 7). Records nothing. Each row of the result carries command when the ask had one. |
POST /v1/workspace/delete | owner in person | Delete the workspace. Body: name, the workspace name exactly. Every live subscription that names the workspace is cancelled first, and nothing happens if one cannot be. The workspace is then closed: asks, outcomes and late hand-ins get status 410, and so does every request that would change something. Reading and exporting still work. Returns removed_at, the time it will be removed for good, and days (7). What is kept after that is one line: the workspace's id, the day and whether a subscription was stopped. |
POST /v1/workspace/undelete | owner in person | Undo a deletion that has not been carried out yet. The workspace is as it was, on the Free plan. |
Size limits
These are checked when a request arrives. They are far above what real agents send: the hook cuts a command to 1,000 bytes before it sends it.
| What | Limit |
|---|---|
| One ask, all its fields together | 16 KB |
target | 2 KB |
| One attribute value | 1 KB |
| Attributes on one ask | 40, each name at most 64 bytes |
request_id | 128 bytes |
tool | 200 bytes |
| A policy | 64 KB, 200 rules, 4 KB for one rule's condition |
| A published receipt, as stored | 32 KB |
An ask over a limit gets status 413 and a message that names the field and the limit. It is not recorded.
One rule's condition may do a bounded amount of work on one action. A rule that goes over is stopped, and the action is denied under that rule with the reason rule could not be evaluated. No ordinary rule comes near the bound.
When recording stops
On the hosted service, a workspace on the Free plan that has recorded twice its monthly allowance records no more that month. An engine you run yourself, on your own machine or server, never stops recording. An ask then gets status 402 and a message that says when recording starts again and that the Team plan lifts the stop. The ask is not recorded. An ask under a revoked passport is the exception: it is refused as mandate_revoked and recorded, so that a revoke reaches the agent past the stop. A caller that sends Countersign-CLI with a build of 2026.11.29.2 or later is not given 402. It gets status 200 and a verdict with unrecorded: true and notice (the same words the 402 carries): effect, rule and reason are what the policy and the passport decide, seq is 0, and there is no receipt and no ticket. Nothing was written to the ledger. GET /v1/billing returns unrecorded, the number of actions not recorded so far this month. An ask sent again with a request_id that was already answered still gets its first answer. Paid plans never stop: going over the allowance raises a notice and nothing else. GET /v1/billing returns ceiling (the count at which recording stops, 0 when it never does) and stopped.
What an agent does when its ask is refused this way is up to its hook. A hook that fails closed blocks the action and shows the message. A hook that fails open lets the action through, and nothing is recorded for it.
Rate limits
The engine limits requests per caller address on routes that need no API key.
| Group | Routes |
|---|---|
| Sign-up | /v1/signup, /v1/register, /v1/sso/register, /v1/join |
| Enrolling | /v1/enroll |
| Sign-in | /v1/login, /v1/account/key, /v1/account/recovery, /v1/account/passkeys (adding and removing), /v1/account/password, /v1/account/confirm/send, /v1/account/ack, /v1/account/recovery-kit, /v1/setup (writing), /v1/onboarding/choice, /v1/handoffs, /v1/handoffs/preview, /v1/mail/off, /v1/account/mail, /v1/sessions/end, /v1/confirm, /v1/release/info, /v1/release, /v1/recover/start, /v1/recover/finish, /v1/console-links/redeem, /v1/join/asks, /v1/join/info, and the steps of a company sign-in after it has started (/v1/sso/callback, /v1/sso/ticket, /v1/sso/login, /v1/sso/link, /v1/sso/unlink) |
| Starting a company sign-in | /v1/sso/start |
| Asks | /v1/asks |
| Reports | /v1/outcomes, /v1/asks/late |
| Held asks | /v1/asks/held |
| Publishing | /v1/public/receipts, /v1/public/receipts/{id}/revoke |
| Reading | GET /v1/public/receipts/{id} |
GET /v1/enroll/{id} and POST /v1/join/offers are limited with the reading group.
What each group allows one address:
| Group | At once | After that |
|---|---|---|
| Sign-in | 10 requests that do not succeed | 10 a minute |
| Starting a company sign-in | 60 | 60 a minute |
| Asks | 600 | 100 a second |
| Reports | 600 | 100 a second |
| Reading | 120 | 120 a minute |
The sign-in group counts only a request that does not succeed. A sign-in with the right password, a company sign-in that completes, or a signed-in person changing their own password is not counted. A wrong password, a wrong code or a refused step is. So an office of any size can sign in from one address in the same minute, and someone guessing from that address still gets ten tries a minute, as before build 2026.11.29.2. While an address is over the limit every request in the group from it is refused, right or wrong, until the minute is up.
Asks and reports are counted apart. An agent reporting the outcome of a call, or handing in a call it kept during an outage, does not use up the allowance for asking. Before build 2026.11.29.2 they shared one allowance of 50 a second for an address, which a team of about 25 busy agents behind one office address reached.
When a browser is refused on /v1/sso/start or /v1/sso/callback it is sent back to the sign-in page with a message, not shown a line of data.
Sign-up, sign-in, starting a company sign-in and publishing are also counted in the database, so the limit holds however many copies of the engine are running.
Five more limits are not about one caller address:
- Asks per workspace. A workspace on the Free plan may send 300 asks at once and 10 a second after that. A paid workspace may send 1,200 at once and 100 a second after that. Only asks with a valid signature count. Over the limit an ask gets 429.
- Machines per rollout. One rollout may enrol 600 machines at once and 600 an hour after that, whatever addresses they come from. The rollout's own device limit still applies.
- New workspaces. The service makes at most 200 workspaces an hour in all (
COUNTERSIGN_SIGNUP_CEILING). Past that, sign-up answers 429 until the hour ends. - Failed sign-ins for one email. After 10 wrong passwords or recovery codes for one email in 15 minutes, from any address, sign-in for that email answers 429 until the 15 minutes are up.
- Email to one address. An address is mailed at most five confirmation links or "you already have an account" notes a day, whoever asks. An account can ask for a new confirmation link 3 times an hour.
One check of a policy against history runs at a time for a workspace. A second one gets 429. A check decides at most the 50,000 most recent asks in its window again, and its result carries truncated: true when the window held more.