> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vertracloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Rotate API Key

> Issues a new secret for an existing key, keeping its id, name, scopes and allowed IPs. Dashboard session only.

<Note>
  The old secret stops working the moment this responds. As with creation, the new secret is shown once here and never again.
</Note>

### Path

<ParamField path="id" type="string" required>
  The key's ID.
</ParamField>

### Response

<ResponseField name="response" type="APIApiKeyCreated">
  Same key (`id`, `name`, `scopes`, `allowed_ips` unchanged), new `prefix`/`last4`/`api_key`. See [Create API Key](/api-reference/endpoint/users/api-keys/create) for the field reference.
</ResponseField>

<ResponseExample>
  ```json Response theme={null}
  {
    "response": {
      "id": "b7e2d1a4-...",
      "name": "CI deploy",
      "prefix": "vc_live_9c8b7a6d",
      "last4": "11ff",
      "scopes": ["apps:read", "apps:write"],
      "allowed_ips": [],
      "created_at": "2026-09-11T12:00:00Z",
      "last_used_at": null,
      "api_key": "vc_live_9c8b7a6d...11ff"
    }
  }
  ```
</ResponseExample>

### Errors

| Status | Code                   | When                                 |
| ------ | ---------------------- | ------------------------------------ |
| 403    | `API_KEY_SCOPE_DENIED` | The session is an API key.           |
| 404    | `API_KEY_NOT_FOUND`    | No key with that ID on this account. |
