# Invoices

Section: Invoices and payments. Part of the [API reference](https://developer.yoprint.com/reference.md). Web page: https://developer.yoprint.com/reference/invoices/

This page and all 15 operation pages, in 4 files: https://developer.yoprint.com/llms/invoices.txt (operations 1 to 4), https://developer.yoprint.com/llms/invoices-2.txt (operations 5 to 7), https://developer.yoprint.com/llms/invoices-3.txt (operations 8 to 13), https://developer.yoprint.com/llms/invoices-4.txt (operations 14 to 15)

Invoices bill some or all of a sales order or quote. One order can have many; with Auto Invoice on, YoPrint automatically keeps one invoice updated to match the order's lines and shipping fees. Payments recorded on the order are allocated to its invoices.

## Operations (11)

- [Create an invoice for a sales order](https://developer.yoprint.com/reference/invoices/v2-sales-order-invoice-create.md): `POST /v2/api/store/{team_slug}/v2/sales_order/{unique_key}/invoice`. Creates an invoice for an order, optionally with its lines in the same call.
- [Filter invoices](https://developer.yoprint.com/reference/invoices/v2-invoice-filter.md): `POST /v2/api/store/{team_slug}/v2/invoice/filter`. Returns one page of your team's invoices that match the filters, newest first unless you sort.
- [List the invoices of a sales order](https://developer.yoprint.com/reference/invoices/v2-sales-order-invoice-index-for-order.md): `GET /v2/api/store/{team_slug}/v2/sales_order/{unique_key}/invoice`. Returns the invoices of an order with their lines.
- [List invoice lines for export](https://developer.yoprint.com/reference/invoices/v1-sales-order-invoices-export-all-invoice-items.md): `POST /v1/api/store/{team_slug}/sales_order/invoices/export_all_sales_order_invoice_item`. Returns the invoice lines that come from order lines, one row per line, as JSON in `data`, for a date range.
- [List invoices for export](https://developer.yoprint.com/reference/invoices/v1-sales-order-invoices-export-list.md): `POST /v1/api/store/{team_slug}/sales_order/invoices/export_list`. Returns invoice rows as JSON in `data`, one per invoice, for a date range: the invoice CSV export's columns plus a few more.
- [Get an invoice](https://developer.yoprint.com/reference/invoices/v2-invoice-show.md): `GET /v2/api/store/{team_slug}/v2/invoice/{unique_key}`. An invoice bills some or all of a sales order (or quote).
- [Update an invoice](https://developer.yoprint.com/reference/invoices/v2-invoice-update.md): `PUT /v2/api/store/{team_slug}/v2/invoice/{unique_key}`. Changes an invoice's header (number, issue date, addresses) and, in the same save, its lines, its tax and the order of its lines.
- [Change the tax on an invoice](https://developer.yoprint.com/reference/invoices/v2-invoice-tax-selection-update.md): `PUT /v2/api/store/{team_slug}/v2/invoice/{unique_key}/tax-selection`. Sets, changes or removes an invoice's tax line.
- [Delete an invoice](https://developer.yoprint.com/reference/invoices/v2-invoice-destroy.md): `DELETE /v2/api/store/{team_slug}/v2/invoice/{unique_key}`. Deletes an invoice and its lines.
- [Download invoices as one PDF](https://developer.yoprint.com/reference/invoices/v1-invoice-export-pdf.md): `POST /v1/api/store/{team_slug}/invoice/export_pdf`. Returns one PDF with up to 100 invoices, made while you wait (`<date and time> - invoices.pdf`, shown inline).
- [Export invoices as CSV](https://developer.yoprint.com/reference/invoices/v1-sales-order-invoices-export.md): `POST /v1/api/store/{team_slug}/sales_order/invoices/export`. Downloads a CSV file of invoices.

## Legacy and internal operations (4)

Prefer the operations above. Legacy ones name their replacement; internal ones are built for YoPrint's own apps.

- [List invoices (v1)](https://developer.yoprint.com/reference/invoices/v1-invoice-index.md): `GET /v1/api/store/{team_slug}/invoice` (legacy, deprecated). Returns one page of your team's invoices of saved, non-draft sales orders and quotes (invoices of deleted, draft or autosaved orders, and deleted invoices, are left out).
- [Get an invoice (v1)](https://developer.yoprint.com/reference/invoices/v1-invoice-show.md): `GET /v1/api/store/{team_slug}/invoice/{hash_id}` (legacy, deprecated). Returns one invoice by its hash id.
- [Change an invoice number (v1)](https://developer.yoprint.com/reference/invoices/v1-invoice-update-put.md): `PUT /v1/api/store/{team_slug}/invoice/{hash_id}` (legacy, deprecated). Sets only the invoice number (`scoped_id`); nothing else on the invoice can change here.
- [Change an invoice number (v1) (same as PUT)](https://developer.yoprint.com/reference/invoices/v1-invoice-update-patch.md): `PATCH /v1/api/store/{team_slug}/invoice/{hash_id}` (legacy, deprecated). Sets only the invoice number (`scoped_id`); nothing else on the invoice can change here.
