Agents
An agent is a registered AI coding agent — a delegated identity of one user, not an independent principal. Its captured sessions are attributed to its owner and inherit the owner’s workspace visibility. Registering an agent also issues its single Agent Access Token (AAT), the write-only credential the agent uses to ingest activity. See Agent ingest for the endpoints that consume that token.
Managing agents is an interactive surface: the mutating endpoints below require a logged-in
session and operate only on the caller’s own agents. The plaintext token secret
(spantail_aat_…) is returned exactly once — at creation and on rotation — and is never
retrievable afterwards.
The agent object
Section titled “The agent object”| Field | Type | Description |
|---|---|---|
id |
string | Unique identifier. |
type |
string | Agent kind: claude_code, codex, cursor, or other. |
name |
string | Display name (1–100 chars). |
createdAt |
string | ISO 8601 creation instant. |
disabledAt |
string | null | When set, the agent is paused and its token is rejected at ingest. |
archivedAt |
string | null | When set, the agent is archived (irreversible). |
token |
object | null | Summary of the access token (see below). |
The token summary never exposes the secret or its hash:
| Field | Type | Description |
|---|---|---|
lastUsedAt |
string | null | ISO 8601 instant the token was last used to ingest. |
expiresAt |
string | null | ISO 8601 expiry, or null if the token never expires. |
List agents
Section titled “List agents”GET /api/v1/agents
The required auth depends on the query:
- No query session only — returns the caller’s own agents (newest first). An interactive session is required.
?ownerUserId=<id>scope: admin — an instance admin reads another user’s agents.
The owning userId and the token hash are never returned.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
ownerUserId |
string | no | Instance admin only: list a specific user’s agents. |
Register an agent
Section titled “Register an agent”POST /api/v1/agents session only
Registers an agent owned by the caller and issues its single access token (agent and token
are 1:1). No workspace is involved: where a session lands is named by each ingest payload
(see Agent ingest). The plaintext secret is returned once in
this response.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
type |
string | yes | Agent kind: claude_code, codex, cursor, or other. |
name |
string | yes | Display name (1–100 chars). |
expiresInDays |
integer | no | Token lifetime in days (1–3650). Omit for a token that never expires. |
Returns 201 Created.
Disable or enable an agent
Section titled “Disable or enable an agent”PATCH /api/v1/agents/:id session only
Pauses or resumes the agent by toggling disabled. While disabled, the agent’s token is
rejected at ingest; re-enabling restores it. This is reversible (unlike archiving). Returns
the agent object.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
disabled |
boolean | yes | true to pause the agent, false to resume it. |
Archive an agent
Section titled “Archive an agent”DELETE /api/v1/agents/:id session only
Archives the agent and kills its token immediately. Returns 204 No Content.
Rotate the access token
Section titled “Rotate the access token”POST /api/v1/agents/:id/token/rotate session only
Regenerates the agent’s token secret in place, keeping its expiry. The old secret stops
working immediately. The new plaintext secret is returned once.