# Add a file to an invoice

`POST /v1/invoices/{id}/files`

Adds one file to a draft invoice or offer. It's emailed after the PDF every time the document is sent by email; e-invoices don't carry it. Numina doesn't read it, and it isn't a bilag.

PDF, PNG or JPEG. An invoice holds up to 10 files and 10 MB in total, so the email still fits the customer's mail server.

Files change only while the document is a draft: once it's booked or issued, its files are what the customer received. So create the invoice as a draft, add its files, then book it with `POST /v1/invoices/{id}/book`.

### Errors

- `400 invalid_file` when the file isn't PDF, PNG or JPEG, or its content doesn't match its declared type
- `400 file_too_large` when the invoice would hold more files or bytes than allowed
- `409 conflict` when the invoice isn't a draft

**Scopes:** any of `invoices:write`, `write:draft`, `write:ledger`

## Request

```bash
curl -X POST https://api.numina.app/v1/invoices/550e8400-e29b-41d4-a716-446655440000/files \
  -H "Authorization: Bearer numi_YOUR_API_KEY" \
  -F file=@receipt.pdf
```

## Path parameters

- `id` (string (uuid), required): Invoice ID

## Body (`multipart/form-data`)

- `file` (file, required): The file: PDF, PNG or JPEG

## Response `201`

The added file

```json
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "file_name": "timesheet-march.pdf",
  "content_type": "application/pdf",
  "size_bytes": 48213,
  "sha256": "string",
  "created_at": "string"
}
```

## Errors

- `400` Bad Request - The file is missing, not allowed, or too large
- `401` Unauthorized - Missing or invalid credentials
- `403` Forbidden - A scope is missing, or the company is archived
- `404` Not Found - It doesn't exist in this company
- `409` Conflict - The invoice is not a draft
- `429` Too Many Requests - You're over the rate limit
- `500` Internal Server Error - Something went wrong on our side

See https://developers.numina.app/errors.md for the error format.
