What this call does

Removes attached files from a framework contract, and deletes the stored files behind them.

Last updated: 15.05.2026

What you need first

A valid API key in the API-Key header, your companyAccountId, the CATHAGO id of the contract, and the attachment ids, the id of each entry in the contract's attachments, read from Show one contract or from the answer of Add extra files to a contract. They are not the documentId.

Parameters

Parameter

Required

Default

Meaning

contractId

Yes

none

In the address line. The CATHAGO id of the contract.

companyAccountId

Yes

none

In the address line. Required, but not checked against the contract.

The fields

The request is a plain list of text ids, not a list of objects.

Field

Type

Required

Default

Meaning

(each entry)

text

Yes

none

One attachment id, e.g. CqB2605151902334471. List as many as you like. Ids that match nothing on this contract are ignored.

One id in this list is not an attachment id. Pass the contract's contractFileDocumentId and CATHAGO also clears the main contract file: contractFileDocumentId, contractFilePublicUrl and contractFileName are emptied and the file is deleted. It is easy to trigger by accident when a list of document ids is pasted in by mistake.

What you get back

204 No Content with an empty body. You get 204 whether ids were removed or none of them matched, so the status code alone does not tell you anything happened.

The stored file behind each removed attachment is deleted too, unless another attachment on the same contract still points at the same documentId, in which case the file is kept. To confirm what happened, call Show one contract afterwards and look at attachments.

Common mistakes

What you see

Why

What to do

204 but the attachment is still there

The ids sent were documentId values, not attachment id values

Read attachments[].id from Show one contract and send those.

The main contract file disappeared too

The contract's contractFileDocumentId was in the list

Send only attachment ids. Re-attach the file with Set the main contract file.

500, Contract not found for ID: …

The contract id does not exist; there is no 404 here

Use the CATHAGO id, not your externalId.

400 Bad Request, or 401 Unauthorized

The body is not a plain list of quoted ids, or the // comments are still in it; or the key is missing, unknown, disabled or expired

Send quoted ids only, without comments. Check the API-Key header.

The file is still reachable at its old address

Deleting the stored file failed, and that failure is swallowed, so you still got 204

Retry, and raise it with your CATHAGO contact if it persists.

Adresse

HTTP
DELETE https://api.cathago.de/v3/api/gateways/integration/contracts//attachments?companyAccountId=<companyAccountId>

Beispielaufruf

Terminal
curl -X DELETE 'https://api.cathago.de/v3/api/gateways/integration/contracts//attachments?companyAccountId=<companyAccountId>' \
  -H 'API-Key: <Ihr API-Schlüssel>' \
  -H 'Content-Type: application/json' \
  -d '[
  "CqB2605151902334471",
  "CqB2605151902334472"
]'

Beispiel für den Body

JSON
[
    "CqB2605151902334471",                          // An attachment id, NOT a documentId. Read it from attachments[].id on Show one contract
    "CqB2605151902334472"                           // Second attachment - list as many as you like. Ids that match nothing are ignored
]

Beispielantworten

Example 1, remove 2 attachments (204)

Status: 204 No Content

Example 2, remove 1 attachment (204)

Status: 204 No Content

Example 3, 404 contract not found

Status: 404 Not Found

JSON
{
    "timestamp": "2026-05-15T09:26:00Z",
    "status": 404,
    "error": "Not Found",
    "message": "Contract not found for ID: does-not-exist"
}