> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentaos.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Invoices

> Read tax-compliant invoice records with agentaos.invoices. PDFs, statements, CSV exports, and receipts.

Every confirmed payment, checkout or subscription renewal, issues a tax-compliant invoice: buyer details, applied tax rate and amount, exchange rate at settlement, and the merchant record AgentaOS billed as. `agentaos.invoices` reads those records and downloads their documents. There's no `create`, invoices are generated by AgentaOS when a payment confirms.

## `invoices.list(params?)`

```typescript theme={null}
const page = await agentaos.invoices.list({
  from: '2026-03-01',
  to: '2026-03-31',
  status: 'issued',
  limit: 50,
});
```

<ParamField query="from" type="string">ISO 8601 date, inclusive lower bound.</ParamField>
<ParamField query="to" type="string">ISO 8601 date, inclusive upper bound.</ParamField>

<ParamField query="status" type="'all' | 'issued' | 'paid' | 'voided'" />

<ParamField query="limit" type="number" default="20">Max 5000.</ParamField>

<ParamField query="offset" type="number" default="0" />

Returns `PaginatedList<Invoice>`.

### Invoice fields

<ResponseField name="id" type="string" />

<ResponseField name="orgId" type="string" />

<ResponseField name="transactionId" type="string | null" />

<ResponseField name="invoiceNumber" type="string">e.g. `'INV-2026-0001'`.</ResponseField>
<ResponseField name="amount" type="number">Currency units, in `paymentToken`.</ResponseField>

<ResponseField name="currency" type="string" />

<ResponseField name="paymentToken" type="string">The token the buyer paid with, e.g. `'EURC'`.</ResponseField>

<ResponseField name="description" type="string | null" />

<ResponseField name="txHash" type="string | null">On-chain settlement transaction, if applicable.</ResponseField>

<ResponseField name="network" type="string" />

<ResponseField name="fiatAmount" type="number | null">EUR/USD equivalent, currency units.</ResponseField>
<ResponseField name="fiatCurrency" type="string | null">`'EUR'` or `'USD'`.</ResponseField>
<ResponseField name="exchangeRate" type="number | null">Rate applied at settlement.</ResponseField>

<ResponseField name="exchangeRateSource" type="string | null" />

<ResponseField name="exchangeRateAt" type="string | null">ISO 8601.</ResponseField>

<ResponseField name="merchantName" type="string | null" />

<ResponseField name="merchantAddress" type="string | null" />

<ResponseField name="merchantVat" type="string | null" />

<ResponseField name="merchantWallet" type="string | null" />

<ResponseField name="payerAddress" type="string" />

<ResponseField name="taxRate" type="number | null">e.g. `19` for 19%.</ResponseField>
<ResponseField name="taxAmount" type="number | null">Currency units.</ResponseField>

<ResponseField name="taxInclusive" type="boolean | null" />

<ResponseField name="taxName" type="string | null">e.g. `'DE VAT'`.</ResponseField>
<ResponseField name="buyerCountry" type="string | null">ISO 3166-1 alpha-2.</ResponseField>

<ResponseField name="buyerEmail" type="string | null" />

<ResponseField name="buyerName" type="string | null" />

<ResponseField name="buyerVat" type="string | null" />

<ResponseField name="buyerCompany" type="string | null" />

<ResponseField name="status" type="'issued' | 'paid' | 'voided'" />

<ResponseField name="issuedAt" type="string">ISO 8601.</ResponseField>
<ResponseField name="voidedAt" type="string | null">ISO 8601.</ResponseField>
<ResponseField name="createdAt" type="string">ISO 8601.</ResponseField>

<Note>
  `amount`, `fiatAmount`, and `taxAmount` are plain decimal currency-unit numbers, not minor units. `19.99` means €19.99. See the [money model](/sdk/pay-overview#the-money-model).
</Note>

## `invoices.retrieve(id)`

```typescript theme={null}
const invoice = await agentaos.invoices.retrieve('uuid');
```

Returns the full `Invoice` shape above for a single record.

## `invoices.void(id)`

```typescript theme={null}
await agentaos.invoices.void('uuid');
// → { success: true }
```

Sets `status` to `'voided'` and stamps `voidedAt`. The record is retained, `retrieve()` still returns it.

## Downloads

Every download method returns raw bytes, not a parsed JSON object. PDFs come back as `Buffer`, the CSV export comes back as `string`.

<CodeGroup>
  ```typescript downloadPdf(id) theme={null}
  const pdf = await agentaos.invoices.downloadPdf('uuid'); // Promise<Buffer>
  fs.writeFileSync('invoice.pdf', pdf);
  ```

  ```typescript downloadStatement(params) theme={null}
  // Monthly statement PDF: balance reconciliation, VAT summary, transaction ledger.
  const statement = await agentaos.invoices.downloadStatement({
    from: '2026-03-01',
    to: '2026-03-31',
  }); // Promise<Buffer>
  fs.writeFileSync('march-statement.pdf', statement);
  ```

  ```typescript exportCsv(params?) theme={null}
  const csv = await agentaos.invoices.exportCsv({
    from: '2026-03-01',
    to: '2026-03-31',
    status: 'issued',
  }); // Promise<string>
  fs.writeFileSync('invoices.csv', csv);
  ```

  ```typescript getReceipt(id) theme={null}
  // Receipt PDF for a paid invoice. Falls back to the invoice PDF for
  // invoices issued before receipts existed.
  const receipt = await agentaos.invoices.getReceipt('uuid'); // Promise<Buffer>
  fs.writeFileSync('receipt.pdf', receipt);
  ```
</CodeGroup>

<ParamField query="from" type="string" required>ISO 8601 date. Required for `downloadStatement`, optional for `exportCsv`.</ParamField>
<ParamField query="to" type="string" required>ISO 8601 date. Required for `downloadStatement`, optional for `exportCsv`.</ParamField>
<ParamField query="status" type="string">`exportCsv` only, optional.</ParamField>

`exportCsv`'s params are all optional: `{ from?: string; to?: string; status?: string }`. `downloadStatement` requires both `from` and `to`.

## `invoices.sendReceipt(id)`

Re-sends the receipt email to the buyer on file. Paid invoices only.

```typescript theme={null}
const result = await agentaos.invoices.sendReceipt('uuid');
console.log(result.sentTo); // buyer email the receipt was sent to
```

<ResponseField name="ok" type="true" />

<ResponseField name="sentTo" type="string">The email address the receipt was sent to.</ResponseField>

## Next steps

<CardGroup cols={2}>
  <Card title="Checkouts" icon="credit-card" href="/sdk/pay-checkouts">
    `invoiceId`/`invoiceNumber` on a completed checkout point back here.
  </Card>

  <Card title="Customers" icon="users" href="/sdk/pay-customers">
    The buyers these invoices are billed to.
  </Card>

  <Card title="Errors" icon="triangle-exclamation" href="/sdk/pay-errors">
    What a missing or already-actioned invoice ID throws.
  </Card>
</CardGroup>
