# Create agent

Creates an agent with its budget and first credential, and returns configuration snippets. Console session or API key with agent:create; the credential secret is shown once.

`POST /v1/agents`

Creates an agent with its budget and first credential, and returns configuration snippets. Console session or API key with agent:create; the credential secret is shown once.

Requires permission `agent:create`.

## Request body

```json
{
  "name": "Example"
}
```

## Responses

- **200**: Success.
- **400**: Invalid request: a field is missing or malformed (VALIDATION_ERROR).
- **401**: No valid session, API key or agent credential (UNAUTHENTICATED, AGENT_CREDENTIAL_INVALID).
- **403**: Authenticated but not allowed: missing permission, passkey step-up required, or denied by policy.

Example 200 response:

```json
{
  "agent": {
    "id": "id_01jd2x3k4m5n6p7q8r9s0t1v2w",
    "name": "Example",
    "status": "active",
    "kind": "string",
    "rails": [
      "x402"
    ],
    "team": {
      "id": "id_01jd2x3k4m5n6p7q8r9s0t1v2w",
      "name": "Example"
    },
    "team_id": "team_01jd2x3k4m5n6p7q8r9s0t1v2w",
    "mandate_id": "mdt_01jd2x3k4m5n6p7q8r9s0t1v2w",
    "mandate": {
      "id": "id_01jd2x3k4m5n6p7q8r9s0t1v2w",
      "version": 1,
      "name": "Example",
      "status": "active",
      "expires_at": "2026-11-16T12:00:00Z",
      "limits": {},
      "allowed_rails": [
        "string"
      ]
    },
    "budget": {
      "id": "id_01jd2x3k4m5n6p7q8r9s0t1v2w",
      "limit": "string",
      "committed": "string",
      "spent": "50000",
      "reserved": "50000",
      "available": "50000",
      "asset": "USDC"
    },
    "last_activity_at": "2026-11-16T12:00:00Z",
    "frozen_reason": "string",
    "revoked_at": "2026-11-16T12:00:00Z",
    "created_at": "2026-11-16T12:00:00Z"
  },
  "credential": {
    "id": "id_01jd2x3k4m5n6p7q8r9s0t1v2w",
    "prefix": "string",
    "status": "active",
    "expires_at": "2026-11-16T12:00:00Z",
    "last_used_at": "2026-11-16T12:00:00Z",
    "created_at": "2026-11-16T12:00:00Z",
    "revoked_at": "2026-11-16T12:00:00Z"
  },
  "secret": "string",
  "snippets": {
    "mcp_stdio": "string",
    "mcp_http": "string",
    "rest_curl": "https://example.com/resource",
    "claude_code": "string"
  }
}
```
