# Rotate agent credential

Issues a new credential and lets the previous ones expire after an overlap of 0, 1 or 24 hours (0 revokes them now). Console session or API key with credential:issue; the secret is shown once.

`POST /v1/agents/{id}/credentials`

Issues a new credential and lets the previous ones expire after an overlap of 0, 1 or 24 hours (0 revokes them now). Console session or API key with credential:issue; the secret is shown once.

Requires permission `credential:issue`.

## Parameters

| Name | In | Required | Description |
| --- | --- | --- | --- |
| `id` | path | yes | Agent id (agt_...). |

## Request body

```json
{
  "overlap_hours": 1
}
```

## 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.
- **404**: The resource does not exist or belongs to another organization.
- **409**: Conflicts with the current state, for example a reused Idempotency-Key or an illegal state change.

Example 200 response:

```json
{
  "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"
  },
  "previous": [
    {
      "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"
    }
  ]
}
```
