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

# Void an Invoice

> Void an invoice, removing it from accounting and marking it as voided.

Voiding an invoice cancels it entirely, removing revenue and receivables from the ledger and marking the invoice as voided.

Voiding can only be performed on an invoice before payments have been collected or write-offs have been made.

If an invoice was created by mistake and included payments, these should be deleted instead of voiding.

### Path Parameters

<ParamField path="business_id" type="string">
  Id of the [Business](/api-reference/business/business) the invoice is associated with.
</ParamField>

<ParamField path="invoice_id" required="true" type="string">
  Id of the [Invoice](/api-reference/invoice/invoice) the write-off is applied to.
</ParamField>

### Response

Returns the updated [Invoice Object](/api-reference/invoice/invoice)

<RequestExample>
  ```bash Request theme={null}
  curl -X POST https://sandbox.layerfi.com/v1/businesses/{business_id}/invoices/${invoice_id}/void \
    -H "Authorization: Bearer <access_token>" \
    -H "Content-Type: application/json" \
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "data": {
      "type": "Invoice",
      "id": "6d0c298f-3e4e-4538-9a71-1d5359c22f71",
      "business_id": "83d8fb80-31ee-4d57-b684-44b4aaa5e01f",
      "external_id": "019234",
      "status": "VOID",
      "sent_at": "2024-04-02T09:02:00Z",
      "due_at": "2023-04-02T09:02:00Z",
      "paid_at": null,
      "voided_at": null,
      "invoice_number": "1",
      "recipient_name": "John Doe",
      "line_items": [
        {
          "id": "e6a491dd-9c22-4403-a54f-32d741a7ec67",
          "invoice_id": "6d0c298f-3e4e-4538-9a71-1d5359c22f71",
          "account_identifier": null,
          "description": null,
          "product": "Cleaner Solution Pro",
          "unit_price": 1299,
          "quantity": "2.00",
          "subtotal": 2598,
          "discount_amount": 0,
          "sales_taxes_total": 218,
          "sales_taxes": [
            {
              "tax_account": {
                "type": "Tax_Name",
                "name": "CALIFORNIA_VAT"
              },
              "amount": 218
            }
          ],
          "total_amount": 2816,
          "transaction_tags": [
            {
              "id": "b2c3d4e5-f6a7-8901-bcde-f1234567890a",
              "key": "product-category",
              "value": "cleaning-supplies",
              "dimension_display_name": "Product Category",
              "value_display_name": "Cleaning Supplies",
              "dimension_id": "e3f4a5b6-c7d8-9012-cdef-123456789012",
              "definition_id": "f4a5b6c7-d8e9-0123-def1-234567890123",
              "created_at": "2024-02-27T02:16:40.389772Z",
              "updated_at": "2024-02-27T02:16:40.389772Z",
              "deleted_at": null,
              "archived_at": null
            }
          ]
        },
        {
          "id": "44f06385-3ef5-4517-8095-eeedaf2054ab",
          "invoice_id": "6d0c298f-3e4e-4538-9a71-1d5359c22f71",
          "account_identifier": null,
          "description": null,
          "product": "Full drain cleaning service",
          "unit_price": 25000,
          "quantity": "1.00",
          "subtotal": 25000,
          "discount_amount": 0,
          "sales_taxes_total": 0,
          "total_amount": 25000,
          "transaction_tags": []
        }
      ],
      "subtotal": 27598,
      "additional_discount": 250,
      "additional_sales_taxes_total": 0,
      "tips": 0,
      "tips_account": null,
      "total_amount": 27566,
      "outstanding_balance": 27566,
      "payment_allocations": [],
      "imported_at": "2024-04-19T02:23:59.902537Z",
      "updated_at": null,
      "transaction_tags": [
        {
          "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
          "key": "department",
          "value": "sales",
          "dimension_display_name": "Department",
          "value_display_name": "Sales Team",
          "dimension_id": "d1e2f3a4-b5c6-7890-abcd-ef1234567890",
          "definition_id": "f1e2d3c4-b5a6-7890-abcd-ef1234567890",
          "created_at": "2024-02-27T02:16:40.389772Z",
          "updated_at": "2024-02-27T02:16:40.389772Z",
          "deleted_at": null,
          "archived_at": null
        }
      ]
    }
  }
  ```

  ```json 400 theme={null}
  {
    "errors": [
      {
        "type": "Invalid State",
        "description": "Cannot void invoice with payments. Delete the payments & invoice if payments were made in error."
      }
    ]
  }
  ```

  ```json 400 theme={null}
  {
    "errors": [
      {
        "type": "Invalid State",
        "description": "Cannot void invoice with write offs. Delete the invoice if write offs were made in error."
      }
    ]
  }
  ```
</ResponseExample>
