# Account, credits and API keys

Show your plan, usage and credits, and manage the team's API keys.

Web version: https://www.svanja.com/docs/cli/account/

These commands show what your team's plan includes, how many credits you have left, and which API keys exist. They pull the same information you see on [Credits and usage](https://app.svanja.com/credits) and the API Keys page in Settings. You can use them in a script that warns you before credits run out, or to revoke a key straight from the terminal.

To read account and credit details, your key needs the Account and Credits areas, which both Full access and Read-only keys include. To manage keys, you need the API keys area. See [Plans, credits and prices](https://www.svanja.com/docs/credits-and-prices/) for how plans and credits work.

Running `svanja account` or `svanja credits` on its own only prints the help text. Use a subcommand to check your account or credits:

```bash
svanja account show            # the plan and the team
svanja account entitlements    # what the plan includes
svanja account usage           # what's used
svanja credits balance
svanja credits transactions --all
```

Without `--all`, `svanja credits transactions` only returns the first page. You can also filter transactions by type and date.

Use `svanja api-key` to list your team's keys, change their name or access, or revoke them. You still create new keys in the app, where you see each key once. See [The REST API](https://www.svanja.com/docs/api/).

## Commands

### svanja account entitlements

Show current entitlement information.

This command calls GET /account/entitlements on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja account entitlements [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--query` | query parameter as key=value (repeatable) |

```bash
svanja account entitlements --json
svanja account entitlements --plain
svanja account entitlements --jq .
svanja account entitlements --template '{{.}}'
svanja account entitlements --json --include-meta
```

### svanja account show

Show account details.

This command calls GET /account on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja account show [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--query` | query parameter as key=value (repeatable) |

```bash
svanja account show --json
svanja account show --plain
svanja account show --jq .
svanja account show --template '{{.}}'
svanja account show --json --include-meta
```

### svanja account usage

Show account usage.

This command calls GET /account/usage on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja account usage [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--query` | query parameter as key=value (repeatable) |

```bash
svanja account usage --json
svanja account usage --plain
svanja account usage --jq .
svanja account usage --template '{{.}}'
svanja account usage --json --include-meta
```

### svanja account

Inspect account usage and entitlements.

Use this family to call native Svanja public API operations with the active team API key. The server owns validation, access checks, authorization, receipts and domain-specific behavior; the CLI supplies product identity, explicit arguments, stable output modes and safe local request handling.

```text
svanja account [flags]
```

Works without a key.

```bash
svanja account --help
```

### svanja api-key list

List API keys.

This command calls GET /api-keys on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja api-key list [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--query` | query parameter as key=value (repeatable) |

```bash
svanja api-key list --json
svanja api-key list --plain
svanja api-key list --jq .
svanja api-key list --template '{{.}}'
svanja api-key list --json --include-meta
```

### svanja api-key revoke

Revoke an API key on the server.

This command calls POST /api-keys/{key}/revoke on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

Build the request body with --field key=value, --body '<json>' or --body-file <path>; field flags cannot be combined with body input. Every real mutation sends an idempotency key so a retried request is not applied twice. Pass --idempotency-key <key> to supply your own. Use --dry-run to preview the method, path, query, body fields and idempotency behavior without resolving credentials or contacting the API.

This command is destructive and requires confirmation. Use --force for an explicit noninteractive yes, or --no-prompt to fail instead of prompting.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja api-key revoke <api-key-id> [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--body` | JSON request body (mutually exclusive with --field and --body-file) |
| `--body-file` | read the JSON request body from a file, or - for stdin |
| `--dry-run` | preview the request without resolving credentials or contacting the API |
| `--field` | body field as key=value (repeatable; mutually exclusive with --body and --body-file) |
| `--idempotency-key` | explicit idempotency key (1-255 visible ASCII bytes); generated when omitted |
| `--query` | query parameter as key=value (repeatable) |

```bash
svanja api-key revoke <api-key-id>
```

### svanja api-key show

Show an API key.

This command calls GET /api-keys/{key} on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja api-key show <api-key-id> [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--query` | query parameter as key=value (repeatable) |

```bash
svanja api-key show <api-key-id> --json
svanja api-key show <api-key-id> --plain
svanja api-key show <api-key-id> --jq .
svanja api-key show <api-key-id> --template '{{.}}'
svanja api-key show <api-key-id> --json --include-meta
```

### svanja api-key update

Update API key metadata.

This command calls PATCH /api-keys/{key} on the public Svanja API. The API remains authoritative for validation, access, capabilities, receipts, conflicts and domain-specific failure reasons. Use --query key=value for filters, cursors, pages or operation-specific query fields.

Build the request body with --field key=value, --body '<json>' or --body-file <path>; field flags cannot be combined with body input. Every real mutation sends an idempotency key so a retried request is not applied twice. Pass --idempotency-key <key> to supply your own. Use --dry-run to preview the method, path, query, body fields and idempotency behavior without resolving credentials or contacting the API.

Output modes: default human detail, --plain copy-safe output, --json stable JSON, and --jq/--template transforms over the documented JSON value.

--include-meta adds safe transport context under meta when --json, --jq or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged. It cannot be combined with --dry-run.

```text
svanja api-key update <api-key-id> [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--body` | JSON request body (mutually exclusive with --field and --body-file) |
| `--body-file` | read the JSON request body from a file, or - for stdin |
| `--dry-run` | preview the request without resolving credentials or contacting the API |
| `--field` | body field as key=value (repeatable; mutually exclusive with --body and --body-file) |
| `--idempotency-key` | explicit idempotency key (1-255 visible ASCII bytes); generated when omitted |
| `--query` | query parameter as key=value (repeatable) |

```bash
svanja api-key update <api-key-id> --field name="Invoice export script"
```

### svanja api-key

Inspect and revoke API keys.

Use this family to call native Svanja public API operations with the active team API key. The server owns validation, access checks, authorization, receipts and domain-specific behavior; the CLI supplies product identity, explicit arguments, stable output modes and safe local request handling.

```text
svanja api-key [flags]
```

Works without a key.

```bash
svanja api-key --help
```

### svanja credits balance

Show the team's credit balance.

This authenticated read is team-level: the balance is not narrowed by a selected-project key scope.

JSON output is one object with an integer balance, a subscription object (plan, status) or null, and last_credit_update as the API timestamp string or null.

--include-meta adds safe transport context under meta when --json, --jq, or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged.

Output modes: default human detail, --plain labeled tab-separated fields, --json stable JSON, and --jq/--template transforms over the documented JSON value.

```text
svanja credits balance [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

```bash
svanja credits balance
svanja credits balance --json
svanja credits balance --json --include-meta
svanja credits balance --jq .balance
svanja credits balance --template '{{.balance}}'
```

### svanja credits transactions

List credit transactions for the authenticated team.

Credits are team-level: the transaction history is not narrowed by a selected-project key scope.

Filters are enforced by the API and sent on every page request, including the follow-up requests made by --all and --limit:

```text --type   one of credit_added, credit_spent, debt, adjustment, or other --since  inclusive lower created_at bound, sent as the API created_from parameter --until  inclusive upper created_at bound, sent as the API created_to parameter --sort   created_at (oldest first) or -created_at (newest first) ```

--since and --until take second-precision RFC3339 timestamps with Z or a numeric UTC offset, such as 2026-05-19T10:15:30Z or 2026-05-19T12:15:30+02:00. Bare dates, offset-less values, and fractional seconds are rejected.

Pagination: --limit caps the total rows fetched across pages, --all fetches every page, and --page/--per-page fetch one exact page. With no list-size flag the first API page is fetched using the API default page size.

JSON output is an array of transaction objects with fields id, type, amount, description, and created_at. type is the stable machine field; description is localized display text and must not be parsed for behavior. amount is a signed integer credit unit. Default JSON omits request and pagination metadata.

--include-meta adds safe transport context under meta when --json, --jq, or --template is selected. The ordinary value moves under data; output without --include-meta remains unchanged.

Output modes: default human table, --plain tab-separated rows, --json stable JSON, and --jq/--template transforms over the documented JSON value.

```text
svanja credits transactions [flags]
```

Needs a stored key (svanja login) or SVANJA_API_KEY.

| Flag | What it does |
| --- | --- |
| `--all` | fetch every page |
| `--limit` | maximum total number of items to fetch across pages |
| `--page` | fetch one exact page number |
| `--per-page` | items per page (1-100) for exact page mode |
| `--since` | earliest created_at to include, inclusive RFC3339, sent as the API created_from parameter |
| `--sort` | order by created_at or -created_at |
| `--type` | filter by transaction type (credit_added, credit_spent, debt, adjustment, other) |
| `--until` | latest created_at to include, inclusive RFC3339, sent as the API created_to parameter |

```bash
svanja credits transactions
svanja credits transactions --type credit_spent --since 2026-05-01T00:00:00Z
svanja credits transactions --sort -created_at --limit 250
svanja credits transactions --json
svanja credits transactions --include-meta --jq .meta.pagination.total
svanja credits transactions --jq '.[].amount'
svanja credits transactions --template '{{range .}}{{.id}} {{.amount}}{{"\n"}}{{end}}'
```

### svanja credits

Inspect team credits through the product API.

Balance inspection and filtered transaction history are available as team-level reads.

Credits are a team-level resource rather than Project-scoped. A key with credits read capability reports the whole team's balance and transactions.

```text
svanja credits [flags]
```

Works without a key.

```bash
svanja credits balance
svanja credits transactions
```
