Replace a document's file
Swap the current file for another validated upload candidate in one step, with expectedRevision. Every custom fact reference and the storefront URL follow; publication is unchanged, and the previous file is deleted. Bytes never leave the private bucket. The document URL is the storefront's own route, which answers a 302 to a short-lived signed URL of the current file only while the document is published, so unpublishing takes effect on the next request. An unusable candidate returns 400 validation_failed as on createDocument. A stale expectedRevision returns 409 revision_conflict with the document's currentRevision in the required details. Requires media:upload. Machine integration bearer credentials only; storefront channel keys never authorize these operations. Buchung-Locale is not used; translations are addressed explicitly. Host enforces a 64 KiB request-body cap before parsing for every method with a body, including DELETE. Per-machine limits: 600 reads/minute, 300 writes/minute; over limit returns 429 rate_limited. Limiter store outage falls back to per-instance memory for reads; writes return 503 service_unavailable with Retry-After: 30.
Early access. Use the API base, channel key and allowed origins supplied by Buchung before running examples. Interactive API requests are disabled here.
Swap the current file for another validated upload candidate in one step, with expectedRevision. Every custom fact reference and the storefront URL follow; publication is unchanged, and the previous file is deleted. Bytes never leave the private bucket. The document URL is the storefront's own route, which answers a 302 to a short-lived signed URL of the current file only while the document is published, so unpublishing takes effect on the next request. An unusable candidate returns 400 validation_failed as on createDocument. A stale expectedRevision returns 409 revision_conflict with the document's currentRevision in the required details. Requires media:upload. Machine integration bearer credentials only; storefront channel keys never authorize these operations. Buchung-Locale is not used; translations are addressed explicitly. Host enforces a 64 KiB request-body cap before parsing for every method with a body, including DELETE. Per-machine limits: 600 reads/minute, 300 writes/minute; over limit returns 429 rate_limited. Limiter store outage falls back to per-instance memory for reads; writes return 503 service_unavailable with Retry-After: 30.
integrationBearerAuthorizationBearer <token>Machine integration credential: Authorization: Bearer bg_it_<32 lowercase hex characters> (^bg_it_[0-9a-f]{32}$). Resolved uncached on each request. Middleware binds the resolved principal once; handlers run under it and never re-derive authority. The request context includes credentialId for per-request logging alongside machineId, operatorId, organizationId and capabilities; the principal is opaque and server-owned. Storefront channel keys never authorize management operations; machine credentials never authorize storefront checkout handoffs. Invalid, expired, revoked, disabled or ungranted credentials return 401 unauthorized.
documentId*stringDocument UUID scoped to the integration operator; see Id.
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$uuidapplication/json- body
Swap the document's current file for another validated upload candidate in one step; every reference and the storefront URL follow, and the previous file is deleted.
candidateMediaId*stringmediaId of a ready catalogue document upload (DocumentUploadStatus): a validated catalogue PDF of the same operator that no document owns yet. Anything else returns 400 validation_failed.
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$uuidexpectedRevision*RevisionMonotonic integer optimistic-concurrency revision assigned from a database sequence, starting at 1. Not dense: gaps are normal. Clients compare equality only. A value slot never reuses a revision across delete/recreate, so a stale expectedRevision always conflicts.
1 <= value <= 9007199254740991Operator-level document with a stable id, a display name, one current validated PDF and a published flag. Bytes never leave the private bucket. The URL is the storefront's own route, which answers a 302 to a short-lived signed URL of the current file only while the document is published, so unpublishing takes effect on the next request; copies clients already downloaded cannot be recalled.
application/json- response
Operator-level document with a stable id, a display name, one current validated PDF and a published flag. Bytes never leave the private bucket. The URL is the storefront's own route, which answers a 302 to a short-lived signed URL of the current file only while the document is published, so unpublishing takes effect on the next request; copies clients already downloaded cannot be recalled.
documentId*stringStable document UUID. Custom fact references and the storefront URL keep it across file replacement and renaming.
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|[fF]{8}-[fF]{4}-[fF]{4}-[fF]{4}-[fF]{12})$uuiddisplayName*DocumentDisplayNameDisplay name of a document, 1 to 255 characters with no control characters (U+0000-U+001F, U+007F). The storefront fileName is the display name with .pdf, and the slug of the document URL derives from it.
^[^\u0000-\u001F\u007F]+$1 <= length <= 255published*booleanpublishedAt*|When the current publication began; null while unpublished.
revision*RevisionMonotonic integer optimistic-concurrency revision assigned from a database sequence, starting at 1. Not dense: gaps are normal. Clients compare equality only. A value slot never reuses a revision across delete/recreate, so a stale expectedRevision always conflicts.
1 <= value <= 9007199254740991file*Current validated PDF. Its bytes stay in the private bucket; there is no public storage URL.
referenceCount*integerTotal references that block deletion: custom fact values (including on archived activities) plus event attachments. Deletion is refused with 409 document_referenced while it is above zero; that error lists the custom fact value slots.
0 <= value <= 9007199254740991url*|While published, the storefront's own document route (/documents/{documentId}/{slug}.pdf on the operator's storefront host); null while unpublished. The slug is cosmetic.
curl -X POST 'https://api.buchungapp.com/v1/management/documents/497f6eca-6276-4993-bfeb-53cbbbba6f08/file' \ -H 'Content-Type: application/json' \ -d '{ "candidateMediaId": "36af28b3-a95f-4fc0-9c29-e671061152bf", "expectedRevision": 1}'{ "documentId": "4704590c-004e-410d-adf7-acb7ca0a7052", "displayName": "string", "published": true, "publishedAt": "2019-08-24T14:15:22Z", "revision": 1, "file": { "size": 1, "validatedAt": "2019-08-24T14:15:22Z" }, "referenceCount": 0, "url": "http://example.com"}