NuminaDevelopers
Dashboard
Add files to an empty attachment

Add files to an empty attachment

POST
/v1/attachments/{id}/files

Uploads the files of an attachment (bilag) that has none yet, including on booked transactions: documenting a posting does not change it. Send up to 10 files at once; they become the pages of the one attachment. An attachment that already has files is refused with 409 attachment_not_empty, so a retried request never adds the files twice. GET /v1/ledger-entries shows attachment_id and attachment_number per entry. Numina does not read the files unless run_ocr is "true".

Requires one ofdocuments:writewrite:draftwrite:ledger

Path parameters

  • idstring (uuid)Required
    Attachment id: id from GET /v1/attachments, or attachment_id from GET /v1/ledger-entries

Body

multipart/form-data

  • filesarray of filesRequired
    1–10 files (PDF, PNG, JPG or JPEG; max 10MB each), in page order. All files must have the same type, and each file's content must match its declared type.
  • run_ocrstring
    If "true", Numina reads the files (OCR) so the document becomes searchable. Defaults to "false".
    One oftruefalse

Errors

  • 400The upload is missing, too large, or not a valid file
  • 401Invalid or missing authentication
  • 403Missing scope, or the company is archived
  • 404The resource does not exist in this company
  • 409The attachment already has files
  • 429Rate limit exceeded
  • 500Internal Server Error

Every error has the same shape. See Errors.

cURL
curl -X POST https://api.numina.app/v1/attachments/550e8400-e29b-41d4-a716-446655440000/files \
  -H "Authorization: Bearer numi_YOUR_API_KEY" \
  -F files=@receipt.pdf
JavaScript
import { openAsBlob } from "node:fs";

const form = new FormData();
form.append("files", "@receipt.pdf");

const response = await fetch("https://api.numina.app/v1/attachments/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/attachments/550e8400-e29b-41d4-a716-446655440000/files",
    headers={
        "Authorization": f"Bearer {os.environ['NUMINA_API_KEY']}",
    },
    data={"files": "@receipt.pdf"},
)
data = response.json()
Response
201
{
  "attachment": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "file_name": "string",
    "status": "uploaded",
    "created_at": "string",
    "attachment_number": 185
  },
  "files": [
    {
      "file_name": "string",
      "sha256": "string"
    }
  ]
}