---
title: "Roll (Regenerate) API Key"
method: POST
path: "/v1/api-keys/{id}/roll"
tags: ["API Key Management"]
---

# Roll (Regenerate) API Key

`POST /v1/api-keys/{id}/roll`

Regenerate the token for an API key. The key ID stays the same but gets a new token.
The old token is immediately invalidated.

## Path parameters

- `id` string, uuid, required

## Response `200`

Token regenerated

- object
  - `status` string
  - `data` object
    - `api_key` object
      - `id` string, uuid
      - `name` string, nullable — Optional label for the key
      - `token_hint` string — First 8 characters of the token
      - `active` boolean
      - `created_at` string, date-time
      - `revoked_at` string, date-time, nullable
      - `plain_token` string — New full token (64 hex chars)

## Other responses

- `404` — Key not found
- `422` — Cannot roll a revoked key
- `500` — Unexpected server error. Retry transient failures with bounded backoff and retain the request ID when contacting support.

---

[API](https://skmtc.net/oilpriceapi/apis/oil-price-api-v1.md) · [All operations](https://skmtc.net/oilpriceapi/apis/oil-price-api-v1/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/oilpriceapi/oil-price-api-v1/versions/5a5ce424cacc/schema)
