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

# Command reference

> Every lago v2 command group, one page each, with the request on the left and the output on the right.

v2 commands follow one shape:

```bash theme={"dark"}
lago v2 <resource> <action> [identifier...] [flags]
```

Every command answers `--help` with its full flag list. Four rules apply everywhere:

* **Flags are API fields.** A `snake_case` field becomes a `--kebab-case` flag. Nested fields carry their parent as a prefix: `invoice_custom_section.skip_invoice_custom_sections` is `--invoice-custom-section-skip-invoice-custom-sections`.
* **Objects and arrays take JSON.** `--values '[{"key":"region","value":"eu"}]'`.
* **`--input` takes the whole body.** Inline JSON or `@file.json`, sent as written. Include the resource wrapper, such as `{"contract": {...}}`. Other body flags are ignored when `--input` is set.
* **Identifiers are positional**, and nested resources take their parent first. Passing the wrong kind returns a not-found error that names the missing identifier, exit code 4.

| Resource | Positional identifiers |
| - | - |
| billable metrics, product categories, products, rate cards, catalog plans, taxes, billing entities | `code` |
| product filters | `product_code`, then the filter `code` |
| rate card rates | `rate_card_code`, then the rate `code` |
| plan applied rate cards | `plan_code`, then the applied rate card `code` |
| plan rate phases | `plan_code`, `applied_rate_card_code`, then the phase `code` |
| contracts | `external_id` (yours) |
| contract applied rate cards | `contract_external_id`, then the applied rate card `code` |
| contract rate phases | `contract_external_id`, `applied_rate_card_code`, then the phase `code` |
| customers | `external_id` (yours) |
| invoices, credit notes, fees, payments, payment requests, payment receipts, webhook endpoints | `lago_id` (Lago's UUID) |
| API logs | `request_id` |

Organizations take no identifier: `lago v2 organizations get` reads the organization of the API key.

## Resources in v2

`lago v2` covers every operation of the pinned API v2 document: the product catalog (billable metrics, product categories, products, product filters, rate cards and rates), catalog plans with their applied rate cards and rate phases, Contracts with their applied rate cards, rate phases and current usage, plus customers, events, invoices, fees, credit notes, payments, taxes, webhook endpoints, logs, the organization and billing entities. Run `lago --help` for the v1 commands, documented in the [v1 command reference](https://getlago.com/docs/guide/lago-cli/commands/overview.md).

The live API can be ahead of the spec pinned in your CLI release. `lago version` prints the pinned `SPEC_V2_VERSION` and `SPEC_V2_SHA256`. Reach an endpoint newer than your CLI, such as Contract alerts, with [`lago api`](https://getlago.com/docs/v2/guide/lago-cli/commands/helpers).

## Output on these pages

The right column shows what each command prints. Creates and updates print the identifier block by default. Reads print the resource, shown here as abridged `--output json` because that is the form to script against. Response bodies follow the Lago API v2 schema, so the [API reference](https://getlago.com/docs/v2/api-reference/intro.md) documents every field.

The global flags (`--output`, `--query`, `--dry-run`, `--confirm`, `--profile`, `--mode`), exit codes, pagination and safety gates are covered in the [Lago CLI overview](https://getlago.com/docs/v2/guide/lago-cli/overview.md).

## Command groups

> [card] [Setup and diagnostics](https://getlago.com/docs/v2/guide/lago-cli/commands/setup.md)
>
> init, whoami, doctor, version, upgrade, profile, completion

> [card] [Helpers](https://getlago.com/docs/v2/guide/lago-cli/commands/helpers.md)
>
> api, alias, fixtures

> [card] [Catalog as code](https://getlago.com/docs/v2/guide/lago-cli/commands/catalog-as-code.md)
>
> Reconcile the catalog with YAML files.

> [card] [Billable metrics](https://getlago.com/docs/v2/guide/lago-cli/commands/billable-metrics.md)
>
> Define what you meter.

> [card] [Product catalog](https://getlago.com/docs/v2/guide/lago-cli/commands/product-catalog.md)
>
> Product categories, products, product filters.

> [card] [Rate cards](https://getlago.com/docs/v2/guide/lago-cli/commands/rate-cards.md)
>
> Rate cards and their effective-dated rates.

> [card] [Plans](https://getlago.com/docs/v2/guide/lago-cli/commands/plans.md)
>
> Catalog plans, applied rate cards, rate phases.

> [card] [Contracts](https://getlago.com/docs/v2/guide/lago-cli/commands/contracts.md)
>
> Create, publish, override, read usage, end.

> [card] [Customers](https://getlago.com/docs/v2/guide/lago-cli/commands/customers.md)
>
> Customers, their invoices, payments and payment methods.

> [card] [Events](https://getlago.com/docs/v2/guide/lago-cli/commands/events.md)
>
> Send one, stream NDJSON, batch, list.

> [card] [Invoices and fees](https://getlago.com/docs/v2/guide/lago-cli/commands/invoices.md)
>
> List, finalize, void, download, payment URL, fees.

> [card] [Credit notes](https://getlago.com/docs/v2/guide/lago-cli/commands/credit-notes.md)
>
> Estimate, issue, void, metadata.

> [card] [Payments](https://getlago.com/docs/v2/guide/lago-cli/commands/payments.md)
>
> Payments, payment requests, receipts.

> [card] [Taxes](https://getlago.com/docs/v2/guide/lago-cli/commands/taxes.md)
>
> Tax rates.

> [card] [Webhooks](https://getlago.com/docs/v2/guide/lago-cli/commands/webhooks.md)
>
> Webhook endpoints and signing keys.

> [card] [Logs](https://getlago.com/docs/v2/guide/lago-cli/commands/logs.md)
>
> Activity, API and security logs.

> [card] [Organization](https://getlago.com/docs/v2/guide/lago-cli/commands/organization.md)
>
> Organization settings and billing entities.

```bash Shape theme={"dark"}
lago v2 products create --code gpu_hours --name "GPU hours" \
  --product-type metered --billable-metric-code gpu_hours
lago v2 products get gpu_hours
lago v2 products get gpu_hours --query 'product.product_type'
lago v2 products list --limit 5
lago v2 products delete gpu_hours --confirm gpu_hours
```

```bash Nested identifiers theme={"dark"}
lago v2 product-filters get gpu_hours a100
lago v2 rate-card-rates list gpu_hours_usd
lago v2 contract-rate-phases list acme_main gpu_hours_usd
```

```text Create theme={"dark"}
LAGO_ID  1a901a90-1a90-1a90-1a90-1a901a901a90
CODE     gpu_hours
NAME     GPU hours
```

```json Get theme={"dark"}
{
  "product": {
    "billable_metric_code": "gpu_hours",
    "code": "gpu_hours",
    "created_at": "2026-12-01T09:30:00Z",
    "deleted_at": null,
    "description": null,
    "invoice_display_name": null,
    "lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
    "name": "GPU hours",
    "product_category_code": null,
    "product_type": "metered",
    "updated_at": "2026-12-01T09:30:00Z"
  }
}
```

```json Query theme={"dark"}
"metered"
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.