---
title: "Update an API key"
method: PATCH
path: "/api/temporary-keys/{id}/"
tags: ["temporaryApiKeys"]
---

# Update an API key

`PATCH /api/temporary-keys/{id}/`

Update an API key's name, expiry, usage, rate, or spending limit.

## Path parameters

- `id` string, required

## Headers

- `Authorization` string, required

## Request body

- object
  - `name` string — Key name.
  - `expiry_date` string, date-time — Expiry date (ISO 8601).
  - `max_usage` integer — Maximum use count. -1 means unlimited.
  - `rate_limit` number, double, nullable
  - `spending_limit` number, double, nullable

## Response `200`

Updated API key.

- TemporaryAPIKeysUpdateApiKeyResponse200
  - `id` string — API key ID.
  - `name` string — Key name.
  - `prefix` string — Key prefix.
  - `is_test` boolean — Test or production key.
  - `expiry_date` string, date-time — Expiry date.
  - `max_usage` integer — Max usage count. -1 = unlimited.
  - `rate_limit` number, double, nullable — Requests per minute. null uses the organization default.
  - `spending_limit` number, double — Spending limit in USD.
  - `created` string, date-time — When the API key was created.
  - `unique_organization_id` string, nullable — Owning organization UUID.

## Other responses

- `401` — Unauthorized
- `404` — Not Found

## Changes

> 6 revisions in range; 3 could not be searched.

- **2026-07-31** `c26d550029f8` — 4 breaking, 3 warning, 30 info
  - the response property `expiry_date` became nullable for the status `200`
  - the response property `rate_limit` became nullable for the status `200`
  - the response property `spending_limit` became nullable for the status `200`
  - the `rate_limit` response's property type/format changed from `integer`/`` to `number, null`/`double` for status `200`
  - …33 more

[Change history](https://skmtc.dev/keywordsai/apis/api-reference/changes/api/temporary-keys/:id/patch.md)

---

[API](https://skmtc.dev/keywordsai/apis/api-reference.md) · [All operations](https://skmtc.dev/keywordsai/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/keywordsai/api-reference/revisions/c61efaf24756/schema)
