Skip to content

Mercury: List all invoices

Mercury invoices.listInvoices: arguments, response, policy and SDK examples.

← Invoices operations · Get started

Operation mercury.listinvoices

Provider route: GET /ar/invoices. Alter supplies the connection’s credentials and routing.

Install @alter-ai/sdk @alter-ai/mercury with npm, or alter-sdk-mercury with pip. Supply your connected customer’s grant ID and the arguments described below.

import { App } from "@alter-ai/sdk";
import { MercuryIntegration } from "@alter-ai/mercury";
async function execute(input: Parameters<MercuryIntegration["invoices"]["listInvoices"]>[0]) {
const app = new App({ apiKey: process.env.ALTER_API_KEY! });
try {
const provider = new MercuryIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! });
const call = await provider.invoices.listInvoices(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from alter_sdk_mercury import MercuryIntegration
async def execute(arguments):
async with App(api_key=os.environ["ALTER_API_KEY"]) as app:
provider = MercuryIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]})
call = await provider.invoices.list_invoices(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
queryobjectOptionalAdditional keys: not allowed
query.limitintegerOptionalMaximum number of results to return. Allowed range: 1 to 1000. Defaults to 1000
Default: 1000
Format: int64
Maximum: 1000
Minimum: 1
query.orderstringOptionalSort order. Can be ‘asc’ or ‘desc’. Defaults to ‘asc’
Default: asc
One of: asc, desc
query.start_afterstringOptionalThe ID of the invoice to start the page after (exclusive). When provided, results will begin with the invoice immediately following this ID. Use this for standard forward pagination to get the next page of results. Cannot be combined with end_before.
Format: uuid
query.end_beforestringOptionalThe ID of the invoice to end the page before (exclusive). When provided, results will end just before this ID and work backwards. Use this for reverse pagination or to retrieve previous pages. Cannot be combined with start_after.
Format: uuid

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand List all invoices — response body

Referenced models: List all invoices — response body

List all invoices — response body
FieldTypePresenceDescription and constraints
$objectRootPaginated response containing a list of invoices.
| Use the page cursor information to fetch additional pages of invoices.
invoicesarrayRequired within parentList of invoices in the current page
invoices[]ModelEach itemExpand List all invoices — response body — invoices item
pageobjectRequired within parentPagination information including cursors for navigating to next/previous pages
page.nextPagestringOptionalID for the invoice.
Format: uuid
page.previousPagestringOptionalID for the invoice.
Format: uuid

Referenced models: List all invoices — response body — invoices item

List all invoices — response body — invoices item
FieldTypePresenceDescription and constraints
$objectRootResponse data for Accounts Receivable invoices API Endpoint
achDebitEnabledbooleanRequired within parentWhether or not the invoice can be paid via ach debit.
amountJSONRequired within parent
amount (anyOf 1)numberAlternativeThe total amount of the invoice line items plus taxes
Multiple of: 0.01
amount (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
canceledAtJSONOptional
canceledAt (anyOf 1)JSONAlternative
canceledAt (anyOf 1) (allOf 1)stringAll variants applyFormat: yyyy-mm-ddThh:MM:ssZ
canceledAt (anyOf 1) (allOf 2)JSONAll variants applyThe time when the invoice was canceled.
canceledAt (anyOf 2)nullAlternative
ccEmailsarrayRequired within parentEmails to be CCed on invoice notifications/reminders.
ccEmails[]stringEach item
createdAtJSONRequired within parent
createdAt (allOf 1)stringAll variants applyFormat: yyyy-mm-ddThh:MM:ssZ
createdAt (allOf 2)JSONAll variants applyThe timestamp when the invoice was created.
creditCardEnabledbooleanRequired within parentWhether or not the invoice can be paid via credit card. Requires stripe to be
setup for the Mercury account.
currencyCodeJSONRequired within parent
currencyCode (allOf 1)stringAll variants apply
currencyCode (allOf 2)JSONAll variants applyISO 4217 currency code for the invoice (e.g. "USD", "EUR").
customerIdJSONRequired within parent
customerId (allOf 1)stringAll variants applyThe customer who will receive the invoice. Use the /api/v1/ar/customers endpoint to list your customers and find the corresponding id, or create a new customer first.
Format: uuid
customerId (allOf 2)JSONAll variants applyId of the customer the invoice was sent to.
destinationAccountIdJSONRequired within parent
destinationAccountId (allOf 1)stringAll variants applyID for a Mercury account.
Format: uuid
destinationAccountId (allOf 2)JSONAll variants applyThe Mercury account where invoice payments will be deposited. Use the /api/v1/accounts endpoint to list your accounts and find the corresponding id. Only checking and savings accounts are supported.
dueDateJSONRequired within parent
dueDate (allOf 1)stringAll variants applyFormat: date
dueDate (allOf 2)JSONAll variants applyThe due date the invoice should be paid by.
idJSONRequired within parent
id (allOf 1)stringAll variants applyID for the invoice.
Format: uuid
id (allOf 2)JSONAll variants applyThe ID of the invoice.
internalNoteJSONOptional
internalNote (anyOf 1)stringAlternativeInternal note for the invoice, visible by users in the
mercury organization but not visible to payers.
Maximum length: 5000
Minimum length: 1
internalNote (anyOf 2)nullAlternative
invoiceDateJSONRequired within parent
invoiceDate (allOf 1)stringAll variants applyFormat: date
invoiceDate (allOf 2)JSONAll variants applyThe date of the invoice, set by the invoice creator
and likely to be context specific to the type of transaction.
i.e. it could be a date a service was performed, it does not need
to be the date the invoice was created.
invoiceNumberstringRequired within parentThe payer facing invoice number/identifier.
Maximum length: 299
Minimum length: 1
payerMemoJSONOptional
payerMemo (anyOf 1)stringAlternativeMemo for the payer of the invoice.
Maximum length: 5000
Minimum length: 1
payerMemo (anyOf 2)nullAlternative
poNumberJSONOptional
poNumber (anyOf 1)stringAlternativePurchase order number for the invoice if applicable.
Maximum length: 299
Minimum length: 1
poNumber (anyOf 2)nullAlternative
slugstringRequired within parentA unique identifier used to build public URLs for this invoice. Use it to construct the payment page URL (https://app.mercury.com/pay/{slug}) or fetch the invoice PDF via /api/v1/ar/invoices/{slug}/pdf.
statusJSONRequired within parent
status (allOf 1)stringAll variants applyKnown values: Unpaid, Paid, Cancelled, Processing
status (allOf 2)JSONAll variants applyThe status of the invoice.
updatedAtJSONRequired within parent
updatedAt (allOf 1)stringAll variants applyFormat: yyyy-mm-ddThh:MM:ssZ
updatedAt (allOf 2)JSONAll variants applyThe timestamp when the invoice was updated.
useRealAccountNumberbooleanRequired within parentWhether or not the invoice payment instructions will show the real
account and routing number for the destination account or use
virtual account numbers instead.

SDK function policy ID: mercury.listinvoices. Catalog operation: mercury:listInvoices. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.

Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.