Docs

Create a document

Create an unpublished document from the mediaId of a ready catalogue document upload, which the document then owns. 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. A candidate of another operator, one that is not a validated catalogue PDF or one another document already owns returns 400 validation_failed. Requires media:upload and catalogue_pdf_publishing_enabled for the operator. When disabled, returns 403 forbidden with a message naming the catalogue_pdf_publishing_enabled rollout flag. 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.

POST
/v1/management/documents

Create an unpublished document from the mediaId of a ready catalogue document upload, which the document then owns. 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. A candidate of another operator, one that is not a validated catalogue PDF or one another document already owns returns 400 validation_failed. Requires media:upload and catalogue_pdf_publishing_enabled for the operator. When disabled, returns 403 forbidden with a message naming the catalogue_pdf_publishing_enabled rollout flag. 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.

Authorization

integrationBearer
headerAuthorizationBearer <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.

Request Body

application/json
  1. body

Create an unpublished document from a validated upload candidate, which the document then owns. Host caps this JSON body at 64 KiB before parsing.

candidateMediaId*string

mediaId 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.

Match^([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})$
Formatuuid
displayName*DocumentDisplayName

Display 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.

Match^[^\u0000-\u001F\u007F]+$
Length1 <= length <= 255

Response Body

Success

application/json
  1. 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*string

Stable document UUID. Custom fact references and the storefront URL keep it across file replacement and renaming.

Match^([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})$
Formatuuid
displayName*DocumentDisplayName

Display 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.

Match^[^\u0000-\u001F\u007F]+$
Length1 <= length <= 255
published*boolean
publishedAt*|

When the current publication began; null while unpublished.

revision*Revision

Monotonic 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.

Range1 <= value <= 9007199254740991
file*

Current validated PDF. Its bytes stay in the private bucket; there is no public storage URL.

referenceCount*integer

Total 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.

Range0 <= value <= 9007199254740991
url*|

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.

Example Request
curl -X POST 'https://api.buchungapp.com/v1/management/documents' \  -H 'Content-Type: application/json' \  -d '{  "candidateMediaId": "36af28b3-a95f-4fc0-9c29-e671061152bf",  "displayName": "string"}'
Example Response
{  "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"}