---
title: "Update an API key"
method: PATCH
path: "/apikey/{api_key_id}/"
tags: ["apikey"]
---

# Update an API key

`PATCH /apikey/{api_key_id}/`

## Request

- Base URL: `https://api.getoneprofile.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.getoneprofile.ai/apikey/{api_key_id}/`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

Update an API key by its ID. Requires a user authentication (not API key).

## Path parameters

- `api_key_id` string, uuid, required

## Request body

- APIKeyUpdate
  - `expire_at` union: The date and time when the API key will expire. If not provided, the API key will never expire.
    - string, date-time
    - unknown
  - `name` union: The unique name of the API key.
    - string
    - unknown

## Response `200`

Successful Response

- APIKeyRead
  - `created_at` string, date-time, required
  - `expire_at` string, date-time, nullable
  - `id` string, uuid, required
  - `key_prefix` string, required: The first characters of the key's value, so it can be told apart from another in a list. The value itself is shown once, when the key is created, and is not recoverable afterwards.
  - `last_used_at` string, date-time, nullable: When this key last authenticated a request, to the minute.
  - `name` string, required
  - `org_id` string, required
  - `scope` 'read' | 'write', required: What a key may do. Two values, not a permission matrix. The thing worth stopping is a write nobody watched: a leaked read key exposes what the dashboard already shows the holder, a leaked write key spends credits and sends mail. A free workspace may only mint ``READ``.
  - `updated_at` string, date-time, required

## Other responses

- `401`: Unauthorized
- `403`: Forbidden
- `404`: The API key was not found.
- `422`: Invalid request made to the API.
- `500`: Internal server error.
- `502`: Bad gateway error.
- `503`: Service unavailable.

---

[API](https://skmtc.dev/getoneprofile/apis/api-reference-oneprofile.md) · [All operations](https://skmtc.dev/getoneprofile/apis/api-reference-oneprofile/llms.txt) · [OpenAPI document](https://skmtc.dev/getoneprofile/apis/api-reference-oneprofile/revisions/4a6bd71e3f02?raw)
