> For the complete documentation index, see [llms.txt](https://docs.nebulablock.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nebulablock.com/api-reference/platform-api/list-api-keys/update-api-key.md).

# Update API Key

Change an API key's description, or disable and re-enable it.

Change an API key's description, or disable and re-enable it.

> **Important:** Use the [API Keys](https://console.nebulablock.com/apiKeys) page in the console to rename, disable or re-enable a key. This endpoint is documented here for completeness, but it is not currently a reliable way to do it — see [Known issues](#known-issues).

## HTTP Request

`PUT` `{API_URL}/keys/{key_id}`

where `API_URL = https://api.nebulablock.com/api/v1`.

## Path Parameters

| Parameter | Requirement | Type      | Description                                                                           |
| --------- | ----------- | --------- | ------------------------------------------------------------------------------------- |
| `key_id`  | Required    | `integer` | The ID of the key, from [List API Keys](/api-reference/platform-api/list-api-keys.md) |

## Body Parameters

At least one of `description` or `status` must be present, otherwise the request fails with `400`.

| Parameter     | Requirement | Type      | Description                              |
| ------------- | ----------- | --------- | ---------------------------------------- |
| `description` | Optional    | `string`  | A new description for the key            |
| `status`      | Optional    | `integer` | `1` to enable the key, `0` to disable it |

> **Note:** Disabling a key stops it authenticating immediately, and re-enabling restores it. The [API Keys](https://console.nebulablock.com/apiKeys) page in the console is the most reliable way to toggle a key. Keys cannot be regenerated in place — create a new key and delete the old one instead.

## Response Attributes

#### data `dict`

The updated key: `id`, `key`, `name`, `description`, `status`, and `created_at`.

#### status `string`

`success` or `failed`.

#### message `string`

A description of the result.

## Example

#### Request

```bash
curl -X PUT '{API_URL}/keys/5' \
-H 'Authorization: Bearer {TOKEN}' \
-H 'Content-Type: application/json' \
-d '{"description": "Key used by the production service"}'
```

## Known issues

Two problems in the current implementation make this endpoint unreliable. Prefer the console until they are resolved:

* **Disabling does not take effect.** `status: 0` is treated as absent, so the request is accepted but the key keeps authenticating. Only `status: 1` is acted on.
* **A successful update can still return `500`.** The update is committed, then the response is built from a value the service does not return, so the call fails after the change has already been written. Treat a `500` here as "possibly applied" and re-read the key with [List API Keys](/api-reference/platform-api/list-api-keys.md) rather than retrying blindly.

## See also

* [List API Keys](/api-reference/platform-api/list-api-keys.md)
* [Delete API Key](/api-reference/platform-api/list-api-keys/delete-api-key.md)
