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

# Invoices and fees

> List, finalize, void and download Contract invoices, and inspect fees with lago v2 invoices and lago v2 fees.

| Command | Description |
| - | - |
| `v2 invoices list` | Contract invoices, and invoices containing Contract fees, newest issuing date first. |
| `v2 invoices get <lago_id>` | Retrieve an invoice. `--expands` takes `fees`, `applied_taxes`, `customer`, `contracts`, `applied_invoice_custom_sections`, `error_details`. |
| `v2 invoices update <lago_id>` | Change `payment_status` only. Also `patch`. |
| `v2 invoices refresh <lago_id>` | Recalculate a draft invoice's fees, taxes and totals. |
| `v2 invoices finalize <lago_id>` | Refresh and finalize a draft invoice. Confirmation-gated. |
| `v2 invoices void <lago_id>` | Void an eligible invoice. Confirmation-gated. |
| `v2 invoices delete <lago_id>` | Delete a draft invoice not synced to an integration. Confirmation-gated. |
| `v2 invoices download-pdf <lago_id>` | Return the invoice when its PDF exists, or queue generation (202, empty body). Finalized invoices only. |
| `v2 invoices payment-url <lago_id>` | Create a payment URL with the customer's payment provider. |
| `v2 invoices retry-payment <lago_id>` | Retry collection with the selected or default payment method. Confirmation-gated. |
| `v2 invoices retry-taxes <lago_id>` | Retry failed tax processing. Confirmation-gated. |
| `v2 invoices resend-email <lago_id>` | Queue the invoice email. `--to`, `--cc`, `--bcc`. |
| `v2 invoices lose-dispute <lago_id>` | Mark the payment dispute as lost. |
| `v2 fees list` | List fees. Filters include `--external-contract-id`, `--rate-card-code`, `--product-code`, `--lago-invoice-id`, `--event-transaction-id`. |
| `v2 fees get <lago_id>` | Retrieve a fee. |
| `v2 fees update <lago_id>` | Change `payment_status` of an uninvoiced fee. Also `patch`. |
| `v2 fees delete <lago_id>` | Delete an uninvoiced fee. Confirmation-gated. |

There is no v2 invoice create or preview command. Contracts generate their invoices on their billing timeline.

## list filters

`--status`, `--payment-status`, `--invoice-type`, `--external-customer-id`, `--currency`, `--billing-entity-codes`, `--issuing-date-from`, `--issuing-date-to`, `--amount-from`, `--amount-to`, `--payment-overdue`, `--payment-dispute-lost`, `--partially-paid`, `--purchase-order-number` and `--search-term`.

## finalize and void

`finalize` works on drafts only: a non-draft invoice returns 404. If finalizing starts fetching provider taxes, the invoice comes back `pending` and finalizes once taxes apply.

`void` takes `--generate-credit-note`, `--credit-amount` and `--refund-amount` (in cents). Generating a credit note on void requires a premium license.

Each fee carries `product_code`, `rate_card_code`, `external_contract_id`, `units` and its billing window, so you can trace an invoice line back to its pricing. See [invoices](https://getlago.com/docs/v2/guide/invoicing/overview.md) and [fees](https://getlago.com/docs/v2/guide/invoicing/fees.md).

```bash list theme={"dark"}
lago v2 invoices list --external-customer-id acme --status finalized
lago v2 invoices list --payment-overdue true --all --output json \
  | jq -r '.invoices[] | [.number, .total_amount_cents] | @tsv'
```

```bash get with fees theme={"dark"}
lago v2 invoices get 1a901a90-1a90-1a90-1a90-1a901a901a90 --expands fees \
  --query 'invoice.fees[].{rate_card: rate_card_code, units: units, amount: amount_cents}'
```

```bash drafts theme={"dark"}
lago v2 invoices refresh 1a901a90-1a90-1a90-1a90-1a901a901a90
lago v2 invoices finalize 1a901a90-1a90-1a90-1a90-1a901a901a90 \
  --confirm 1a901a90-1a90-1a90-1a90-1a901a901a90
```

```bash void theme={"dark"}
lago v2 invoices void 1a901a90-1a90-1a90-1a90-1a901a901a90 \
  --confirm 1a901a90-1a90-1a90-1a90-1a901a901a90
```

```bash collect theme={"dark"}
lago v2 invoices payment-url 1a901a90-1a90-1a90-1a90-1a901a901a90
lago v2 invoices download-pdf 1a901a90-1a90-1a90-1a90-1a901a901a90
```

```bash fees theme={"dark"}
lago v2 fees list --external-contract-id acme_main --rate-card-code api_calls_usd
```

```text list theme={"dark"}
LAGO_ID                               NUMBER            STATUS     PAYMENT_STATUS  CURRENCY  TOTAL_AMOUNT_CENTS
1a901a90-1a90-1a90-1a90-1a901a901a90  ACM-2027-01-001   finalized  pending         USD       12000
```

```text finalize theme={"dark"}
LAGO_ID  1a901a90-1a90-1a90-1a90-1a901a901a90
STATUS   finalized
```

```text payment-url theme={"dark"}
EXTERNAL_CUSTOMER_ID  acme
LAGO_CUSTOMER_ID      1a901a90-1a90-1a90-1a90-1a901a901a90
LAGO_INVOICE_ID       1a901a90-1a90-1a90-1a90-1a901a901a90
PAYMENT_PROVIDER      stripe
PAYMENT_URL           https://checkout.stripe.com/c/pay/cs_test_example
```


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