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

# key

> Create, list, and revoke API keys.

API keys let you authenticate programmatically — for CI/CD pipelines, automation scripts, or AI agents. Each key is scoped to a workspace and can be full-access or read-only.

## moss key list

List API keys for the current workspace. Requires owner role.

```bash theme={null}
moss key list
```

| Option           | Required | Description    |
| ---------------- | -------- | -------------- |
| `--page <n>`     | No       | Page number    |
| `--per-page <n>` | No       | Items per page |

<Note>
  API key values are only shown once at creation time. The list shows key metadata (name, scope, prefix) but not the full key.
</Note>

## moss key create

Create a new API key. Requires owner role.

```bash theme={null}
moss key create --name "ci-deploy" --scope full
```

| Option            | Required | Description                            |
| ----------------- | -------- | -------------------------------------- |
| `--name <name>`   | Yes      | Human-readable name for the key        |
| `--scope <scope>` | No       | Scope: `full` (default) or `read_only` |

The full API key is displayed once after creation. Store it securely — it cannot be retrieved later.

```bash theme={null}
moss key create --name "ci-deploy" --json
```

```json theme={null}
{
  "data": {
    "id": "key_abc123",
    "name": "ci-deploy",
    "key": "moss_k_abc123...",
    "scope": "full",
    "created_at": "2026-02-08T12:00:00Z"
  }
}
```

## moss key revoke

Revoke an API key. Requires owner role. This immediately invalidates the key.

```bash theme={null}
moss key revoke --id key_abc123 --confirm
```

| Option      | Required | Description                                              |
| ----------- | -------- | -------------------------------------------------------- |
| `--id <id>` | Yes      | Key ID                                                   |
| `--confirm` | Yes      | Confirm revocation (required for destructive operations) |

<Warning>
  Revoking a key immediately invalidates it. Any automation using this key will stop working.
</Warning>
