> ## Documentation Index
> Fetch the complete documentation index at: https://developers.clay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# api-keys update

> Rename a Public API key by id.

Rename an API key you own. Find the id with [`clay api-keys list`](/cli/reference/api-keys-list). Only the name can be changed; the secret and scopes are unchanged.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
clay api-keys update <apiKeyId> --name <name>
```

## Arguments

| Argument   | Description                                                 |
| ---------- | ----------------------------------------------------------- |
| `apiKeyId` | API key id, e.g. the `id` returned by `clay api-keys list`. |

## Flags

| Flag            | Description               |
| --------------- | ------------------------- |
| `--name <name>` | New name for the API key. |

## Output

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "ak_abc123",
  "name": "Renamed key",
  "scopes": ["cli:all"],
  "workspaceId": 12345,
  "createdAt": "2026-01-01T00:00:00.000Z",
  "updatedAt": "2026-01-02T00:00:00.000Z"
}
```

| Field         | Type                | Description                               |
| ------------- | ------------------- | ----------------------------------------- |
| `id`          | string              | API key id.                               |
| `name`        | string              | The updated name.                         |
| `scopes`      | string\[]           | Scopes granted to the key.                |
| `workspaceId` | number \| undefined | Workspace the key is scoped to, when set. |
| `createdAt`   | string              | ISO 8601 creation timestamp.              |
| `updatedAt`   | string              | ISO 8601 last-updated timestamp.          |

The secret is never returned by `update` — it is shown only once, at creation.

## Errors

| Code               | Exit | Notes                                          |
| ------------------ | ---- | ---------------------------------------------- |
| `validation_error` | 2    | `--name` is missing or empty.                  |
| `not_found`        | 6    | No API key with that id found.                 |
| `auth_forbidden`   | 3    | You do not have permission to manage API keys. |

## Examples

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
clay api-keys update ak_abc123 --name "Renamed key"
clay api-keys list | jq -r '.data[0].id' | xargs -I{} clay api-keys update {} --name "Renamed key"
```
