# Update API key

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

Change an API key's name or expiry.

## Parameters

| Name         | In   | Required | Description |
| ------------ | ---- | -------- | ----------- |
| `api_key_id` | path | Yes      | API key ID. |

## Request body

| Field        | Type        | Required | Description |
| ------------ | ----------- | -------- | ----------- |
| `name`       | string      |          |             |
| `expires_at` | string,null |          |             |

## Responses

| Status | Description                                                                                                 |
| ------ | ----------------------------------------------------------------------------------------------------------- |
| 200    | API key updated successfully                                                                                |
| 400    | Bad request                                                                                                 |
| 401    | Unauthorized                                                                                                |
| 403    | Forbidden                                                                                                   |
| 404    | API key not found                                                                                           |
| 500    | Server error                                                                                                |
| 503    | internal: authentication state is temporarily unavailable and the request was not processed; retry shortly. |
