Public API — Overview¶
The Whiskers Public API is for calling externally exposed agents from your own applications. Base path:
https://<whiskers-host>/api/public/v1
Full endpoint schemas: API Reference.
Prerequisites¶
- The agent must be published and publicly exposed (public exposure — via the admin UI, subject to an approval flow).
- An API key must exist, with the agent on the key's allowed-agents list.
Keys are shown once
The api_key (and signing_secret for signed requests) is returned
only once, in the create/rotate response; it cannot be read back from
the platform. Store it in a secure secret store. If you suspect a leak,
rotate the key.
Authentication¶
1) Bearer (default)¶
Authorization: Bearer wsk_<prefix>_<secret>
2) Signed requests — WhiskersHMAC (optional, stricter)¶
A key can be configured to accept signed requests only (Bearer is then
rejected). The signature is HMAC-SHA256 with the signing_secret:
signature base = METHOD \n path?query \n ts \n sha256(body).hex()
Authorization: WhiskersHMAC key_id=<prefix> ts=<unix-seconds> signature=<hex>
- Requests with
tsoutside the tolerance window (default ±300 s) are rejected; replaying the same signature trips the replay protection. path?queryis included in the signature; for an empty body use the sha256 of the empty byte string.
import hashlib, hmac, time
def sign(method: str, path: str, body: bytes, key_prefix: str, signing_secret: str) -> str:
ts = str(int(time.time()))
base = f"{method.upper()}\n{path}\n{ts}\n{hashlib.sha256(body).hexdigest()}"
sig = hmac.new(signing_secret.encode(), base.encode(), hashlib.sha256).hexdigest()
return f"WhiskersHMAC key_id={key_prefix} ts={ts} signature={sig}"
3) User token — OAuth (mcat_…)¶
If the call is made on behalf of a person with a Whiskers account rather than a machine (an internal application, a personal script), use that person's OAuth token instead of an API key:
Authorization: Bearer mcat_<token>
The token is obtained through the browser: the person signs in to Whiskers and
approves your application; the step-by-step flow is in the
Access on behalf of a user guide. For a personal
script or CLI, a personal access token (PAT) created in the console
replaces the consent flow — same format, same rules (the For scripts and
CLIs section of the guide). On this path the
call runs with the person's own permissions: agent access lists, seat and
user quota all apply, and the audit trail names that person as the actor. The
token limits the application to the approved scopes: agent:invoke to run
agents over REST, plus agent:upload_document to upload documents and
agent:approve to make approval decisions; a missing
scope yields 403 oauth_scope_forbidden. REST scopes require the person to hold
personal_token:manage (at consent and on every request); without it the call
yields 403 oauth_rest_permission_required.
API key (wsk_) |
User token (mcat_) |
|
|---|---|---|
| Identity | Machine (the key itself) | A Whiskers user |
| Authorization | The key's agent list; user ACL is bypassed | The user's own permissions |
| Rate limit | Per key (set by the admin) | Per user (installation-wide) |
| IP restriction, signed requests | Yes | No |
invoke-async (webhook) |
Yes | No (403 api_key_required) — use invoke with "async": true |
subject declaration |
Yes | Not needed, ignored |
Expired token
An access token lives for one hour. Once expired the request returns
401 oauth_token_invalid with a WWW-Authenticate header; renew it with
the refresh token (the Refreshing step in the guide).
4) The one endpoint that needs no authentication — shared conversation¶
GET /api/public/v1/shares/{token} requires no API key: the link itself is
the authorization. It returns the frozen copy of a conversation shared from
inside an organization.
GET /api/public/v1/shares/{token}
- Read-only. It does not run an agent, write to a conversation, or reach live data; the response is a copy frozen at share time.
- Gates: the link's expiry · whether it was revoked · the organization's sharing switch (turning it off invalidates existing links immediately) · a per-IP rate limit.
- Every rejection returns
404— "exists but expired" is not distinguished from "never existed". This is deliberate: the distinction would confirm that a token was once valid. - The response carries
X-Robots-Tag: noindex, nofollow.
Links are created from the user interface; shares cannot be created through the API. See Sharing Conversations.
Invoking an agent¶
Synchronous¶
curl -X POST "$HOST/api/public/v1/agents/<agent-slug>/invoke" \
-H "Authorization: Bearer $WSK_KEY" \
-H "Content-Type: application/json" \
-d '{"input_message": "Suggest 3 slogans for the new product launch"}'
{
"execution_id": "0197...",
"status": "completed",
"output": { "content": "..." },
"conversation_id": null,
"output_truncated": false,
"blocked_tools": [],
"model_fallback": null,
"subject": null,
"decision": null,
"reason": null,
"error": null,
"awaiting_gate": null,
"queued_at": "2026-11-05T11:27:14.050Z",
"started_at": "2026-11-05T11:27:14.120Z",
"elapsed_ms": 12650,
"current_stage": null,
"stage_label": null,
"stage_code": null
}
output_truncated — the answer may be cut off
If true, the agent filled its output budget (max_tokens) and the
answer stops mid-sentence. status is still completed: the content is
real, it is simply incomplete — which is why status cannot tell you.
The field is present in every response (false when nothing was cut), so
you can rely on it being there:
if resp["output_truncated"]:
# do not present the text to your customer as a complete answer;
# raise the agent's max_tokens or ask for shorter output
...
Common signature: a system prompt demanding long, structured output
(reports, tables, checklists) combined with a low max_tokens. Note that
token counts are model-specific — a number you measured with another
provider's tokenizer does not tell you whether this model's budget was
exhausted, and non-English text (e.g. Turkish) consumes noticeably more
tokens for the same content.
blocked_tools — the answer may be written without needed data
If non-empty, the agent could not run one or more tools it was supposed
to use (a permission or configuration failure) and wrote its answer
without their data. status is still completed and the answer
looks complete — which makes this more insidious than
output_truncated: nothing in the text signals the gap.
if resp["blocked_tools"]:
# do not treat the answer as grounded; the list names the tools
# that did not run
raise NeedsReview(resp["blocked_tools"])
The list contains tool names only. Only failures the model cannot fix on its own are reported here (permission/configuration); transient errors (timeouts, invalid arguments) are handed back to the agent, which usually recovers — those never appear in this list.
model_fallback — the answer may come from a different model
If non-null, the call was served by a fallback, not by the requested
alias's primary model: either that model's quota was exhausted or its
provider was unreachable. status is still completed and the answer is
real — but its tone, quality and cost come from another model.
{
"requested_alias": "kimi",
"used_alias": "aws-deepseek",
"used_model": "deepseek.v3.2",
"used_provider_type": "aws_bedrock",
"reasons": ["quota_exceeded"]
}
reasons is ordered and may contain more than one entry: a call can
first switch alias because of quota and then fall down the chain because of
a provider failure.
if resp["model_fallback"]:
# judge output quality against this model; if it persists, tell your
# tenant admin about the quota/provider state
log.warning("fallback: %s", resp["model_fallback"]["used_model"])
Human-approved agents (HITL)¶
If the agent contains an approval gate (human-in-the-loop), the run stops
at that gate and waits for a person's decision, which can take hours or even
days. A synchronous invoke does not stay open for that long:
- The response returns immediately:
statusisawaiting_humanandoutputholds the draft that has not been approved yet. That draft is not the final answer; do not forward it to your customer. - Poll the status endpoint for the result (Asynchronous (poll)), or use
invoke-async+ callback from the start (Asynchronous + webhook callback). Callbacks are recommended for long approval times.
status values:
status |
Meaning | output |
|---|---|---|
pending · running |
Running | Not yet available |
awaiting_human |
Waiting at an approval gate | Unapproved draft, not final |
completed |
Finished (after approval, if there was one) | Final answer |
cancelled |
Cancelled; if a person rejected it, decision = "denied" |
If rejected, the rejected draft, not final |
failed |
Ended with an error; the reason is in error.code |
Usually empty |
Rejection and error information comes back with the same fields on all three
surfaces: the status endpoint, the callback body and the MCP status tool
(whiskers_execution_status):
decision:"denied"if a person rejected the run, otherwisenull.reason: if rejected,{gate, note, by, by_type, subject}— the approval step where the decision was made, the approver's reason, who rejected (by_type:usera person,api_keyan approver key — thensubjectis the key's declaration, not an identity); otherwisenull. If you are not allowed to see the run's output (another user's run), the decision is visible but the reason comes backnull.error:{"code": "..."}whenstatusisfailed(e.g.execution_stale,tenant_suspended), otherwisenull. Only the machine-readable code is returned; internal error messages never leave.
Making the approval decision over the API¶
A decision on a run that is waiting for approval (approve · deny · request changes) can be made over the API as well as in the console:
POST /api/public/v1/agents/{slug}/executions/{execution_id}/decision
Content-Type: application/json
{"decision": "approve", "gate": "Agent review"}
| Field | Value |
|---|---|
decision |
approve (moves to the next step) · deny (run cancelled) · revise (the agent rewrites from the note and waits at the same step again) |
gate |
Required. The step being decided — the status endpoint's awaiting_gate value. If the run is waiting at another step the call returns 409 (gate_mismatch): a retried request cannot approve the next tier |
note |
Required for deny and revise; optional when approving |
subject |
Only for an approver API key, where it is required (below) |
The step the run is waiting at is in the status endpoint's awaiting_gate
field (which tier in a multi-tier approval). The response is the run's new
state: awaiting_human again if it stops at the next step, completed once
the last step is approved. approve and revise continue the run within the
request; the continuation's token quota and cost are charged to whoever
started the run, not to the approver.
There are two ways to decide:
- User token (OAuth or PAT) — with the
agent:approvescope (agent:invokeis not needed). The rule is the same as in the console: the right to decide comes from the step's approver list; while a list is set, the person who started the run cannot pass their own step, and whoever approved one step of a run cannot approve the next. - Approver API key — a key with the
agent:approvescope and a required user declaration (subject_policy=required). The key only approves the step the administrator has named it on in the agent's approval access; group lists and the agent's access list give it nothing. It cannot approve a run it started. A key can be named on only one step of the same agent. So tier 1 can be decided by one system and tier 2 by another system or a group of people. An approver key can read, via the status endpoint, the runs waiting at its step and the runs it has decided.
A key decision is a system approval
A decision made with a key is recorded as "this system approved";
subject is only a declaration (not verified, grants no access) — it
adds "on behalf of this person" to the record. Who can approve is decided
by the access control of the system holding the key — separation of duties
(one person not passing two tiers) is that system's responsibility. Create
the key with the least privilege: approval scope only, an expiry date, IP
restriction, signed requests. Decisions cannot be made over MCP.
Decision errors: 403 permission_denied (details.reason: same_approver ·
starter_key · key_not_listed · test_run · room_run),
409 agent_invalid_state (the step was already decided, gate is not the
waiting step — details.reason: gate_mismatch — or its revision limit is used
up), 422 subject_required (approver key without a declaration). Rejected
decision attempts and every decision are written to the audit trail.
On whose behalf? — subject¶
If your application calls Whiskers on behalf of its own users, say which
call belongs to whom with the subject field:
{"input_message": "What is the status of my order?", "subject": "jane.k@customer.example"}
- The value is your declaration (an e-mail, a user id, an employee number — whatever is meaningful to you). Whiskers does not verify it, does not map it to a Whiskers user and never uses it to grant access; it is stored on the run and shown to your key administrator in the "who is using this key" report.
- The same value comes back in the response and in the callback body as
subject;nullif you sent none. - The value is not shown to the model and does not change the agent's
behaviour. Put user context into
input_messageif the agent needs it. - Agent memory is not used on calls made with a key — it is neither read
nor formed — and
subjectis not a memory key. Deliberately:subjectis an unverified declaration; if memory were bound to it, anyone writingsubject=ayse@…would reach Ayşe's memory, and if it were bound to the key, different end users' personal details would mix. For per-person memory, have each user come with their own token (OAuth or a personal access token — the memory belongs to that person), or keep customer history in your own system and add the relevant part toinput_message. - At most 256 characters; no line breaks or control characters (
422). - Accepted on all three endpoints:
invoke,invoke-async(JSON) anddocuments(form field:-F "subject=...").
Your key administrator may have made the declaration mandatory
If the key's policy is required, a call without subject is rejected
with 422 subject_required and no run is started (no quota is spent).
The default policy is optional: existing integrations keep working
without any change.
Multi-turn conversations and retention¶
To spread a dialogue over several calls, send "start_conversation": true on
the first call and pass the returned conversation_id back on later calls. The
agent sees the earlier turns as context. A conversation belongs to the key
that opened it — another key cannot continue it with the same
conversation_id.
Content is not kept forever. Your organisation's conversation retention period (an administrator setting under Tenant settings → Data retention, 30 days by default) runs from the last message for conversations opened with an API key — nobody can archive these conversations, so what is measured is inactivity:
- A conversation that receives no message for that long has its content
deleted; a call with the same
conversation_idreturns404 agent_conversation_not_found. Open a new conversation to continue. - The input and output of calls without a conversation (one-off calls) are
deleted the same period after the call finished; the status endpoint keeps
showing the run, but
outputcomes back empty. - Only the content is deleted: usage and cost records and the audit trail remain. Those records (usage, cost, audit and tool-call records) never carry the text of messages, answers or tool inputs — not even a shortened excerpt.
- If your organisation has turned retention off, content is kept indefinitely.
Conversations opened with an OAuth user token are that user's own conversations: they show up in the user's console and follow the user's archiving rules (including auto-archive after inactivity). Calls made with a user token (OAuth or PAT) without opening a conversation are treated like one-off key calls: their input and output are deleted once the retention period has passed since the call finished.
Asynchronous (poll)¶
Add "async": true to the invoke body → returns pending immediately; poll
the status endpoint for the result:
GET /api/public/v1/agents/<agent-slug>/executions/<execution_id>
The response carries the same fields as a synchronous invoke. Keep polling
until status is terminal (completed · failed · cancelled); for
human-approved agents awaiting_human is not terminal (see Human-approved
agents). The agent slug in the path must be the run's agent; otherwise 404.
Request bodies are strict
Both endpoints reject unknown fields (422). Fields are never silently
ignored, because a field sent to the wrong endpoint used to create a false
expectation: a callback_url sent to invoke registers no callback, and
"async": false sent to invoke-async does not make the run synchronous
(the mode is determined by the path itself). Typos (e.g.
start_conversion) now fail loudly instead of falling back to the default.
Long runs: the waiting screen and cancelling¶
An agent can take seconds, sometimes minutes, to answer — especially agents that use tools or hand work to other agents. We recommend building your user's screen like this:
- Do not call Whiskers from the browser. An API key in the browser is visible to everyone. Flow: your front end → your server → Whiskers.
- Do not use the synchronous call for long agents. The connection stays
open for the whole run; timeouts of proxies in between (typically 30-60 s)
drop the request from your user's point of view. Call with
"async": true, show "processing" right away and poll the status endpoint every 1-2 seconds, backing off as it runs longer — or useinvoke-asyncwith a callback. The status endpoint has its own rate budget (by default 120 polls per minute per key); it does not count against your key's call limit, so polling often does not use up your invoke allowance. -
Take the elapsed time from the server. Every response (synchronous, status endpoint, callback, MCP) carries these fields:
Field Meaning queued_atWhen your request was accepted (server clock; never changes) started_atWhen the work started — rewritten when taken off the queue and after an approval; nullwhile queuedelapsed_msTime since acceptance (queue and approval waits included); total duration once finished current_stagequeued·running·awaiting_human(waiting for approval);nullonce finishedstage_labelWhile running, the text of the current step (e.g. "Analysing TV data", "Querying the database"); nullif not defined or if the run is not runningstage_codeWhile running, a stage code when the platform recognises the stage, otherwise null. Today there is one code:reviewing_results— the model is reviewing tool or sub-agent results (writing the answer, or about to call another tool)stage_labeltexts are the "External progress text" that whoever manages the agents and tools writes in the admin panel (agent → Exposure card, tool → Overview). Internal agent and tool names are never written to this field; if no text is defined, the field staysnulland onlycurrent_stageis shown. When an agent hands work to another agent (a step of an approval flow, or a workflow), that agent's text is shown; while one of its tools runs — if the tool has a text — the tool's text is shown.stage_codeis a code, not a text: the platform does not know your user's language, so you translate it (e.g.reviewing_results→ "Reviewing results…"). The code does not changestage_label— while the model runs after a tool result,stage_labelstays the agent's text and the code tells you which stage it is in; you can show both, e.g. "Analysing TV data · Reviewing results". New codes may be added: ignore codes you do not recognise (fall back tostage_label). -
Do not invent stage messages from elapsed time ("Querying the data…" and the like) — if the run is not in that stage, your user is misled.
- Instead of polling you can follow the run live — the event stream below tells you the moment something changes.
Following live (Server-Sent Events)¶
From your server you can follow a run started with "async": true live:
curl -N -H "Authorization: Bearer $WHISKERS_KEY" \
"https://<server>/api/public/v1/agents/<agent-slug>/executions/<execution_id>/events"
| Event | When | Body |
|---|---|---|
snapshot |
First event on connect; last event when the connection's lifetime ends | Same as the status endpoint's response |
started |
The run was taken off the queue | {"current_stage": "running"} |
stage |
The stage text or code changed | {"stage_label": "…", "stage_code": "…"} (either may be null) |
token |
The answer is being written — only with ?tokens=true |
{"content": "…"} |
ping |
The connection is alive (about every 15 s) | {} |
completed · failed · cancelled · awaiting_human |
The run finished or waits for approval; the stream closes | Same as the status endpoint's response |
- Only the key or user token that started the run can connect; someone
else's run returns
404. Approvers use the status endpoint. - If the connection drops, reconnect. Missed events are not resent; the
new connection starts with the current state (
snapshot). The final answer always arrives in full in the closing event — missing text pieces does not affect the result. - If the run has already finished or waits for approval, a single event arrives and the stream closes. To follow it after approval, reconnect.
- The number of streams open at once is limited per key (default 5); beyond
it you get
429 api_key_stream_limit. A connection stays open for at most 15 minutes, then asnapshotis sent and it closes — reconnect. The connect request counts against the status endpoint's rate budget. - The event stream is also meant for server-to-server use: let your own server forward the events to the browser so the API key never reaches it.
Cancelling¶
If your user gives up, stop the run — a run that is not stopped keeps spending tokens:
POST /api/public/v1/agents/<agent-slug>/executions/<execution_id>/cancel
- Only the key or user token that started the run can cancel it; someone
else's run returns
404(an approver cannot cancel either — their path is thedenydecision). - A finished run returns
409 execution_not_active. - The run stops (including sub-agents it handed work to) and
statusbecomescancelled; the response is the current state. If you set up a callback, thecancelledbody is delivered to you.
Asynchronous + webhook callback¶
If you'd rather have the result pushed to you instead of polling:
curl -X POST "$HOST/api/public/v1/agents/<agent-slug>/invoke-async" \
-H "Authorization: Bearer $WSK_KEY" \
-H "Content-Type: application/json" \
-d '{
"input_message": "Summarize the monthly report",
"callback_url": "https://your-app.example.com/whiskers/callback"
}'
When the run finishes, Whiskers POSTs the result to callback_url;
undeliverable callbacks are retried with exponential backoff.
-
Every callback is signed. The secret is the signing secret of the API key that made the request (
signing_secret, shown once when the key is created; replaced when the key is rotated). Two headers arrive:X-Whiskers-Timestamp: <unix seconds> X-Whiskers-Signature: sha256=<hex(HMAC-SHA256(signing_secret, "<timestamp>.<raw body>"))>To verify, recompute the signature over the raw body and compare in constant time, and check that the timestamp is recent (suggested: ±5 minutes). Because the timestamp is signed, a captured callback replayed later can be told apart; not processing the same
execution_idtwice is your idempotency rule (retries keep the same body). - With an old key that has no signing secret,invoke-asyncreturns409 callback_signing_unavailable— rotate the key. - Thecallback_urlpasses a security check: private/internal network addresses are rejected; if your tenant defines an allowed-hosts list, only those hosts are accepted (422 callback_url_forbidden).
Callback body¶
{
"execution_id": "0197...",
"status": "completed",
"output": { "content": "..." },
"output_truncated": false,
"blocked_tools": [],
"model_fallback": null,
"subject": null,
"decision": null,
"reason": null,
"error": null,
"event": "finished",
"awaiting_gate": null,
"queued_at": "2026-11-05T11:27:14.050Z",
"started_at": "2026-11-05T11:27:14.120Z",
"elapsed_ms": 12650,
"current_stage": null
}
subject is the declaration you sent when starting the call (see On whose
behalf?) — use it to match the callback to your own user.
Runs waiting for approval are announced too¶
If the agent stops at an approval step (human-approved agents), you receive a separate callback — so your system can open its approval screen:
{
"execution_id": "0197...",
"event": "awaiting_human",
"status": "awaiting_human",
"awaiting_gate": "Finance approval",
"current_stage": "awaiting_human",
"output": { "content": "<draft awaiting approval>" },
"elapsed_ms": 8400
}
eventsays what the callback announces:awaiting_human(approval is pending) orfinished(the run ended —statusis terminal).- With multi-step approval every wait is announced separately
(
awaiting_gatenames the step). - The body describes that moment of the wait; a retried delivery may
arrive after the decision was made. Ordering is not guaranteed:
event: "finished"is always final — ignore anawaiting_humandelivery that arrives after it. - This is sent only for runs started with
invoke-async+callback_url. Synchronous and"async": truecalls already seeawaiting_humanin the response / status endpoint.
Always check status
If status is not completed, output is NOT the final answer. When
a human-in-the-loop agent is rejected, output still holds the draft
that was not approved — never forward it to your customer without
checking.
Likewise, if output_truncated is true the answer is incomplete, and
if blocked_tools is non-empty the answer was written without required
data (see the warnings above) — these fields travel in the body because a
callback consumer never calls the status endpoint.
In human-approved flows a run can be rejected by a person. status then
becomes cancelled and two fields are populated:
{
"execution_id": "0197...",
"status": "cancelled",
"output": { "content": "<rejected draft>" },
"decision": "denied",
"reason": {
"gate": "Supervisor approval",
"note": "tone is too harsh, it blames the customer",
"by": "3f9a..."
}
}
decision:"denied"when rejected, otherwisenull.reason.gate: name of the approval step where the decision was made (which tier rejected it, in multi-tier approvals).reason.note: the approver's reason (required when rejecting).- The same fields come back from the status endpoint and the MCP status tool — a polling client sees the rejection reason too.
If the run ends with an error, status becomes failed and the reason comes
in error.code:
{
"execution_id": "0197...",
"status": "failed",
"output": null,
"decision": null,
"reason": null,
"error": { "code": "execution_stale" }
}
A rejected run is terminal — it cannot be resumed. To continue the process, add the reason to your input and make a new call.
running does not last forever
If the server process executing a run terminates unexpectedly (a deployment,
a restart), the record cannot close itself. Such rows are reaped
periodically and their status becomes failed and error.code is
execution_stale (before 2026-10-25 such rows were written as
cancelled). A polling client will
therefore never see running forever — it reaches a terminal state within
an hour at the latest. This is NOT a human cancellation (decision stays
empty).
Calling with a document¶
You can give the agent a file as context (a contract, report, or form
attachment). The flow has two steps: upload the file, then call the agent
with the returned conversation_id.
Supported types: txt, pdf, docx, xlsx, pptx, odt, ods, odp,
doc, xls, ppt (10 MB max).
1) Upload
curl -X POST "$HOST/api/public/v1/agents/<agent-slug>/documents" \
-H "Authorization: Bearer $WSK_KEY" \
-F "file=@contract.pdf"
{
"conversation_id": "6a1f...",
"document_id": "9c4b...",
"status": "ingested",
"chunk_count": 12
}
2) Invoke — pass the returned conversation_id:
curl -X POST "$HOST/api/public/v1/agents/<agent-slug>/invoke" \
-H "Authorization: Bearer $WSK_KEY" \
-H "Content-Type: application/json" \
-d '{
"input_message": "Summarise the risky clauses in this contract",
"conversation_id": "6a1f..."
}'
You can call repeatedly with the same conversation_id — the document stays in
context. To attach a second file to the same conversation, add
-F "conversation_id=6a1f..." to the upload request. For the user declaration
add -F "subject=..." (mandatory when the key policy is required — see On
whose behalf?).
Do you need to wait?¶
By default, no. If the upload response says "status": "ingested", the
document is ready and you can invoke immediately.
For very large files you can move the upload to the background
(?async=true); the response then returns "status": "pending" and you
must not invoke before it is ready:
curl "$HOST/api/public/v1/agents/<agent-slug>/documents/<document-id>" \
-H "Authorization: Bearer $WSK_KEY"
Wait until status becomes ingested. Invoking while a document is still
pending returns 409 conversation_documents_pending — this is a deliberate
safeguard: otherwise the agent would answer without seeing the document and you
would not notice. A failed status means the document will not be used (upload
the file again).
Requirements and limits¶
- Your key must have the
agent:upload_documentscope; otherwise403. The scope is granted only when the key is created — it cannot be added to an existing key, so issue a new one. - Uploads have their own hourly limit, separate from the call limit;
exceeding it returns
429. - Documents are temporary: they are deleted automatically after 24 hours by default. For permanent corpora use a Knowledge Base (via the admin UI).
- Uploading performs text extraction and embedding → it counts against your token quota.
- A document is only visible in the conversation of the key that uploaded it;
another key gets
404.
Rate limits and quotas¶
| Layer | Source | On overflow |
|---|---|---|
| Per-minute request limit | per key: rate_limit_per_minute |
429 |
| Hourly async-invoke limit | separate per-key counter | 429 |
| Hourly document upload limit | separate per-key counter | 429 |
| IP allow/deny list | key setting — matched against the connecting address; when Whiskers runs behind a proxy, only the address forwarded by a proxy the administrator trusts is used, never the request's own X-Forwarded-For header |
403 |
| Token quota | tenant/agent/user/model + API key dimension | policy: 429, warn, or route to a cheaper model |
The MCP endpoint is subject to the same limits (/api/public/v1/mcp): the key's IP
list applies to every request; the per-minute request limit (per key, or per user for
a user token) is spent on every tool call (tools/call: agent calls and status
queries). Listing tools does not count: MCP clients ask for the list again on every
connection.
Your application should apply backoff on 429 responses.
Two different 429s on the token quota¶
The token quota works with a pre-call reservation model: each call reserves
an amount up front (your input + conversation history + the longest answer the
model may return, i.e. max_tokens); after the call the actual usage is
committed and the difference is released. A rejection therefore has two possible
causes, distinguished by details.reason in the body:
details.reason |
Meaning | What to do |
|---|---|---|
quota_exhausted |
The quota is genuinely full (current >= limit). |
Wait for the period to reset or request more quota. |
reservation_too_large |
The quota is not full, but what remains is not enough for this call's reservation. | Retry with a shorter request / a new conversation, or raise the limit. |
details also carries current, limit, remaining and — in the second case —
estimated.
Why the last slice of a limit cannot be spent
The reservation is worst-case: if the remaining quota is smaller than
max_tokens, no call can start. This is deliberate (it prevents overruns) —
when setting a limit, pick a clear multiple of the agent's max_tokens.
Errors¶
The error body is uniform:
{"error": "not_public", "message": "...", "details": {...}}
| HTTP | code (example) | Meaning |
|---|---|---|
| 401 | authentication_failed / api_key_signature_invalid / oauth_token_invalid |
Key/signature invalid or expired; user token invalid or expired (returned with WWW-Authenticate — refresh it) |
| 403 | not_public / api_key_agent_forbidden / api_key_scope_forbidden / oauth_scope_forbidden / oauth_rest_permission_required / api_key_required / api_key_ip_forbidden |
Agent not exposed, outside the key's scope, the key/token lacks a required scope, or the endpoint is API-key-only (invoke-async) |
| 403 | tenant_suspended |
Your organization has been suspended by the platform administrator: external access (keys, user tokens, MCP) is closed until it is reactivated. Retrying won't help |
| 404 | not_found |
Slug/execution/document not found |
| 410 | tenant_gone |
The organization was deleted; its keys and tokens are no longer valid |
| 409 | conversation_documents_pending |
The conversation has a document that is not ready yet — wait for it |
| 422 | callback_url_forbidden / subject_required / validation |
Invalid body or callback URL; the key requires a declaration but subject is missing |
| 429 | api_key_rate_limited / oauth_rate_limited / quota_exceeded |
Rate limit (per key or per user) or token quota |
Good practices¶
- Separate keys per environment (prod/staging) and rotate regularly.
- Use
invoke-async+ signed callbacks for long jobs; prefer polling only for short ones. - Make your callback endpoint idempotent (retries may deliver the same result more than once).
- Connecting from MCP-based AI tools (Claude Desktop, Cursor)? Use the MCP integration instead of REST.