---
title: "Update API key"
method: PATCH
path: "/auth/keys/{id}"
tags: ["ApiKeys"]
---

# Update API key

`PATCH /auth/keys/{id}`

## Request

- Base URL: `https://api.crevio.co/v1`
- URL: `https://api.crevio.co/v1/auth/keys/{id}`
- Auth: API key in header `Authorization`

Renames a key or replaces its scopes. Scope changes apply from the next request. A key can only grant scopes it holds itself (`403 insufficient_scope`).

## Path parameters

- `id` string, required

## Request body

- ApiKeyUpdateRequest
  - `name` string: A new label for the key.
  - `scopes` string[]: Replaces the key's scopes. Takes effect on the next request.

## Response `200`

The updated key

- ApiKey
  - `object` string, required
  - `id` string, required
  - `name` string, nullable, required
  - `last4` string, required
  - `token_type` string, required
  - `kind` 'personal' | 'team', required: `personal` acts as the person who made it; `team` sees only what the whole account sees.
  - `scopes` string[], nullable, required: What the key may call. Null for a key made before scopes existed, which reaches everything.
  - `token` string, nullable, required
  - `last_used_at` string, nullable, required
  - `expires_at` string, nullable, required
  - `created_at` string, required

## Other responses

- `400`: Bad request
- `401`: Authentication required
- `403`: Forbidden
- `404`: Resource not found
- `422`: Validation error
- `429`: Rate limit exceeded — 600 requests per minute per owner on the free tier: every API key and OAuth token one person holds on an account shares one budget, and the account's team keys share another. Retry after the number of seconds in `Retry-After`.
- `500`: Internal server error

## Changes

- **2026-11-15** `56c22ab9b282`: 7 warning
  - added the new `idempotency_error` enum value to the `error/type` response property for the response status `400`
  - added the new `idempotency_error` enum value to the `error/type` response property for the response status `401`
  - added the new `idempotency_error` enum value to the `error/type` response property for the response status `403`
  - added the new `idempotency_error` enum value to the `error/type` response property for the response status `404`
  - …3 more
- **2026-10-23** `bf736a72ee9c`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/crevio/apis/crevio-api-v1/changes/auth/keys/:id/patch.md)

---

[API](https://skmtc.dev/crevio/apis/crevio-api-v1.md) - [All operations](https://skmtc.dev/crevio/apis/crevio-api-v1/llms.txt) - [OpenAPI document](https://skmtc.dev/crevio/apis/crevio-api-v1/revisions/ccbd8fcbd6d7?raw)
