Skip to main content

Audience:

Developers

Get a list of invoices using the API

Get a list of invoices with details about each one using the API.

Guide

  1. Call the account query.
  2. Add the account ID.
  3. Add all information you'd like to review about each invoice.
  4. Add pagination if you're looking for invoices for a certain interval.

Query

Open in API Explorer
query RetrieveInvoices {
account(accountId: "$YOUR_ACCOUNT_ID") {
invoices(after: "", first: 10) {
edges {
node {
closingDate
createdAt
expiresAt
name
id
openingDate
status
updatedAt
url
type
}
}
pageInfo {
hasNextPage
hasPreviousPage
}
totalCount
}
}
}

Payload

The query returns all of the information about two invoices.

{
"data": {
"account": {
"invoices": {
"edges": [
{
"node": {
"closingDate": "2023-02-28T22:59:59.999Z",
"createdAt": "2023-02-16T16:04:51.331Z",
"expiresAt": "2023-02-17T16:08:32.832Z",
"name": "INVOICE-20230228",
"id": "dc43f0f6-7bae-4f05-8b35-82363a1a17cf",
"openingDate": "2023-01-31T23:00:00.000Z",
"status": "Paid",
"updatedAt": "2023-02-16T16:04:52.582Z",
"url": "$INVOICE_URL",
"type":"Invoice"
}
},
{
"node": {
"closingDate": "2023-02-28T22:59:59.999Z",
"createdAt": "2023-02-16T16:02:55.416Z",
"expiresAt": "2023-02-17T16:08:32.832Z",
"name": "INVOICE-20230228",
"id": "b9ccad06-417a-48e0-8a08-37fee4ea39a3",
"openingDate": "2023-01-31T23:00:00.000Z",
"status": "Voided",
"updatedAt": "2023-02-16T16:04:50.888Z",
"url": null,
"type":"Invoice"
}
}
],
"pageInfo": {
"hasNextPage": false,
"hasPreviousPage": false
},
"totalCount": 2
}
}
}
}