# API Keys

## Create

`$ boltz-api admin:api-keys create`

**post** `/compute/v1/admin/api-keys`

Create a workspace API key

### Parameters

- `--name: string`

  API key name

- `--allowed-ip: optional array of string`

  IP addresses allowed to use this key (IPv4 or IPv6). An empty array (the default) means all IPs are allowed.

- `--expires-in-days: optional number`

  Days until the key expires. Omit for a key that does not expire.

- `--mode: optional "live" or "test"`

  Key mode. Test keys create test-mode resources with synthetic data.

- `--workspace-id: optional string`

  Workspace ID to scope this key to. Omit for default workspace.

### Returns

- `AdminAPIKeyNewResponse: object { key, key_details }`

  - `key: string`

    The full API key. This is only shown once — store it securely.

  - `key_details: object { id, allowed_ips, created_at, 8 more }`

    - `id: string`

      API key ID

    - `allowed_ips: array of string`

      IP addresses allowed to use this key. An empty array means all IPs are allowed.

    - `created_at: string`

    - `expires_at: string`

      When the key expires. Null if the key does not expire.

    - `is_active: boolean`

    - `key_prefix: string`

      First 12 characters of the key

    - `key_type: "workspace"`

      - `"workspace"`

    - `last_used_at: string`

    - `livemode: boolean`

      Whether this is a live API key (false for test keys).

    - `name: string`

      API key name

    - `workspace_id: string`

      Workspace this key is scoped to

### Example

```cli
boltz-api admin:api-keys create \
  --name x
```

## List

`$ boltz-api admin:api-keys list`

**get** `/compute/v1/admin/api-keys`

List API keys

### Parameters

- `--after-id: optional string`

  Return results after this ID

- `--before-id: optional string`

  Return results before this ID

- `--limit: optional number`

  Max items to return

- `--workspace-id: optional string`

  Filter by workspace ID. If not provided, returns keys across all workspaces.

### Returns

- `ListApiKeysResponse: object { data, first_id, has_more, last_id }`

  - `data: array of object { id, allowed_ips, created_at, 8 more }`

    - `id: string`

      API key ID

    - `allowed_ips: array of string`

      IP addresses allowed to use this key. An empty array means all IPs are allowed.

    - `created_at: string`

    - `expires_at: string`

      When the key expires. Null if the key does not expire.

    - `is_active: boolean`

    - `key_prefix: string`

      First 12 characters of the key

    - `key_type: "admin" or "workspace"`

      - `"admin"`

      - `"workspace"`

    - `last_used_at: string`

    - `livemode: boolean`

      Whether this is a live API key (false for test keys).

    - `name: string`

      API key name

    - `workspace_id: string`

      Workspace ID if workspace-scoped

  - `first_id: string`

    ID of the first item. Use as before_id for the previous page.

  - `has_more: boolean`

  - `last_id: string`

    ID of the last item. Use as after_id for the next page.

### Example

```cli
boltz-api admin:api-keys list
```

## Revoke

`$ boltz-api admin:api-keys revoke`

**post** `/compute/v1/admin/api-keys/{api_key_id}/revoke`

Revoke an API key

### Parameters

- `--api-key-id: string`

### Returns

- `AdminAPIKeyRevokeResponse: object { id, allowed_ips, created_at, 8 more }`

  - `id: string`

    API key ID

  - `allowed_ips: array of string`

    IP addresses allowed to use this key. An empty array means all IPs are allowed.

  - `created_at: string`

  - `expires_at: string`

    When the key expires. Null if the key does not expire.

  - `is_active: boolean`

  - `key_prefix: string`

    First 12 characters of the key

  - `key_type: "admin" or "workspace"`

    - `"admin"`

    - `"workspace"`

  - `last_used_at: string`

  - `livemode: boolean`

    Whether this is a live API key (false for test keys).

  - `name: string`

    API key name

  - `workspace_id: string`

    Workspace ID if workspace-scoped

### Example

```cli
boltz-api admin:api-keys revoke \
  --api-key-id api_key_id
```
