NuminaDevelopers
Dashboard
Add a file to an invoice

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

Requires one ofinvoices:writewrite:draftwrite:ledger

Path parameters

  • idstring (uuid)Required
    Invoice ID

Body

multipart/form-data

  • filefileRequired
    The file: PDF, PNG or JPEG

Errors

  • 400The file is missing, not allowed, or too large
  • 401Missing or invalid credentials
  • 403A scope is missing, or the company is archived
  • 404It doesn't exist in this company
  • 409The invoice is not a draft
  • 429You're over the rate limit
  • 500Something went wrong on our side

Every error has the same shape. See Errors.

cURL
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
JavaScript
import { 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();
Python
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
201
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "file_name": "timesheet-march.pdf",
  "content_type": "application/pdf",
  "size_bytes": 48213,
  "sha256": "string",
  "created_at": "string"
}