---
title: "Update Organization Api Key"
method: PATCH
path: "/v1/api-keys/{api_key_id}/"
tags: ["API Keys"]
---

# Update Organization Api Key

`PATCH /v1/api-keys/{api_key_id}/`

## Request

- Base URL: `https://logfire-api.pydantic.dev/api`
- URL: `https://logfire-api.pydantic.dev/api/v1/api-keys/{api_key_id}/`
- Auth: OAuth 2
  - Authorization code: `api/oauth/authorize`
  - Token URL: `/api/oauth/token` scopes: `organization:write_api_key`
- TypeScript: <https://skmtc.dev/pydantic/apis/pydantic-logfire-api/docs/v1/api-keys/:api_key_id/patch.ts> (a function with typed inputs; its response is checked against the schema)

Update an API key's title, description, and/or per-scope `claims`.

An empty body is rejected with 422.

## Path parameters

- `api_key_id` string, uuid, required

## Request body

- APIKeyUpdate: Partial update of an API key: display metadata and/or per-scope `claims`.
  - `name` string
  - `description` string, nullable
  - `claims` ScopeClaims
    - `project:gateway_proxy` GatewayProxyClaims: Settings carried by the `project:gateway_proxy` scope.
      - `spending_limit_daily` integer, nullable
      - `spending_limit_weekly` integer, nullable
      - `spending_limit_monthly` integer, nullable
      - `spending_limit_total` integer, nullable
      - `cache_enabled` boolean, nullable

## Response `200`

Successful Response

- APIKeyRead
  - `id` string, uuid, required
  - `organization_id` string, uuid, required
  - `name` string, required
  - `description` string, nullable, required
  - `scopes` OAuthScopeId[], required
  - `project_id` string, uuid, nullable, required
  - `project_name` string, nullable, required
  - `all_projects` boolean, required
  - `created_by` string, uuid, nullable, required
  - `created_by_name` string, nullable, required
  - `created_at` string, date-time, required
  - `last_used_at` string, date-time, nullable, required
  - `expires_at` string, date-time, nullable, required
  - `user_id` string, uuid, nullable, required
  - `active` boolean, required
  - `updated_at` string, date-time, nullable, required
  - `updated_by` string, uuid, nullable, required
  - `claims` APIKeyClaims
    - `project:gateway_proxy` GatewayKeySettings: AI Gateway spend caps and response caching for a `project:gateway_proxy` key. All fields are optional: an omitted or `null` spending limit means no limit for that window, and `cache_enabled=null` inherits the project default.
      - `spending_limit_daily` integer, nullable
      - `spending_limit_weekly` integer, nullable
      - `spending_limit_monthly` integer, nullable
      - `spending_limit_total` integer, nullable
      - `cache_enabled` boolean, nullable

## Other responses

- `404`: API key not found
- `422`: Validation Error
- `429`: Rate limit exceeded

---

[API](https://skmtc.dev/pydantic/apis/pydantic-logfire-api.md) - [All operations](https://skmtc.dev/pydantic/apis/pydantic-logfire-api/llms.txt) - [OpenAPI document](https://skmtc.dev/pydantic/apis/pydantic-logfire-api/revisions/7996e45256f4?raw)
