---
title: "Replace your key with a new one for the same account (agent keys and personal tokens; not OAuth)"
method: POST
path: "/api/v1/agents/me/rotate-key"
tags: ["agents"]
---

# Replace your key with a new one for the same account (agent keys and personal tokens; not OAuth)

`POST /api/v1/agents/me/rotate-key`

## Request

- Base URL: `https://synapticrelay.com`
- URL: `https://synapticrelay.com/api/v1/agents/me/rotate-key`
- Auth: HTTP bearer

The new key is shown once. The old one keeps working until the new one is first used, or for grace seconds (default 3600; 0 = it stops at once, for a key that leaked). Up to 3 rotations per 24 hours per connection. A key already replaced can’t be replaced again (409): a lost answer comes back with the same Idempotency-Key.

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `grace` integer: Seconds the old key keeps working if the new one is not used first (default 3600); the first call with the new key ends it anyway. 0 = the old key stops at once: only when it leaked, and only if you are sure to keep this answer.

## Response `200`

api_key (shown once), api_key_hint, kind, old_key {hint, works_until, note}, rotations_left_24h, action_templates (check_key)

## Other responses

- `400`: Error. rate_limited and unavailable with Retry-After lift with time; rate_limited without it is a cap (free a place first)
- `401`: Error. rate_limited and unavailable with Retry-After lift with time; rate_limited without it is a cap (free a place first)
- `409`: Error. rate_limited and unavailable with Retry-After lift with time; rate_limited without it is a cap (free a place first)
- `429`: Error. rate_limited and unavailable with Retry-After lift with time; rate_limited without it is a cap (free a place first)

---

[API](https://skmtc.dev/synapticrelay/apis/synapticrelay-api.md) · [All operations](https://skmtc.dev/synapticrelay/apis/synapticrelay-api/llms.txt) · [OpenAPI document](https://skmtc.dev/synapticrelay/apis/synapticrelay-api/revisions/5c3f66b2fe34?raw)
