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

# Update a temporary API key

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

## Request

- Base URL: `https://api.respan.ai`
- URL: `https://api.respan.ai/api/temporary-keys/{id}/`
- Auth: HTTP bearer

Update an API key's name, expiry, usage, rate, or spending limit. With an API key you can change `name` and `expiry_date`. Changing `max_usage`, `rate_limit`, `spending_limit` or `limit_policies` needs the dashboard, or a key explicitly granted the `limit_policies` permission.

## Path parameters

- `id` 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, nullable
  - `spending_limit` number, nullable

## Response `200`

Updated API key.

- object
  - `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, nullable: Requests per minute. null uses the organization default.
  - `spending_limit` number, nullable: Spending limit in USD. `null` when not set.
  - `created` string, date-time: When the API key was created.
  - `unique_organization_id` string, nullable: Owning organization UUID.

## Other responses

- `403`: The API key is missing, invalid or expired, or the request changes limits.
- `404`: Not Found

## Changes

- **2026-10-21** `c30bcb383ee8`: 7 breaking, 5 info
  - the `rate_limit` request property type changed from `number, null` to `number`, and format from `double` to no format
  - the `spending_limit` request property type changed from `number, null` to `number`, and format from `double` to no format
  - the response property `rate_limit` became nullable for the status `200`
  - the response property `spending_limit` became nullable for the status `200`
  - …8 more
- **2026-10-02** `b830b79cfd52`: 1 breaking, 2 info
  - the response property `spending_limit` became nullable for the status `200`
  - added the non-success response with the status `403`
  - removed the non-success response with the status `401`
- **2026-09-17** `6fa8242da8c2`: 1 warning, 1 info
  - deleted the `header` request parameter `Authorization`
  - the endpoint scheme security `RespanApiKey` was added to the API
- **2026-09-12** `22b868ef3f22`: 1 info
  - api operation id `update-api-key` removed and replaced with `temporaryApiKeys_updateApiKey`
- **2026-08-13** `4e064cf81dae`: 19 breaking, 6 warning, 3 info
  - the request property `expiry_date` became not nullable
  - the response property `created` became optional for the status `200`
  - the response property `id` became optional for the status `200`
  - the response property `is_test` became optional for the status `200`
  - …24 more

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

---

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