Agents API

Manage AI agent identities and API keys.

List Agents

GET /api/agents

Returns all agents for your organization.

Response

{
  "agents": [
    {
      "id": "uuid",
      "name": "Sarah's Claude Code",
      "acting_user": {
        "id": "uuid",
        "name": "Sarah Chen",
        "email": "sarah@company.com",
        "role": "IC",
        "level": "Senior"
      },
      "surface": "claude-code",
      "status": "active",
      "last_seen": "2025-01-15T10:30:00Z",
      "created_at": "2025-01-10T09:00:00Z"
    }
  ]
}

Create Agent

POST /api/agents

Create a new agent identity and generate an API key.

Request Body

FieldTypeRequiredDescription
namestringYesHuman-readable name
acting_user_idstringYesUser ID this agent acts for
surfacestringNoAgent surface (claude-code, cursor, cli, chatgpt)

Response

{
  "agent": {
    "id": "uuid",
    "name": "Sarah's Claude Code",
    "surface": "claude-code",
    "status": "active"
  },
  "api_key": "crtx_YOUR_KEY_HERE"
}

The API key is shown only once. Store it securely — it cannot be retrieved later.


Get Agent

GET /api/agents/[id]

Response

{
  "agent": {
    "id": "uuid",
    "name": "Sarah's Claude Code",
    "acting_user": {
      "id": "uuid",
      "name": "Sarah Chen",
      "email": "sarah@company.com"
    },
    "surface": "claude-code",
    "status": "active",
    "last_seen": "2025-01-15T10:30:00Z"
  }
}

Delete Agent

DELETE /api/agents/[id]

Disconnects an agent. The agent key becomes invalid immediately.

Response

{
  "ok": true
}

Error Responses

StatusDescription
401Not authenticated
404Agent not found