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

# Void invoice

> Cancel a finalized invoice while keeping a record of it.

Void an invoice when it needs to be canceled. It remains in your records with the status `voided`. To remove a draft invoice, [delete it instead](https://getlago.com/docs/v2/guide/invoicing/draft-invoices.md#delete-a-draft-invoice).

> [!WARNING]
>
> Voiding cannot be undone. Review any refund or credit amounts before confirming.

## Void an invoice

> [tab] Dashboard
>
> 1. Open **Invoices**.
> 2. Click the invoice’s **ellipsis icon**.
> 3. Select **Void invoice**.
> 4. Choose whether to generate a credit note.
> 5. Review any refund or credit amounts.
> 6. Confirm.

> [tab] API
>
> ```bash Void an invoice theme={"dark"}
> LAGO_URL="https://api.getlago.com"
> API_KEY="__YOUR_API_KEY__"
> INVOICE_ID="__YOUR_INVOICE_ID__"
>
> curl --location --request POST "$LAGO_URL/api/v2/invoices/$INVOICE_ID/void" \
>   --header "Authorization: Bearer $API_KEY"
> ```

## Void and generate a credit note

When voiding an invoice, you can also generate a credit note to refund a payment or give your customer credit for future invoices.

> [!NOTE]
>
> Generating a credit note while voiding requires a premium license. Voiding without a credit note does not.

The request body accepts three optional fields:

| Field | Type | Meaning |
| - | - | - |
| `generate_credit_note` | boolean | Whether to generate credit notes. |
| `refund_amount` | integer, cents | Amount to refund. |
| `credit_amount` | integer, cents | Amount to credit to the customer. |

### Example

This example requests a USD 100 refund and USD 44 in credit for a fully paid USD 144 invoice. The invoice for `contract_example` includes a USD 120 subtotal and 20% tax.

```bash Void with a refund and a credit theme={"dark"}
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
INVOICE_ID="__YOUR_INVOICE_ID__"

curl --location --request POST "$LAGO_URL/api/v2/invoices/$INVOICE_ID/void" \
  --header "Authorization: Bearer $API_KEY" \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "generate_credit_note": true,
    "refund_amount": 10000,
    "credit_amount": 4400
  }'
```

The body is not wrapped in an `invoice` key. The resulting credit note follows the rules in [Credit notes](https://getlago.com/docs/v2/guide/invoicing/credit-notes/overview.md).

## Next steps

> [card] [Credit notes](https://getlago.com/docs/v2/guide/invoicing/credit-notes/overview.md)
>
> Partially correct an invoice instead of voiding it.

> [card] [Draft invoice](https://getlago.com/docs/v2/guide/invoicing/draft-invoices.md)
>
> Delete a draft instead of voiding it.

> [card] [Void an invoice (API)](https://getlago.com/docs/v2/api-reference/invoices/void.md)
>
> Request and response schema.

> [card] [Invoices](https://getlago.com/docs/v2/guide/invoicing/overview.md)
>
> Statuses and available actions.


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