Add a file to an invoice
POST
/v1/invoices/{id}/filesAdds 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_filewhen the file isn't PDF, PNG or JPEG, or its content doesn't match its declared type400 file_too_largewhen the invoice would hold more files or bytes than allowed409 conflictwhen the invoice isn't a draft
Requires one ofinvoices:writewrite:draftwrite:ledger
Path parameters
- Invoice ID
Body
multipart/form-data
- The file: PDF, PNG or JPEG
Errors
400The file is missing, not allowed, or too large401Missing or invalid credentials403A scope is missing, or the company is archived404It doesn't exist in this company409The invoice is not a draft429You're over the rate limit500Something went wrong on our side
Every error has the same shape. See Errors.
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.pdfimport { openAsBlob } from "node:fs";
const form = new FormData();
form.append("file", await openAsBlob("receipt.pdf"), "receipt.pdf");
const response = await fetch("https://api.numina.app/v1/invoices/550e8400-e29b-41d4-a716-446655440000/files", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.NUMINA_API_KEY}`,
},
body: form,
});
const data = await response.json();import os
import requests
response = requests.post(
"https://api.numina.app/v1/invoices/550e8400-e29b-41d4-a716-446655440000/files",
headers={
"Authorization": f"Bearer {os.environ['NUMINA_API_KEY']}",
},
files={"file": open("receipt.pdf", "rb")},
)
data = response.json()Response
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"file_name": "timesheet-march.pdf",
"content_type": "application/pdf",
"size_bytes": 48213,
"sha256": "string",
"created_at": "string"
}