Secrets and rotation
Write-only credentials for webhook tools and MCP servers, with versions, rotation and revocation.
A secret is a credential that a webhook tool header or an MCP server sends. You write its value
once. No operation returns the value, a hash of it or any part of it. Tools and MCP servers pin an
exact {secret_id, version}, and rotation adds a version without moving any pin.
1. Store a credential
purpose is webhook_tool (a secret header of a webhook tool) or mcp_server (the credential of an
MCP server). The two are not interchangeable: a reference to a secret of the other purpose is
refused with credential_unavailable. material_kind is a label only; the value is sent unchanged.
-
Read the value from your own secret store (here
$CRM_API_KEY). Do not write it in a script. -
After a lost answer, send the identical request with the same
Idempotency-Key. The replay returns the same status and body withIdempotent-Replayed: trueand stores nothing new. It is the stored answer: the secret is not read again, even if it was rotated, revoked or deleted since. -
A refused secret request stores nothing. After you fix the cause, the same request with the same key runs.
-
409 conflictwithdetails.reason: name_taken: another secret has that name. -
409 resource_key_conflictwithdetails.existing_id: the secret already exists. For repeated setup, look it up instead of creating it again:
Then bind it to a tool header or an MCP server as {"secret_id": "sec_…", "version": 1} (see
Tools and MCP servers) and publish the agent.
2. Read metadata
-
Lists are newest first. Follow
next_cursoruntil it isnull. -
A secret’s
stateisrevokedwhen no version can be released any more. -
last_rotated_atstaysnulluntil a second version exists. -
A list refuses a query parameter it does not know (
invalid_requestnaming thefield). -
usagecounts the current draft bindings, the retained published versions and, of those, the versions that are live now. -
A secret of another workspace, a telephony or import credential, and a deleted secret all answer
404 not_found.
3. Rotate and adopt
Rotation stores new material as the next version. It changes nothing that runs: every tool, MCP server and published agent keeps its pinned version, and calls that already started keep theirs.
To adopt version 2:
- Find the consumers of the old version:
GET /secrets/sec_…/references?version=1. Each row names one consumer:webhook_toolormcp_tool(the tool, with itsagent_id) ormcp_server(the workspace connection, no agent). - Replace each webhook tool and each MCP server that pins version 1 with
{"secret_id": "sec_…", "version": 2}. Replacing an MCP server moves every draft tool attached to it; you do not replace those tools. - Review the draft diff and publish each affected agent (the
agent_idof each row). - When no live version pins version 1 (
live: falseon everypublishedrow), revoke version 1.
consumer_type is webhook_tool or mcp_tool for an authored tool of an agent (in a draft or a
published version, with its agent_id), and mcp_server for the workspace MCP server connection
(agent_id: null). The list is open: treat a value you do not know as a consumer you must still
review.
4. Emergency revocation
Revoke a version when its material may be known to someone else (compromised), or when you decide
to stop it (requested). Both have the same effect.
-
Every later use of version 1 is refused at once, also by live agents and by calls that are already running. The refused tool call shows as a refused tool outcome with
credential_unavailable, and the call continues. An MCP server connection that uses the version stops using it for the rest of the call: every later tool call to that server in the call is refused the same way. -
MCP connections check the version before every tool call and fail closed: if the platform cannot confirm the version in time, for example during an outage, the connection stops using the credential just as if it were revoked. See Credentials during calls.
-
Revoking or rotating does not change which version a tool, MCP server or published version pins.
-
An action that was already sent is not undone.
-
Revocation cannot be undone. To recover, rotate, bind the new version and publish.
-
Revoking a revoked version returns its current state; the first reason stays.
-
A rollback never restores a revoked version.
5. Delete
204: every version was destroyed. The secret no longer appears, and its name and resource key can be used again. This cannot be undone.409 deletion_blockedwithdetails.reason: draft_reference: a current draft tool or MCP server still pins a version. Remove or replace those references first.409 deletion_blockedwithdetails.reason: published_reference: a retained published agent version pins a version, and a rollback could restore it. The secret is kept. For compromised material, revoke the version instead.- A detached tool, a disabled MCP server and its tools do not block deletion.
- A replay of the delete answers
204again.