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.
Call through Alter
Section titled “Call through Alter”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 osfrom alter_sdk import Appfrom 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()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
query | object | Optional | Additional keys: not allowed |
query.limit | integer | Optional | Maximum number of results to return. Allowed range: 1 to 1000. Defaults to 1000 Default: 1000 Format: int64 Maximum: 1000 Minimum: 1 |
query.order | string | Optional | Sort order. Can be ‘asc’ or ‘desc’. Defaults to ‘asc’ Default: asc One of: asc, desc |
query.start_after | string | Optional | The 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_before | string | Optional | The 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
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand List all invoices — response body |
Referenced models: List all invoices — response body
Schemas
Section titled “Schemas”List all invoices — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Paginated response containing a list of invoices. | Use the page cursor information to fetch additional pages of invoices. |
invoices | array | Required within parent | List of invoices in the current page |
invoices[] | Model | Each item | Expand List all invoices — response body — invoices item |
page | object | Required within parent | Pagination information including cursors for navigating to next/previous pages |
page.nextPage | string | Optional | ID for the invoice. Format: uuid |
page.previousPage | string | Optional | ID for the invoice. Format: uuid |
Referenced models: List all invoices — response body — invoices item
List all invoices — response body — invoices item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Response data for Accounts Receivable invoices API Endpoint |
achDebitEnabled | boolean | Required within parent | Whether or not the invoice can be paid via ach debit. |
amount | JSON | Required within parent | |
amount (anyOf 1) | number | Alternative | The total amount of the invoice line items plus taxes Multiple of: 0.01 |
amount (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
canceledAt | JSON | Optional | |
canceledAt (anyOf 1) | JSON | Alternative | |
canceledAt (anyOf 1) (allOf 1) | string | All variants apply | Format: yyyy-mm-ddThh:MM:ssZ |
canceledAt (anyOf 1) (allOf 2) | JSON | All variants apply | The time when the invoice was canceled. |
canceledAt (anyOf 2) | null | Alternative | |
ccEmails | array | Required within parent | Emails to be CCed on invoice notifications/reminders. |
ccEmails[] | string | Each item | |
createdAt | JSON | Required within parent | |
createdAt (allOf 1) | string | All variants apply | Format: yyyy-mm-ddThh:MM:ssZ |
createdAt (allOf 2) | JSON | All variants apply | The timestamp when the invoice was created. |
creditCardEnabled | boolean | Required within parent | Whether or not the invoice can be paid via credit card. Requires stripe to be setup for the Mercury account. |
currencyCode | JSON | Required within parent | |
currencyCode (allOf 1) | string | All variants apply | |
currencyCode (allOf 2) | JSON | All variants apply | ISO 4217 currency code for the invoice (e.g. "USD", "EUR"). |
customerId | JSON | Required within parent | |
customerId (allOf 1) | string | All variants apply | The 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) | JSON | All variants apply | Id of the customer the invoice was sent to. |
destinationAccountId | JSON | Required within parent | |
destinationAccountId (allOf 1) | string | All variants apply | ID for a Mercury account. Format: uuid |
destinationAccountId (allOf 2) | JSON | All variants apply | The 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. |
dueDate | JSON | Required within parent | |
dueDate (allOf 1) | string | All variants apply | Format: date |
dueDate (allOf 2) | JSON | All variants apply | The due date the invoice should be paid by. |
id | JSON | Required within parent | |
id (allOf 1) | string | All variants apply | ID for the invoice. Format: uuid |
id (allOf 2) | JSON | All variants apply | The ID of the invoice. |
internalNote | JSON | Optional | |
internalNote (anyOf 1) | string | Alternative | Internal 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) | null | Alternative | |
invoiceDate | JSON | Required within parent | |
invoiceDate (allOf 1) | string | All variants apply | Format: date |
invoiceDate (allOf 2) | JSON | All variants apply | The 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. |
invoiceNumber | string | Required within parent | The payer facing invoice number/identifier. Maximum length: 299 Minimum length: 1 |
payerMemo | JSON | Optional | |
payerMemo (anyOf 1) | string | Alternative | Memo for the payer of the invoice. Maximum length: 5000 Minimum length: 1 |
payerMemo (anyOf 2) | null | Alternative | |
poNumber | JSON | Optional | |
poNumber (anyOf 1) | string | Alternative | Purchase order number for the invoice if applicable. Maximum length: 299 Minimum length: 1 |
poNumber (anyOf 2) | null | Alternative | |
slug | string | Required within parent | A 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. |
status | JSON | Required within parent | |
status (allOf 1) | string | All variants apply | Known values: Unpaid, Paid, Cancelled, Processing |
status (allOf 2) | JSON | All variants apply | The status of the invoice. |
updatedAt | JSON | Required within parent | |
updatedAt (allOf 1) | string | All variants apply | Format: yyyy-mm-ddThh:MM:ssZ |
updatedAt (allOf 2) | JSON | All variants apply | The timestamp when the invoice was updated. |
useRealAccountNumber | boolean | Required within parent | Whether or not the invoice payment instructions will show the real account and routing number for the destination account or use virtual account numbers instead. |
Policy, approvals and errors
Section titled “Policy, approvals and errors”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.