Docs

Management API

Server-side endpoints for reading event schedules and syncing custom activity definitions, translations and PDF documents.

Early access. Use the API base, channel key and allowed origins supplied by Buchung before running examples. Interactive API requests are disabled here.

Advanced backend integration

Use these twenty-two /management operations from a trusted backend to read event schedules or sync custom activity data and PDFs. Operators can manage these resources in the Buchung dashboard.

Authentication

Send a server-side integration token issued by Buchung on request:

Authorization: Bearer bg_it_<32 lowercase hex characters>

An integration token acts as the integration itself, not as a staff member. It is bound to one operator and a fixed list of capabilities, and it carries no access to participant or booker data.

Never place bg_it_ credentials in browser code, public config or logs, and always authorize callers in your own backend. Storefront keys (bg_st_) never authorize management operations, and management tokens never authorize checkout handoffs.

Management endpoints do not use the Buchung-Locale header; translations are addressed explicitly with ?locale=.

  • Definition and value reads require activities:read; writes require activities:write.
  • Event reads require events:read and use the operator assigned to the credential.
  • PDF upload prepare/finalize/create/replace require media:upload; status/list/get require media:read; rename/publish/unpublish/delete require media:write.
  • Invalid, revoked or ungranted credentials return 401 unauthorized; missing scopes return 403 forbidden; foreign or unknown IDs return 404 not_found.

Events

  • GET /v1/management/events lists events visible in the operator's dashboard event list. An event matches when it overlaps the inclusive from and to calendar dates (YYYY-MM-DD, years 1900 to 9998) in the operator's time zone. from defaults to today, so the list includes events that ended earlier today. Omit to for an open end. The window computes the day after to as its exclusive upper bound, which must remain a representable four-digit-year instant. Use query to search for keywords in the internal title and handle. The 80-character limit bounds input to the full-text search.
  • GET /v1/management/events/{eventId} returns one event with up to 100 current availabilities. Each availability includes its ID, activity, variation, start and end. Check availabilitiesTruncated for larger events. Missing, deleted, hidden and foreign events return 404 not_found.

Both responses include timeZone and evaluatedAt, the instant used to evaluate event timing and the default list date. Timestamps include the operator's UTC offset at each instant. Event reads carry no registration or occupancy data. Registration reads are unavailable to integration tokens, because those tokens carry no access to personal data.

List responses contain items, nextCursor and totalCount, the exact number of matches in that request’s snapshot, including when the page is empty. The default limit is 20 and the maximum is 100. Repeat the same filters and limit with cursor=nextCursor until nextCursor is null. The cursor preserves a defaulted from across midnight. Each request takes a fresh snapshot, so totals can change. If a cursor returns 400 validation_failed, restart from the first page. If you pass only a past to, include an explicit from or use a later to. A database statement timeout on the list endpoint returns retryable 503 count_timeout.

Custom definitions and value types

Each operator may have up to 200 active (non-retired) definitions. Keys match ^[a-z][a-z0-9-]{1,63}$ and cannot be reused after retirement. Labels map explicit supported locale keys (case-insensitive) to strings up to 120 characters. Choice definitions also accept optionLabels.

TypeValue and limitsDefinition constraints
textTrimmed plain string (never rendered as HTML)maxLength 1–4000 (default 1000)
text_listString array (max 500 chars per item); replaces the whole list per localemaxItems 1–50 (default 20)
booleanStrict JSON boolean (absence differs from false){}
numberFinite JSON number with absolute value at most 1e15, no roundingOptional integer, min, max, precision (0–6)
choiceDeclared option key (^[a-z0-9][a-z0-9_-]{0,63}$)options array ([{ key }]), max 100
jsonAny valid JSON including null (max 16 KiB UTF-8, depth 16, 5000 nodes){}
pdf{ documentId } referencing a live catalogue PDF OperatorDocument of the same operator{}

Only text, text_list, json and pdf may set localized: true. Type and localization are immutable after creation; updates may widen constraints or edit labels, never narrow constraints or remove in-use choice keys.

Example POST /management/custom-definitions body (creates an initially unexposed localized text definition):

{
  "key": "packing-note",
  "type": "text",
  "localized": true,
  "constraints": { "maxLength": 1000 },
  "labels": { "en": "Packing note", "nl": "Pakadvies" }
}

GET /management/custom-definitions returns all active definitions (add ?includeRetired=true to also include up to 500 recently retired definitions) with valueCount.

Translations and optimistic concurrency (expectedRevision)

GET /management/activities/{id}/custom-values returns every stored translation with its revision and no fallback (locale: null for invariant values). For localized definitions, PUT and DELETE require ?locale=<code>; for invariant definitions, omit locale. Unsupported locales return 400 validation_failed.

