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

# Invoices and AR import

> Customers, invoices, payments, refunds, payouts, and customer credits. Use external_id for idempotent imports.

AR import tools are in the `ar_imports` group. Customer and invoice **reads** are also available in `core` (platform and business). Writes are business mode.

Prefer `external_id` as the idempotency key on imports. Use **customer credit**, not “credit note”.

REST guide: [Importing sales / AR data](/guides/importing-sales-ar-data).

## Sequence

<Steps>
  <Step title="Customers">
    Reads: `list_customers`, `get_customer`. Writes: `create_customer`, `update_customer`, `archive_customer` (destructive), `unarchive_customer`, `merge_customers` (destructive), `bulk_create_customers`.
  </Step>

  <Step title="Import invoices">
    `list_invoices`, `get_invoice`, `import_invoices` (`POST …/invoices/batch`), `update_invoice`. Destructive: `void_invoice`, `delete_invoice`. Also `get_invoice_pdf`, `write_off_invoice`, `delete_invoice_write_off` (destructive).
  </Step>

  <Step title="Payments, refunds, payouts, customer credits">
    List/get plus import-or-create/update/delete for invoice payments, invoice refunds, payouts, and customer credits. `record_invoice_refund_payment` / `delete_invoice_refund_payment` (destructive) for refund payments.
  </Step>
</Steps>

## Tool groups (search)

| Area             | Search terms                                              |
| ---------------- | --------------------------------------------------------- |
| Invoices         | `import_invoices`, void, delete, write-off, PDF           |
| Payments         | `import_invoice_payments`                                 |
| Refunds          | `import_invoice_refunds`, `record_invoice_refund_payment` |
| Payouts          | `import_payouts`                                          |
| Customer credits | `create_customer_credit` (not credit note)                |

List tools accept `cursor` / `limit`. Writes typically take a loose `body` object.
