> ## 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.

# Helpers

> Raw v2 API access, aliases, and scripted fixtures against /api/v2.

| Command | Description |
| - | - |
| `lago api METHOD PATH` | Authenticated request to any endpoint. A path starting with `/api/v2` targets v2. |
| `lago alias set\|list\|delete` | User-defined command shortcuts, stored in the config file. |
| `lago fixtures run FILE` | Run a YAML scenario with variable capture between steps. Steps can target `/api/v2`. |

`lago seed demo`, `lago docs` and `lago logs tail` are v1 helpers. `seed demo` seeds v1 demo data, `docs` opens v1 API reference pages, and `logs tail` polls the v1 API logs endpoint. For v2 logs, use [`lago v2 api-logs list`](https://getlago.com/docs/v2/guide/lago-cli/commands/logs).

## api

Same profile, redaction, retries and output handling as the generated commands. Use it for v2 endpoints newer than the API v2 document pinned in your CLI. Write the path as it appears in the [v2 API reference](https://getlago.com/docs/v2/api-reference/intro.md), prefixed with `/api/v2`. Without that prefix, the request goes to `/api/v1`.

Destructive v2 paths are confirmation-gated, classified against the v2 operation table. A path the table does not know is gated when its method is `DELETE` or it carries a destructive segment.

| Flag | Description |
| - | - |
| `--data`, `-d` | Body: inline JSON, `@file`, or `-` for stdin. |
| `--header`, `-H` | Extra header. Repeatable. |

## alias

An alias expands in place, so any flags after it pass through. An alias can expand to a `v2` command.

## fixtures

`fixtures run` executes ordered API steps from YAML: `${var}` interpolation, and `capture` to lift a value from one response into the next. Prefix a step's `path` with `/api/v2` to target v2. Give events a `transaction_id` and a `timestamp` so a re-run does not double count. `--dry-run` prints every request and sends none. Destructive steps are listed before the run and gated like `lago api`.

```bash api theme={"dark"}
lago api GET '/api/v2/products?limit=5'
lago api GET '/api/v2/rate_cards/api_calls_usd?expands[]=rates'
lago api POST /api/v2/events --data @event.json
lago api GET /api/v2/contracts/acme_main/alerts    # newer than the pinned spec
```

```bash alias theme={"dark"}
lago alias set cards "v2 rate-cards"
lago alias list
lago cards list --limit 3     # expands to: lago v2 rate-cards list --limit 3
lago alias delete cards
```

```bash fixtures theme={"dark"}
lago fixtures run catalog.yaml --dry-run
lago fixtures run catalog.yaml --var prefix=qa
```

```json api (dry run) theme={"dark"}
{
  "body": {
    "event": {
      "code": "api_calls",
      "external_contract_id": "acme_main",
      "transaction_id": "api_call_0001"
    }
  },
  "headers": {
    "Accept": ["application/json"],
    "Authorization": ["Bearer [REDACTED]"],
    "Content-Type": ["application/json"],
    "User-Agent": ["lago-cli/1.3.0"]
  },
  "method": "POST",
  "url": "https://api.getlago.com/api/v2/events"
}
```

```yaml catalog.yaml theme={"dark"}
version: 1
name: v2-catalog
vars:
  prefix: demo
steps:
  - id: category
    method: POST
    path: /api/v2/product_categories
    body:
      product_category:
        name: Demo services
        code: ${prefix}_services
    capture:
      category_code: product_category.code
  - id: product
    method: POST
    path: /api/v2/products
    body:
      product:
        name: Demo platform fee
        code: ${prefix}_platform
        product_type: fixed
        product_category_code: ${category_code}
```

```text fixtures (dry run) theme={"dark"}
fixture: category (POST /api/v2/product_categories)
fixture: product (POST /api/v2/products)
DRY_RUN    true
FIXTURE    v2-catalog
STEPS      2 items
VARIABLES  category_code=<dry-run:category.product_category.code> prefix=demo
```


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