---
title: "Rotate an agent's API key"
method: POST
path: "/agents/rotate"
---

# Rotate an agent's API key

`POST /agents/rotate`

## Request

- Base URL: `https://getsanction.com/api/v1`
- URL: `https://getsanction.com/api/v1/agents/rotate`
- Auth: API key in header `x-mgmt-key`

Issue a fresh key for an agent; the old key stops working immediately and the new key is shown once. Pass holder to hand the seat to a new person in the same motion — history, budgets, and clearance stay with the seat. To revoke without re-issuing, PATCH /agents with { active: false }. Management-plane (SEC-6).

## Request body

- RotateAgentRequest
  - `wallet_id` string, required
  - `agent_id` string, required

## Response `200`

Key rotated; new api_key shown once

- AgentKeyResponse: Returned on register and rotate. api_key is shown once and never retrievable again.
  - `id` string
  - `name` string
  - `api_key` string: The agent key (pxy_...). Store it now — shown once.
  - `api_key_prefix` string
  - `wallet_id` string
  - `created_at` string, date-time
  - `warning` string

## Other responses

- `400`: Invalid request
- `401`: Missing or invalid management key
- `404`: Agent not found in this wallet

---

[API](https://skmtc.dev/getsanction/apis/sanction-agent-governance-api.md) · [All operations](https://skmtc.dev/getsanction/apis/sanction-agent-governance-api/llms.txt) · [OpenAPI document](https://skmtc.dev/getsanction/apis/sanction-agent-governance-api/revisions/c645a9e4b72d?raw)
