---
title: "Download an invoice PDF"
url: https://docs.corefinity.com/api/reference/billing/download-invoice-pdf
type: endpoint
last_updated: 2026-11-13
feature: billing
related:
  - https://docs.corefinity.com/guides/billing/billing-overview.md
---
# Download an invoice PDF

Step two of downloading an invoice's PDF: answers the file the link names, for the person the link was given
to, while it lasts. Your right to read the account's billing is checked again, and each download is recorded
in the company's activity.

```http
GET /api/corestack/billing/pdf/{token}
```

- Scope: `read`
- Two-factor: required on your account (all)
- Rate limit: 120 a minute
- Try it in the console: off. It has not been cleared for the console. Copy the request and run it yourself when you are sure.

## Path parameters

- `token` (string, required): The token at the end of `download_url`, as `POST /corestack/billing/invoices/{invoice}/pdf` answered it.

## Request

### curl

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

### PHP

```php
use Illuminate\Support\Facades\Http;

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->get('https://manage.corefinity.com/api/corestack/billing/pdf/string');

$data = $response->json();
```

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/corestack/billing/pdf/string', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
  },
});

// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);
```

### Python

```python
import os
import requests

res = requests.get(
    "https://manage.corefinity.com/api/corestack/billing/pdf/string",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
)

data = res.json() if res.content else None
```

## Responses

### 200 The invoice, as a PDF file named for the invoice number.

```json
"string"
```

### 401 No token, or a token that is not valid.

```json
{
  "message": "Unauthenticated."
}
```

### 403 The token lacks the scope (`scope_required`, with the `scope` to use), your company requires two-factor authentication and you have not set it up (`two_factor_required`), or you may not read your company's billing (`billing_forbidden`): billing is for the company's owner, its billing contacts and its primary user.

```json
{
  "code": "billing_forbidden",
  "message": "Billing is available to your company's owner and billing contacts.",
  "reason": "billing_forbidden"
}
```

### 404 Billing is not on for your company (`feature_off`), the invoice is no longer one you can read, or the file could not be found (`pdf_missing`): open a ticket and Corefinity sends it.

```json
{
  "code": "feature_off",
  "message": "Not found.",
  "reason": "feature_off"
}
```

### 409 The invoice has no PDF any more (`pdf_pending`). Ask for a new link later.

```json
{
  "code": "pdf_pending",
  "message": "The PDF of this invoice is not ready yet.",
  "reason": "pdf_pending"
}
```

### 410 The link has expired, or it was given to somebody else (`link_expired`). Ask for a new one.

```json
{
  "code": "link_expired",
  "message": "This link has expired. Open the invoice and download again.",
  "reason": "link_expired"
}
```

### 429 Too many requests (`rate_limited`). Wait for the number of seconds in `Retry-After`, which `retry_after_seconds` repeats.

```json
{
  "code": "rate_limited",
  "message": "Too many requests. Try again in 60 seconds.",
  "reason": "rate_limited",
  "retry_after_seconds": 60
}
```

## If it is refused

| Status | Reason | What to do |
|---|---|---|
| 401 |  | Send a valid token as `Authorization: Bearer <token>`. |
| 403 | `billing_forbidden` | Billing is for the organisation's owner and billing contacts. Ask one of them to do this. |
| 403 | `company_unavailable` | Your company is unavailable. |
| 403 | `scope_required` | Use a token with the scope named in `scope`. |
| 403 | `two_factor_required` | Turn on two-factor on your account, then send again. |
| 404 | `feature_off` | This feature is not on for your organisation yet. |
| 404 | `pdf_missing` | The PDF of this invoice could not be found. Open a ticket and we will send it. |
| 409 | `pdf_pending` | The invoice's PDF is not ready yet. Try again in a few minutes. |
| 410 | `link_expired` | This link has expired. Open the invoice and download again. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |

## The same task elsewhere

- Guide: [Billing](https://docs.corefinity.com/guides/billing/billing-overview.md)
