---
title: "Download invoices"
url: https://docs.corefinity.com/api/recipes/download-invoices
type: page
last_updated: 2026-11-13
feature: recipe-download-invoices
---
# Download invoices

List your invoices, read one and download its PDF.

An invoice's PDF is downloaded in two requests: one asks for a link, the next fetches the file. This recipe downloads a paid invoice of Harbour & Finch.

## Before you start

- A token with the `read` [scope](/api/scopes).
- You may read your company's billing: its owner, its billing contacts and its primary user can.
- Every step needs [two-factor enrolment](/api/two-factor) when your company requires it.
- No step waits for a maintenance window.

1. **List the invoices**

   Invoices are listed newest first. `status` narrows the list, and `pdf.available` says whether an invoice's PDF has been made.

   Paged by cursor: send `next_cursor` back as `cursor`; null means the last page.

   ```bash
   curl "https://manage.corefinity.com/api/corestack/billing/invoices?status=paid&limit=25" \
     -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json"
   ```

2. **Read one invoice**

   This step is optional. It answers the invoice with its lines, the credits applied to it, its payments and its credit notes.

   ```bash
   curl https://manage.corefinity.com/api/corestack/billing/invoices/8123 \
     -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json"
   ```

3. **Ask for a link to the PDF**

   The request has no body and answers `200` with `download_url` and `expires_at`. The link works for ten minutes, and only for you.

   ```bash
   curl -X POST https://manage.corefinity.com/api/corestack/billing/invoices/8123/pdf \
     -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json"
   ```

   ```json
   {
     "url": "/nova-vendor/corecluster/billing/pdf/Xk3ExampleTokenExampleTokenExampleTokenExample12",
     "expires_at": "2026-11-18T10:25:00Z",
     "download_url": "/api/corestack/billing/pdf/Xk3ExampleTokenExampleTokenExampleTokenExample12"
   }
   ```

4. **Download the PDF**

   Fetch `download_url` on the same host with the same token. The answer is the PDF file, named for the invoice number.

   Each download is recorded in your company's activity.

   ```bash
   curl https://manage.corefinity.com/api/corestack/billing/pdf/Xk3ExampleTokenExampleTokenExampleTokenExample12 \
     -H "Authorization: Bearer $COREFINITY_TOKEN" -H "Accept: application/json" \
     -o CF-100042.pdf
   ```

## If it is refused

| Status | `reason`            | What to do                                                                    |
| ------ | ------------------- | ----------------------------------------------------------------------------- |
| `403`  | `billing_forbidden` | Billing is for the company's owner, its billing contacts and its primary user |
| `404`  | `feature_off`       | Billing is not on for your company                                            |
| `422`  | `invalid`           | Correct the filter named in `field`                                           |
| `409`  | `pdf_pending`       | The invoice's PDF has not been made yet. Try again in a few minutes           |
| `410`  | `link_expired`      | The link has expired, or it was given to somebody else. Do step 3 again       |
| `404`  | `pdf_missing`       | The file could not be found. Open a ticket and Corefinity sends it            |
