Invoices Queries

Retrieve invoices, their line items, payment status, and accounting details.

Invoice — Returns a single invoice by id

query GetInvoice($id: ID!) {
  Invoice(id: $id) {
    id
    label
    status
    total
    dated_at
    due_at
    customer { id label }
    paid_amount
    remaining_balance
    line_items {
      id
      variant { id label }
      quantity
      price
    }
  }
}

Invoices — Returns a paginated list of invoices with sorting and filters

query Invoices(
  $where: QueryInvoicesWhereWhereConditions,
  $orderBy: [QueryInvoicesOrderByOrderByClause!],
  $search: String,
  $first: Int,
  $page: Int
) {
  Invoices(
    where: $where,
    orderBy: $orderBy,
    search: $search,
    first: $first,
    page: $page
  ) {
    paginatorInfo {
      total
      currentPage
    }
    data {
      id
      label
      status
      dated_at
      total
      customer { id label }
    }
  }
}

Available fields

FieldTypeDescription
idIntUnique identifier.
labelStringInvoice number.
statusInvoiceStatusPayment and publication status.
depositBooleanTrue if it's a deposit (down payment) invoice.
exchange_rateFloatExchange rate used.
tax_typeTaxTypeTax calculation method.
default_discountFloatGlobal discount value.
discount_typeDiscountTypeDiscount type.
total_unitsFloatSum of all line item quantities.
subtotalFloatNet amount before taxes and discounts.
total_without_taxFloatAmount excluding taxes.
total_ecotaxFloatSum of environmental taxes.
totalFloatGrand total including everything.
paid_amountFloatTotal amount received through payments.
remaining_balanceFloatUnpaid balance remaining.
dated_atDateDocument date.
due_atDateDeadline for payment.
notesStringPublic notes displayed on the PDF.
internal_notesStringHidden internal comments.
for_the_attention_ofStringSpecific recipient name.
external_referenceStringMerchant internal reference.
vat_payment_methodStringVAT strategy (e.g. "on payments").
location_labelStringName of the warehouse/store.
public_idStringSecure token for external viewing.
public_view_countIntNumber of times viewed via public link.
public_last_accessed_atJSONTimestamp of last public access.
currencyCurrencyInvoice currency.
customerCustomerAssociated customer.
price_levelPriceLevelApplied price list.
account_representativeAccountRepresentativeAssigned sales rep.
seasonSeasonBusiness season.
payment_informationPaymentInformationBank details for payment.
return_statusReturnStatusGoods return progress.
credit_statusCreditStatusCredit note progress.
returned_quantityFloatQuantity returned so far.
unreturned_quantityFloatQuantity still pending return.
credited_quantityFloatQuantity already credited.
uncredited_quantityFloatQuantity still pending credit.
credited_amountFloatValue already processed for credit.
uncredited_amountFloatValue still pending credit.
pdf_templatePdfTemplateTemplate used for generation.
billing_addressAddressDocument billing address.
shipping_addressAddressDelivery address.
line_items[LineItemInvoice]Detailed list of items.
total_taxes[DocumentTaxRate]Summary of taxes.
estimates_countIntNumber of source estimates.
estimates[Estimate]Linked estimates history.
orders_countIntNumber of source sales orders.
orders[Order]Linked sales orders history.
shipping_orders_countIntNumber of linked deliveries.
shipping_orders[ShippingOrder]Linked shipping orders history.
product_returns_countIntNumber of linked returns.
product_returns[ProductReturn]Linked product returns history.
credit_notes_countIntNumber of linked credit notes.
credit_notes[CreditNote]Linked credit notes history.
invoice_payments[InvoicePayment]List of payment allocations.
integrations[Integration]External platform links.
email_histories[EmailHistory]Email logs.
files[File]Attachments.
has_batch_numbersBooleanTrue if invoice items use batch tracking.
custom_fields[EntityCustomField]Custom fields for this entity.

Filters

The following fields can be used in the where parameter:

id, label, status, currency, deposit, exchange_rate, tax_type, default_discount, discount_type, total_units, subtotal, total_without_tax, total_ecotax, total, dated_at, due_at, notes, internal_notes, for_the_attention_of, tracking_completed, created_at, updated_at, customer_id, price_level_id, account_representative_id, season_id, pdf_template_id, payment_information_id, paid_amount, remaining_balance, variant_id, variant_label, variant_sku, location_id, batch_number_id, returned_quantity, unreturned_quantity, credited_quantity, uncredited_quantity, credited_amount, uncredited_amount, estimates_count, orders_count, shipping_orders_count, product_returns_count, credit_note_count, product_tag_id, customer_tag_id, shipping_type, source, credit_note_id, payment_method_id, is_sent, return_status, credit_status.

Example Filters:

FieldExample
status{ "column": "STATUS", "operator": "EQ", "value": "unpaid" }
remaining_balance{ "column": "REMAINING_BALANCE", "operator": "GT", "value": 0 }
customer_id{ "column": "CUSTOMER_ID", "operator": "EQ", "value": 100050 }
dated_at{ "column": "DATED_AT", "operator": "GTE", "value": "2025-01-01" }

Sorting

You can sort results using the orderBy parameter:

  • id
  • label
  • status
  • dated_at
  • due_at
  • total
  • paid_amount
  • remaining_balance

Grouping Options

You can group invoices using the groupBy parameter for reports:

FieldDescription
idGroup by internal ID.
yearGroup by year of dated_at.
monthGroup by month of dated_at.
dayGroup by day of dated_at.

Data Types

EInvoiceValidationResult

FieldTypeDescription
validBooleanWhether the e-invoice is valid.
checks[EInvoiceValidationCheck]List of validation checks.
errors[String]List of error messages.
messageStringSummary message.
invoiceInvoiceThe validated invoice.

EInvoiceValidationCheck

FieldTypeDescription
fieldStringField that was validated.
labelStringHuman-readable field label.
validBooleanWhether the check passed.
messageStringValidation message.

Enums

InvoiceStatus

ValueDescription
unpublishedDraft status (hidden).
draftDocument created, not yet published.
unpaidPublished and awaiting payment.
partially_paidPartial payment received.
paidFully paid.
cancelledDocument voided.
sent_to_quickbooksExported to QB.

ReturnStatus

ValueDescription
not_returnedDefault state.
partially_returnedPartial returns linked.
returnedFully returned.

CreditStatus

ValueDescription
not_creditedDefault state.
partially_creditedActive credit notes linked.
creditedFully credited.

EInvoiceStatus

ValueDescription
acceptedE-invoice accepted.
approvedE-invoice approved.
collectedE-invoice collected.
in_disputeE-invoice in dispute.
partially_collectedE-invoice partially collected.
refusedE-invoice refused.
rejectedE-invoice rejected.
sentE-invoice sent.
submittedE-invoice submitted.

DiscountType

ValueDescription
amountFixed discount amount.
percentagePercentage-based discount.

TaxType

ValueDescription
exclusiveTax calculated on top of the net price.
inclusiveTax included in the displayed price.