GraphQL: Invoices

Read invoices with their line items, totals, payments, customer, job and estimate, and create, update or delete invoices.

OperationTypeDescription
invoice(id)QueryGet one invoice
invoices(first, after, filter, sort)QueryList invoices
createInvoice(input)MutationCreate an invoice
updateInvoice(id, input)MutationUpdate an invoice
deleteInvoice(id)MutationDelete an invoice

InvoiceStatus: DRAFT, AWAIT_PAYMENT, PARTIALLY_PAID, PAID, BAD_DEBT, ARCHIVED, CLOSED, CANCELED, READY_TO_INVOICE


Invoice fields

Details

FieldTypeDescription
idID!Invoice UID
invoice_noIntInvoice number
invoice_no_stringStringInvoice number, as text
reference_noString
invoice_titleString
invoice_statusInvoiceStatus
invoice_descriptionString
invoice_dateDateTime
due_dateDateTime
custom_fields[CustomField!]!
external_ids[ExternalId!]!{ key value }

Amounts

Zuper calculates all amounts from the line items, discounts and taxes.

FieldTypeDescription
line_items[LineItem!]!
sub_totalFloat
total_discountFloat
taxable_amountFloat
tax[TaxLine!]!Taxes on the whole invoice
totalFloat
net_totalFloat

Payments

FieldTypeDescription
is_paidBoolean
amount_paidFloat
amount_dueFloat
paid_dateDateTime
payments[InvoicePayment!]!{ payment_history_uid amount payment_date reference_no payment_via is_void }. payment_via is PAYMENT_METHOD, CREDIT or CHECK

Related records and audit

FieldTypeDescription
customerCustomer
organizationOrganization
propertyProperty
jobJob
estimateEstimateThe estimate this invoice was created from
created_byUser
created_atDateTime
updated_atDateTime

Get an invoice

invoice(id: ID!) returns one invoice, or null if the UID doesn't exist in your account.

query InvoiceDetails($id: ID!) {
  invoice(id: $id) {
    id
    invoice_no_string
    reference_no
    invoice_title
    invoice_status
    invoice_date
    due_date
    paid_date
    line_items { name description quantity unit_price discount discount_type total tax { tax_name tax_amount } }
    sub_total
    total_discount
    taxable_amount
    tax { tax_name tax_percent tax_amount }
    total
    net_total
    amount_paid
    amount_due
    is_paid
    payments { payment_history_uid amount payment_date reference_no payment_via is_void }
    customer { id customer_full_name customer_email customer_billing_address { street city zip_code } }
    property { property_name }
    job { work_order_number job_title }
    estimate { estimate_no_string }
    custom_fields { label value }
    created_at
  }
}
{ "id": "<invoice_uid>" }

List invoices

invoices(first, after, filter, sort) returns a paginated list.

InvoiceFilter

FieldTypeMatches
status_in[InvoiceStatus!]Invoices in any of these statuses
customer_uidIDLinked customer
organization_uidIDLinked organization
property_uidIDLinked property
job_uidIDLinked job
estimate_uidIDLinked estimate
is_paidBooleanPaid or unpaid invoices
invoice_date_from / invoice_date_toDateTimeRange on invoice_date
due_date_from / due_date_toDateTimeRange on due_date
created_after / created_beforeDateTimeRange on created_at
updated_afterDateTimeInvoices changed at or after this time
custom_field[CustomFieldFilter!]{ label, value } exact matches

InvoiceSortField: CREATED_AT, UPDATED_AT, INVOICE_DATE, DUE_DATE, INVOICE_NO

Example: overdue invoices, oldest due date first

query OverdueInvoices($today: DateTime!, $after: String) {
  invoices(
    first: 100
    after: $after
    filter: { status_in: [AWAIT_PAYMENT, PARTIALLY_PAID], is_paid: false, due_date_to: $today }
    sort: { field: DUE_DATE, direction: ASC }
  ) {
    nodes {
      id
      invoice_no_string
      due_date
      total
      amount_paid
      amount_due
      customer { customer_full_name customer_email }
      job { work_order_number }
    }
    page_info { has_next_page end_cursor }
  }
}
{ "today": "2026-11-17T23:59:59Z", "after": null }

Example: invoices raised in a month, by invoice number

query MonthlyInvoices($from: DateTime!, $to: DateTime!, $after: String) {
  invoices(
    first: 100
    after: $after
    filter: { invoice_date_from: $from, invoice_date_to: $to }
    sort: { field: INVOICE_NO, direction: ASC }
  ) {
    nodes { id invoice_no invoice_no_string invoice_date invoice_status net_total }
    page_info { has_next_page end_cursor }
  }
}
{ "from": "2026-10-01T00:00:00Z", "to": "2026-10-31T23:59:59Z", "after": null }

Example: a customer's invoices for an estimate, due in a date range

