# createVendorInvoice

mutation · in the family [Purchasing](/reference/purchasing/)

## What it does

Create a new vendor’s invoice — what a supplier billed you against a purchase at your organization.

CREATE a VendorInvoice: the parent PO past-issue (cancelled/draft/pending refuse CONFLICT/REF_STATE); the billing OrgVendor (defaulted to the PO vendor) ACTIVE; every Money in the PO snapshot currency; at-least-one-of matchLines/actualComponents (the Contact substance stance); each match line names an EXISTING PO line. The (invoiceOrgVendor × normalized invoice number) UNIQ pair mints IN the create transaction — a live (draft or captured) holder refuses CONFLICT/IDENTITY_TAKEN naming it (the double-pay gate); a cancelled holder is taken over.

## Who may call it

Capability area: **Purchasing** — Purchase orders, returns to vendors, vendor invoices and supplier records.

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

## Arguments

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `input` | [CreateVendorInvoiceInput](/types/CreateVendorInvoiceInput/) `CreateVendorInvoiceInput!` | yes | No further notes. |

## Returns

[VendorInvoice](/types/VendorInvoice/) `VendorInvoice!` — A captured vendor bill: the 3-way match and the landed-cost TRUE-UP run from it at capture. NOT a payables subledger. Parent = the PO (the match is per-PO; N invoices per PO are legal — partial-shipment invoicing); invoiceOrgVendorId MAY differ from the PO vendor: ONE construct covers merchandise invoices (match lines) AND cost bills (landed ACTUAL components) — either or both, never neither. CAPTURE stamps matchStatus matched|flagged at tolerance ZERO (price/qty variance FLAGS, never blocks — the flag IS the approval queue until) and posts the landed true-up (actuals vs the receipts NOT-yet-trued estimates per component type -> cost_true_up value-only movements re-weighting each touched book at its CURRENT cost-bearing quantity; the sold-share stays a reports-only fact — the precedent). The (invoiceOrgVendor x normalized invoice number) UNIQ pair is the double-pay gate (CONFLICT/IDENTITY_TAKEN naming the holder; a cancelled holder is taken over). captured is the immutable fact (corrections are compensating entries, never un-capture); cancelled is the doomed terminal (lists filter it).

## Example request

```graphql
mutation ExampleCreateVendorInvoice($input: CreateVendorInvoiceInput!) {
  createVendorInvoice(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    invoiceOrgVendorId
    invoiceNumber
    invoiceDate
    notes
    matchStatus
  }
}
```

Variables:

```json
{
  "input": {
    "caption": "Blue jeans",
    "purchaseOrderId": "01900000-0000-7000-8000-54a5b8570000",
    "invoiceNumber": "<invoice number>",
    "invoiceDate": "2027-01-31"
  }
}
```

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

## Example response

```json
{
  "data": {
    "createVendorInvoice": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "VI-EXMP-0000-000F",
      "type": "VendorInvoice",
      "caption": "Blue jeans",
      "status": "draft",
      "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",
      "invoiceOrgVendorId": "01900000-0000-7000-8000-38bdd2a10000",
      "invoiceNumber": "<invoice number>",
      "invoiceDate": "2027-01-31",
      "notes": "Restock before the weekend.",
      "matchStatus": "matched"
    }
  },
  "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/))

## Used in

- [Record and match a supplier’s invoice](/use-cases/record-a-supplier-invoice/)