Example PUT /management/activities/{id}/custom-values/{definitionId}?locale=en:

{
  "value": "Bring a waterproof jacket.",
  "expectedRevision": null
}

Pass expectedRevision: null when creating a new value, or the stored integer revision when updating or deleting (for DELETE, send expectedRevision in the JSON body). Revisions increase monotonically (gaps are normal; compare for equality only). A stale write returns 409 revision_conflict with details.currentRevision (nullable) and optional currentValue:

{
  "error": {
    "code": "revision_conflict",
    "message": "The value is currently absent",
    "doc_url": "https://api.buchungapp.com/v1/docs#errors/revision_conflict",
    "request_id": "example-management-conflict",
    "details": { "currentRevision": null }
  }
}

Reconcile against currentRevision / currentValue before retrying.

Exposing and retiring definitions

New definitions start private (exposed: false). Call POST /management/custom-definitions/{id}/exposure with { exposed, expectedRevision } to toggle public projection in Activity.customFacts. Enabling exposure publishes existing valid values on published/unlisted activities and returns affectedValueCount.

Call POST /management/custom-definitions/{id}/retire with { expectedRevision } to block new writes and stop public projection while retaining stored values for management reads (and cleanup deletes).

On public reads, localized text, text_list and json values fall back from requested locale to operator default; localized pdf values require an exact locale match.

Publishing PDF documents

A PDF is an operator-level OperatorDocument with a stable documentId, displayName, validated file, revision, published flag and referenceCount. PDF preparation, creation and publication must be enabled for the operator (otherwise they return 403 forbidden; unpublishing is always allowed). Only catalogue-PDF documents appear in /management/documents.

  1. Prepare: POST /management/documents/uploads with fileName, byteSize (1 to 20,971,520) and mimeType: "application/pdf" (optional activityId is attribution only). Returns uploadSessionId, signed uploadUrl (do not log) and expiresAt.
  2. Upload and finalize: upload bytes to uploadUrl, then call POST /management/documents/uploads/{id}/finalize (poll GET /management/documents/uploads/{id} as needed). status: "ready" returns mediaId; structural validation failures return 200 with status: "failed" and reason.
  3. Create: POST /management/documents with candidateMediaId and displayName to mint the unpublished OperatorDocument.
  4. Publish: POST /management/documents/{documentId}/publish with expectedRevision. Its url resolves through the storefront's document route (302 to a short-lived signed URL).
  5. Reference: assign { "documentId": "..." } to a pdf custom definition via PUT /management/activities/{id}/custom-values/{definitionId} (with ?locale= if localized).
  6. Replace, rename, unpublish or delete: POST /management/documents/{documentId}/file swaps in a new ready candidate while keeping all links intact. PATCH renames. POST .../unpublish hides the file on the next request (already-downloaded copies cannot be recalled). DELETE (with expectedRevision in the JSON body) requires referenceCount === 0; if references remain (including on archived activities or event attachments), it returns 409 document_referenced with referenceCount and up to 50 deletable custom-value slots in references ({ activityId, handle, archived, definitionId, key, locale, revision }). Delete those values via DELETE /management/activities/{activityId}/custom-values/{definitionId} (using expectedRevision and ?locale= when non-null; works for retired definitions and archived activities) and detach any event attachments in the dashboard before retrying deletion.

Example createDocument body:

{
  "candidateMediaId": "22222222-2222-4222-8222-222222222222",
  "displayName": "Trip notes"
}

Example prepareDocument body:

{
  "activityId": "11111111-1111-4111-8111-111111111111",
  "fileName": "trip-notes-en.pdf",
  "byteSize": 48213,
  "mimeType": "application/pdf"
}

Example putValue body for a pdf definition:

{
  "value": { "documentId": "33333333-3333-4333-8333-333333333333" },
  "expectedRevision": null
}

Errors and limits

  • Request bodies: capped at 64 KiB across all methods with a body, including DELETE (413 payload_too_large). PDF uploads allow up to 20 MiB.
  • Per-activity custom-value budget: 64 KiB serialized cumulative values at write time (400 validation_failed); storefront list pages enforce a 4 MiB custom-fact read budget.
  • Upload validation: upload endpoints return 422 validation_failed for ineligible requests; putValue returns 400 validation_failed for an unusable documentId.
  • Rate limits: 600 reads/minute and 300 writes/minute per machine across its credentials (429 rate_limited). During a limiter outage, writes fail closed with 503 service_unavailable (Retry-After: 30). Writes are not idempotent in general; inspect current state before retrying uncertain outcomes.