What this call does

Attaches one or more files to a business document that already exists, the signed delivery note as a PDF, a photo of damaged goods, the scanned invoice.

Last updated: 15.05.2026

What you need first

  • A valid API key in the API-Key header, and your companyAccountId.
  • The businessDocumentId, the id field from Search business documents.
  • Per file either an address CATHAGO can fetch (documentUrl) or the file itself (fileInBytes).

Parameters

Parameter

Required

Default

Meaning

businessDocumentId

Yes

none

In the path after /documents/. The CATHAGO ID of the document.

companyAccountId

Yes

none

Your company ID, in the address line.

The fields

The data packet is a list; each entry is one file. The example shows both ways: once through an address, once with the file itself.

Field

Type

Required

Default

Meaning

documentUrl

text

One of the two

(none)

An address CATHAGO can fetch without logging in. A link inside your own network will not work.

fileInBytes

text

One of the two

(none)

The file itself, as a Base64 string.

documentName

text

No

(none)

File name with extension.

documentFormat

choice

No

(none)

PDF, DOC, DOCX, JPEG, JPG, PNG, CSV, XLSX, XLS, XML, JSON, DAT, WDA.

externalId

text

No

(none)

Your own number for this file, handed straight back.

Send both and fileInBytes wins. Send neither and the entry is dropped in silence: the call returns 200 and the file never appears. There is no attachmentType field to send.

What you get back

200 OK with the document's whole file list, not just the files you added, pick out your new ones by externalId. Each entry carries id, externalId, documentId, url, fileName, attachmentType, createdAt and lastModifiedAt. Anything empty is left out.

id is the attachment's CATHAGO ID and the only value Remove files from a business document accepts, not externalId (your own number), not documentId (the file's ID in the file store). url is where the file now lives; attachmentType is set by CATHAGO, with values such as PDF, INVOICE and ORDER_DELIVERY_NOTE.

Common mistakes

What you see

Why

What to do

404 Not Found

The businessDocumentId does not exist

Fetch the ID with Search business documents.

401 Unauthorized

Key missing, wrong, or not entitled to that companyAccountId

Check the key and the company.

200 OK but the file is not in the list

The entry had neither documentUrl nor fileInBytes

Send one of the two.

The file never arrives from documentUrl

The address needs a login, or is only reachable inside your network

Open it in a private browser window with no session. If it does not open there, CATHAGO cannot fetch it either.

The delete call does not find the attachment

The documentId or the externalId was used instead of id

Only id identifies an attachment for deletion.

The same file is attached twice

Nothing checks externalId for uniqueness

Check attachedFiles before re-sending.

What we could not confirm

  • The largest file fileInBytes will carry. Nothing here caps it, so a very large file can still be refused for its size. Serving big files through documentUrl avoids the question.

Adresse

HTTP
POST https://api.cathago.de/v3/api/gateways/integration/documents/:documentId/attachments?companyAccountId=<companyAccountId>

Beispielaufruf

Terminal
curl -X POST 'https://api.cathago.de/v3/api/gateways/integration/documents/:documentId/attachments?companyAccountId=<companyAccountId>' \
  -H 'API-Key: <Ihr API-Schlüssel>' \
  -H 'Content-Type: application/json' \
  -d '[
  {
    "externalId": "ANH-2026-018223-3",
    "documentUrl": "https://erp.weber-bau.de/belege/lieferschein-LS-2026-009914.pdf",
    "documentName": "lieferschein-LS-2026-009914.pdf",
    "documentFormat": "PDF"
  },
  {
    "externalId": "ANH-2026-018223-4",
    "fileInBytes": "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQ==",
    "documentName": "schadensfoto-matte-01.jpg",
    "documentFormat": "JPG"
  }
]'

Beispiel für den Body

JSON
[
    {
        "externalId": "ANH-2026-018223-3",          // Optional. Your own number for the file, handed straight back
        "documentUrl": "https://erp.weber-bau.de/belege/lieferschein-LS-2026-009914.pdf", // Send this OR fileInBytes. Must be reachable without logging in
        "documentName": "lieferschein-LS-2026-009914.pdf", // Optional. File name with extension
        "documentFormat": "PDF"                     // Optional. PDF, DOC, DOCX, JPEG, JPG, PNG, CSV, XLSX, XLS, XML, JSON, DAT, WDA
    },
    {                                               // Second entry - the file itself instead of an address
        "externalId": "ANH-2026-018223-4",
        "fileInBytes": "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQ==", // Send this OR documentUrl. The file as Base64, shortened here
        "documentName": "schadensfoto-matte-01.jpg",
        "documentFormat": "JPG"
    }
]

Beispielantworten

Add files in document

Status: 200 OK

JSON
[
  {
    "externalId": "<string>",
    "documentId": "<string>",
    "url": "<string>",
    "fileName": "<string>",
    "attachmentType": "<string>",
    "id": "<string>",
    "createdAt": "<2025-12-02T04:56:10.270Z>",
    "lastModifiedAt": "<2025-12-02T04:56:10.270Z>"
  }
]