query InvoicesForRecord($customer: ID, $estimate: ID, $dueFrom: DateTime, $dueTo: DateTime) {
  invoices(
    first: 25
    filter: { customer_uid: $customer, estimate_uid: $estimate, due_date_from: $dueFrom, due_date_to: $dueTo }
    sort: { field: INVOICE_DATE, direction: DESC }
  ) {
    nodes { id invoice_no_string invoice_status due_date amount_due estimate { estimate_no_string } }
    page_info { has_next_page end_cursor }
  }
}
{
  "customer": "<customer_uid>",
  "estimate": "<estimate_uid>",
  "dueFrom": "2026-11-01T00:00:00Z",
  "dueTo": "2026-12-31T23:59:59Z"
}

Example: invoices changed since a date, with a custom field value

query InvoiceSync($since: DateTime!, $cf: [CustomFieldFilter!], $after: String) {
  invoices(
    first: 100
    after: $after
    filter: { updated_after: $since, custom_field: $cf }
    sort: { field: UPDATED_AT, direction: ASC }
  ) {
    nodes { id invoice_no_string invoice_status is_paid amount_due updated_at }
    page_info { has_next_page end_cursor }
  }
}
{ "since": "2026-11-01T00:00:00Z", "cf": [{ "label": "Source", "value": "API" }], "after": null }

Create an invoice

createInvoice(input: InvoiceCreateInput!)

InvoiceCreateInput

FieldTypeRequiredDescription
customer_uidIDYes
invoice_dateDateTimeYesSend at noon UTC, for example 2026-11-17T12:00:00Z
due_dateDateTimeYesSend at noon UTC
line_items[LineItemInput!]YesSame format as for estimates
organization_uidIDNo
property_uidIDNo
job_uidIDNo
estimate_uidIDNoThe estimate to invoice. See below
invoice_titleStringNoDefaults to the customer's or organization's name
reference_noStringNo
invoice_descriptionStringNo
custom_fields[CustomFieldInput!]No{ label value }

Linking an estimate:

  • If you send estimate_uid, that estimate is marked as converted.
  • If you send job_uid without estimate_uid, and the job has exactly one APPROVED estimate, that estimate is linked automatically.

Note: Always send unit_price on each line item, including for catalog products. A missing unit_price is saved as 0.

mutation CreateInvoice($input: InvoiceCreateInput!) {
  createInvoice(input: $input) {
    invoice {
      id
      invoice_no_string
      invoice_status
      invoice_title
      sub_total
      total_discount
      tax { tax_name tax_amount }
      total
      amount_due
      estimate { estimate_no_string is_converted }
    }
    user_errors { field message code }
  }
}
{
  "input": {
    "customer_uid": "<customer_uid>",
    "job_uid": "<job_uid>",
    "estimate_uid": "<estimate_uid>",
    "property_uid": "<property_uid>",
    "invoice_title": "AC maintenance - November",
    "reference_no": "PO-88213",
    "invoice_description": "Quarterly maintenance visit",
    "invoice_date": "2026-11-17T12:00:00Z",
    "due_date": "2026-12-02T12:00:00Z",
    "line_items": [
      { "product_uid": "<product_uid>", "quantity": 2, "unit_price": 150 },
      { "name": "Labor", "quantity": 3, "unit_price": 95, "discount": 10, "discount_type": "PERCENTAGE" }
    ],
    "custom_fields": [{ "label": "Source", "value": "API" }]
  }
}

Possible user_errors messages include Mandatory details are Missing (HTTP_400) and Invalid Quote UID (HTTP_404, when estimate_uid doesn't exist).


Update an invoice

updateInvoice(id: ID!, input: InvoiceUpdateInput!) changes only the fields you send.

InvoiceUpdateInput: invoice_title, reference_no, invoice_description, invoice_date, due_date, line_items, custom_fields

  • line_items replaces all existing line items. Send the complete list.
  • line_items is ignored when the invoice is BAD_DEBT, ARCHIVED, CLOSED or CANCELED.
  • Secondary customers on the invoice are kept.
mutation UpdateInvoice($id: ID!, $input: InvoiceUpdateInput!) {
  updateInvoice(id: $id, input: $input) {
    invoice { id invoice_title due_date reference_no total amount_due }
    user_errors { field message code }
  }
}
{
  "id": "<invoice_uid>",
  "input": {
    "invoice_title": "AC maintenance - November (revised)",
    "due_date": "2026-12-05T12:00:00Z",
    "reference_no": "PO-88213-A",
    "line_items": [{ "name": "Labor", "quantity": 3, "unit_price": 100 }]
  }
}

Delete an invoice

deleteInvoice(id: ID!)

You can't delete an invoice that has active payments (Please ensure that there is no active payments left.).

mutation DeleteInvoice($id: ID!) {
  deleteInvoice(id: $id) {
    deleted_id
    user_errors { field message code }
  }
}
{ "id": "<invoice_uid>" }

Did this page help you?