# List API keys

URL: https://heaven.dev/docs/reference/api-keys/view
Updated: 2026-11-21

List your active API keys, permissions and resource scopes. Use `all: true` to include expired and revoked keys.

`GET /v1/account/api-key/`

## Parameters

- `all` (boolean): Include expired and revoked keys. Defaults to active keys only.

## Returns

- `data` (object, always present): API key metadata.
  - `api_keys` (object[] | null, always present): Key metadata, permissions and lifetime.
    - `items` (object): An API key's identity, permissions and lifetime.
      - `cmds` (string[] | null, always present): Permitted commands, subject to your permissions. `*` permits all commands for a sign-in key.
      - `computer_names` (map<string, string>): Names of the Computers its scope names, by ID, those its organization still has. May be omitted.
      - `created_at` (string (date-time), always present): When the key was created.
      - `expires_at` (string (date-time) | null, always present): When the key expires, or null if it has no expiry.
      - `id` (string, always present): Key ID for editing, rotation or revocation.
      - `label` (string, always present): User-assigned label.
      - `last_used_at` (string (date-time) | null, always present): Last recorded use, or null if no use has been recorded.
      - `organization` (string): Organization the key acts in. Sign-in keys can omit this to select an organization per request. May be omitted.
      - `previous_secret_expires_at` (string (date-time)): Expiry of the replaced secret, included while it remains accepted. May be omitted.
      - `revoked_at` (string (date-time) | null, always present): When the key was revoked, or null if it has not been revoked.
      - `rotated_at` (string (date-time) | null, always present): When its secret was last rotated, or null if it has not been rotated.
      - `scope` (object): Resource restrictions in addition to your permissions. An absent scope adds no restriction. May be omitted.
        - `computers` (string[]): Computer IDs included in the key's scope. May be omitted.
        - `pools` (string[]): Pool IDs included in the key's scope. May be omitted.
        - `tags` (string[]): Tags selecting Computers the key can reach. May be omitted.
      - `token` (string): Newly issued secret, returned only on creation or rotation. May be omitted.

## Errors

Each code is explained in full at https://heaven.dev/docs/reference/errors.

| Code | Status | What happened |
|---|---:|---|
| `invalid` | 400 | An input is missing or invalid. |
| `unauthenticated` | 401 | The credential is missing, invalid, expired or revoked. |
| `denied` | 403 | The caller lacks permission for this action. |
| `not_found` | 404 | The resource is absent or inaccessible to this caller. |
| `conflict` | 409 | The request conflicts with the current resource state or an earlier request. |
| `over_capacity` | 409 | The request exceeds a resource or credential allowance. |
| `access_list_full` | 409 | The change would exceed the access-list allowance. |
| `rate_limited` | 429 | The caller's request rate exceeds its limit. |
| `busy` | 429 | Too much work is in progress to accept this request. |
| `unknown` | 503 | The outcome is unconfirmed; a change may have happened. |
| `unavailable` | 503 | The service or requested feature is unavailable. |

## Notes

- API key permission: `api-key view`.

## Examples

```sh tab="heaven CLI"
heaven api-key view [--all]
```

```sh tab="SSH"
ssh cli@heaven.dev api-key view [--all]
```

```sh tab="cURL"
curl https://heaven.dev/v1/account/api-key/ \
  -H "Authorization: Bearer $HEAVEN_API_KEY"
```

```json tab="MCP"
{ "tool": "api-key_view",
  "arguments": {  } }
```

Response:

```json title="Response excerpt"
{
  "version": 1,
  "data": {
    "api_keys": []
  }
}
```
