Docs

Unpublish a document

Unpublish with expectedRevision: the storefront URL answers 404 from the next request and pdf custom facts referencing the document project as absent. Copies clients already downloaded cannot be recalled. 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 stale expectedRevision returns 409 revision_conflict with the document's currentRevision in the required details. Requires media:write. Never gated by catalogue_pdf_publishing_enabled: hiding a document always works, even when the rollout flag is off. 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/{documentId}/unpublish

Unpublish with expectedRevision: the storefront URL answers 404 from the next request and pdf custom facts referencing the document project as absent. Copies clients already downloaded cannot be recalled. 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 stale expectedRevision returns 409 revision_conflict with the document's currentRevision in the required details. Requires media:write. Never gated by catalogue_pdf_publishing_enabled: hiding a document always works, even when the rollout flag is off. 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.

Path Parameters

documentId*string

Document UUID scoped to the integration operator; see Id.

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

Request Body

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

Response Body

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.

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/497f6eca-6276-4993-bfeb-53cbbbba6f08/unpublish' \  -H 'Content-Type: application/json' \  -d '{  "expectedRevision": 1}'
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"}