---
title: "Create API Key"
method: POST
path: "/v1/api-keys"
tags: ["API Key Management"]
---

# Create API Key

`POST /v1/api-keys`

Create a new API key. Maximum 5 active keys per user.
The full token (`plain_token`) is only returned in this response — store it securely.

## Request body

- object
  - `name` string, nullable — Optional label (e.g. "Production", "Staging")

## Response `200`

API key created

- 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 — Full token (64 hex chars) — only returned on create/roll

## Other responses

- `401` — Unauthorized
- `422` — Maximum active keys reached
- `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)
