Prepare your platform
- Have an owner or admin open Agents in the dashboard and claim your
Account’s handle prefix. This claim is permanent. A prefix of
acmepermits handles such asacme-booking. - Open your platform’s credentials in the dashboard and select the Agent
management preset for a new secret key. It contains
agents:readandagents:write. Request only the permissions your integration needs. - Store the secret on your server. Send it as a bearer credential. Omit
Ionic-Accountand dashboard session cookies from Agent identity requests.
agents:read and agents:write are independent: write access does not include
read access. Ordinary Account keys and Agent runtime keys cannot use these
management operations.
Create an Agent
Read the claimed prefix withGET /v1/agents/handle_prefix. If prefix is
null, claim it in the dashboard before creating an Agent. Creation without a
claimed prefix returns 409 AGENT_HANDLE_PREFIX_REQUIRED.
201 response is the Agent identity:
id and version. created_by is the public credential record ID for an
API-created Agent: sk_ followed by 24 letters or digits. A dashboard-created
Agent has a user_ creator. These IDs contain no credential secret. Activity
attributes API changes to the credential, without assigning a human actor.
Agent runtime keys are issued, rotated, and revoked in the dashboard. Creating
an identity returns no runtime key.
Read and change the identity
The list returns
data, has_more, and a next_cursor when another page
exists. Send that cursor as starting_after. limit defaults to 20 and accepts
1–100. The list includes your Account’s Agents across both modes.
Updates require the current expected_version and at least one editable field:
metadata replaces the entire map; send {} to
clear it. Set avatar_hue to an integer from 0 to 359, or to null to restore
the color derived from the handle. description: null clears the description.
The owner, handle, and creator are immutable.
Suspend, resume, and deactivate take expected_version and a nonblank reason:
suspended.
Deactivation is permanent. A deactivated Agent cannot be edited or resumed.
A stale version returns 409 AGENT_VERSION_CONFLICT. Retrieve the Agent,
review the intervening change, and submit a new operation with its current
version and a new retry key. Runtime activity and changes to last_active_at
do not advance the identity version.
Agents connected through MCP cannot be changed through this management API,
including after the MCP connection is disconnected. Those mutations return
403 AGENT_MCP_MANAGED. A metadata.source value does not change that rule.
Retry a mutation
Every machinePOST above requires one nonblank Idempotency-Key, at most
255 bytes, and a JSON body no larger than 64 KiB. A larger body returns
413 REQUEST_TOO_LARGE.
Keep the same key and identical body bytes when retrying an operation. Even
different whitespace counts as a different body and returns
422 IDEMPOTENCY_BODY_MISMATCH. Retry keys are scoped to the owning Account,
credential, operation, and target Agent across both modes. Another credential
cannot replay the result.
Ionic retains successful response snapshots for at least 24 hours. A retry
checks the current Account, credential, permissions, and Program before
returning the saved response. A revoked key or removed permission cannot replay
an earlier success. The saved response is returned before checking the Agent’s
current version, so an unchanged retry does not repeat the mutation.
A snapshot describes the original result. For the Agent’s current status,
retrieve it again. An earlier active response does not establish current
runtime access. After the retention window, retrieve the Agent before deciding
whether to submit another operation.
Connect an Agent to a merchant
Keep the Agent owned by your platform. Use the connected merchant’s Account ID in an Agent grant request:- With a platform secret key that has
platform:act, callPOST /v1/agent_grant_requestswithagent_id, the merchant’saccount, and the requestedpermissions. OmitIonic-Accountfrom this request. - The business must have an active Connection in the key’s mode. Each permission must be grantable to Agents, allowed by that Connection, and within your Program’s permission ceiling.
- Send the returned
urlto the business owner. The owner approves or declines in the dashboard within seven days. An admin can view the request but cannot decide it. - Retrieve
GET /v1/agent_grant_requests/{id}to read the decision. After approval, issue the Agent’s platform key in the dashboard. The Agent uses that key withIonic-Accountset to the merchant’s Account ID for supported runtime operations.
platform:act, so the same key can submit a grant
request when the current Connection and Program allow it. The Agent identity
scopes do not grant the business’s consent. An approved grant authorizes only
its permissions in its mode. For example, an Agent key with customers:read
can call GET /v1/customers/{id}.
An approved request remains approved if the business later revokes its grant.
Read the nested agent_grant.status for the grant’s current status. The
agent_grant_request.updated event reports approval, decline, or cancellation;
expiry and later grant revocation do not emit that request-update event.
