CosmicAC CLI commands
Api Keys
Create, list, update, and revoke API keys. Uses the v1 API endpoints on the app node.
Create, list, update, and revoke API keys. Uses the v1 API endpoints on the app node.
Command
cosmicac api-keys <subcommand> [options]Subcommands
| Subcommand | Description |
|---|---|
| create | Create an API key |
| get | Get API key details |
| list | List API keys |
| revoke | Revoke an API key |
| update | Update an API key |
| usage | Get API key usage |
api-keys create
Create a new API key. The full key value is only returned once at creation time.
Usage
cosmicac api-keys create <name> [options]Arguments
| Argument | Required | Description |
|---|---|---|
name | Yes | Display name for the API key |
Options
| Option | Description |
|---|---|
--expiry-at | Unix timestamp when the key expires |
api-keys get
Retrieve details for a single API key by ID.
Usage
cosmicac api-keys get <id>Arguments
| Argument | Required | Description |
|---|---|---|
id | Yes | API key ID |
api-keys list
List API keys owned by the authenticated user.
Usage
cosmicac api-keys list [options]Options
| Option | Description |
|---|---|
--page | Page number (default 1) |
--page-size | Results per page, 1-100 (default 20) |
--status | Filter by status: active, revoked, or all (default all) |
--sort-by | Sort field: created_at, updated_at, name, or last_used_at |
--sort-order | Sort direction: asc or desc (default desc) |
--include-total | Include total count in response metadata |
api-keys revoke
Revoke an API key. Revoked keys cannot be used for authentication but usage history is preserved. Prompts for confirmation unless --yes is passed.
Usage
cosmicac api-keys revoke <id> [options]Arguments
| Argument | Required | Description |
|---|---|---|
id | Yes | API key ID |
Options
| Option | Description |
|---|---|
--yes | Skip confirmation prompt |
api-keys update
Rename an active API key.
Usage
cosmicac api-keys update <id> [options]Arguments
| Argument | Required | Description |
|---|---|---|
id | Yes | API key ID |
Options
| Option | Description |
|---|---|
--name | New display name |
api-keys usage
Retrieve token and request usage statistics for one or more API keys.
Usage
cosmicac api-keys usage [options]Options
| Option | Description |
|---|---|
--api-key-id | Comma-separated API key IDs (defaults to all active keys) |
--ts-start | Start timestamp in milliseconds |
--ts-end | End timestamp in milliseconds |
--granularity | Time bucket size: hour, day, week, or month (default day) |
--page | Page number for snapshot pagination |
--page-size | Results per page (default 50, max 200) |
--sort-by | Sort field: timestamp, tokens_in, tokens_out, or requests |
--sort-order | Sort direction: asc or desc |
--include-total | Include total count in metadata |