# voidInvoice

mutation · in the family [Invoice](/reference/invoice/)

## What it does

Void an invoice — the billing document of a sale — cancel it as if it should not have happened, keeping the paper trail.

Void an issued Invoice. The order's invoicedQty rollups UN-STAMP in THE transaction and the invoiceIds slot is REMOVED (the remainder becomes re-invoiceable and the slot re-opens; the surviving invoices' attribution re-flows); an invoice carrying non-voided CreditNotes/DebitNotes refuses CONFLICT/REFERENCED (void the notes first). Requires the unrestricted capability + the record's CURRENT revision. TERMINAL doomed-class — lists filter it.

## Careful

Voiding is permanent and always auditable.

## Who may call it

Capability area: **Refunds and payment corrections** — Refunds, corrective notes and voiding invoices.

- Owner
- Manager
- Associate Manager
- An API key whose scope allows `api:voidInvoice`

## Arguments

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `id` | [ID](/types/#scalars) `ID!` | yes | The id of the record. |
| `revision` | [ID](/types/#scalars) `ID!` | yes | The revision id you read on the record; the change is refused if an edit landed in the meantime. |
| `reason` | [String](/types/#scalars) | no | No further notes. |

## Returns

[Invoice](/types/Invoice/) `Invoice!` — A sales Invoice — the billing/revenue-recognition document generated from an Order: an IMMUTABLE line snapshot at issue (captured prices/discounts/tax COPY, telescoping-prorated exactly for the 1..N partial model — a full invoicing sums to the order figures EXACTLY). One order → one-or-many invoices. Born issued by the bespoke issueInvoice op; corrections are NEW CreditNote/DebitNote documents, NEVER an edit — no update surface exists. The GAAP recognition trail is reports-only; the three rollup vectors are ANIMATED derived read-models.

## Example request

```graphql
mutation ExampleVoidInvoice($id: ID!, $revision: ID!, $reason: String) {
  voidInvoice(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    orderId
    organizationId
    currency
    taxMode
    taxJurisdictionId
    paymentState
    fulfillmentState
    recognitionState
    subtotalMinor
    discountTotalMinor
    taxTotalMinor
    totalMinor
  }
}
```

Variables:

```json
{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "reason": "Correcting a miscount."
}
```

Send it with the envelope naming the version: `"extensions": {"at": {"version": {"name":"genesis","number":0}}}`.

## Example response

```json
{
  "data": {
    "voidInvoice": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "IN-EXMP-0000-000F",
      "type": "Invoice",
      "caption": "Blue jeans",
      "status": "issued",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "orderId": "01900000-0000-7000-8000-f6d8263a0000",
      "organizationId": "01900000-0000-7000-8000-44b781470000",
      "currency": "USD",
      "taxMode": "exclusive",
      "taxJurisdictionId": "01900000-0000-7000-8000-3a64e3820000",
      "paymentState": "<payment state>",
      "fulfillmentState": "<fulfillment state>",
      "recognitionState": "<recognition state>",
      "subtotalMinor": 1,
      "discountTotalMinor": 1,
      "taxTotalMinor": 1,
      "totalMinor": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```

## Errors this call can answer

- `VALIDATION/INVALID` — Something in the request is not valid. ([VALIDATION](/errors/VALIDATION/))
- `AUTHN/REQUIRED` — Sign in to do this. ([AUTHN](/errors/AUTHN/))
- `AUTHZ/FORBIDDEN` — Your role does not allow this action. ([AUTHZ](/errors/AUTHZ/))
- `RATE_LIMIT/THROTTLED` — Too many requests in a short time. ([RATE_LIMIT](/errors/RATE_LIMIT/))
- `NOT_FOUND/*` — That record could not be found. ([NOT_FOUND](/errors/NOT_FOUND/))
- `CONFLICT/*` — The record’s state, or a change made in the meantime, does not allow this; the codes are on the CONFLICT page. ([CONFLICT](/errors/CONFLICT/))
- `VALIDATION/VERSION_REQUIRED` — The request did not say which app version it came from. ([VALIDATION](/errors/VALIDATION/))
