Locales, dates and pagination
Canonical rules for Buchung-Locale headers, timezone rendering, date filters and cursor pagination.
Early access. Use the API base, channel key and allowed origins supplied by Buchung before running examples. Interactive API requests are disabled here.
GET /activities?limit=20
X-Buchung-Channel-Key: <provisioned-channel-key>
Buchung-Locale: enHow do I select a locale?
On every storefront read, Buchung-Locale is optional: omission or a well-formed but unsupported value applies the operator's default locale; a supported explicit value selects that exact locale, Content-Language always reports the applied locale, and Buchung-Locale-Fallback reports the requested value only when unsupported; malformed values return 400 validation_failed.
Only checkout.createHandoff requires a supported Buchung-Locale: absence or malformed values return 400 validation_failed, and well-formed unsupported values return 400 locale_not_supported with details naming the requested and supported locales.
Call site.get (GET /site) to discover the operator's locale, supported locales (code, isDefault) and defaultLocale. This is recommended, not a prerequisite for other reads. There is no lang query parameter or handoff body field.
Locale syntax is 2–3 ASCII letters followed by up to three hyphen-separated 1–8 character alphanumeric subtags (max 35 characters). Matching is case-insensitive and normalizes to the stored code.
If an operator's default is en and a read requests the well-formed but unsupported fr-CA, the response returns both headers:
HTTP/1.1 200 OK
Content-Type: application/json
Content-Language: en
Buchung-Locale-Fallback: fr-CA
Vary: Buchung-Locale, Origin, X-Buchung-Channel-Key
Cache-Control: private, no-storeAccept-Language is never consulted, and there is no auto mode. In a browser app, read navigator.language, match it against the supported locales from site.get, and send the chosen code explicitly in Buchung-Locale.
Field-level fallback: within a supported locale, individual text fields without a translation fall back to the operator's default language (Content-Language still reports the applied request locale). Localized PDF custom facts require an exact locale match and do not silently fall back.
How do date filters and timezones work?
Filter by date with where: { availability: { startDate: { from, to } } }. Both from and to are inclusive YYYY-MM-DD calendar dates evaluated in the operator's time zone (at least one bound required; to >= from). includePast defaults to false.
Timestamp fields (startsAt, endsAt) are absolute instants with an explicit offset (such as Z). Never render them in the visitor's browser time zone: format startsAt in the departure location's timezone and endsAt in the arrival location's timezone when present, falling back independently to the availability's operator-default timeZone. See site metadata, locations & trust.
How do I paginate safely?
Follow nextCursor until it is null, passing the token in GET cursor or POST body cursor. Keep every other query parameter identical (scope, locale, where, collectionId, facets, includePast, limit). Cursors are opaque (max 4 KiB); a malformed or mismatched cursor returns 400 validation_failed, so restart from page 1. Default limit is 20 (range 1–100).
- Ordering: activities sort by authored weight ascending (null last), then UUID. Availabilities sort by effective start time ascending, then UUID.
- Snapshots: each request computes items,
totalCountand facet counts from a single snapshot (evaluatedAt). Later pages take fresh snapshots, so totals can change if inventory updates between pages. - Collections: restart without
cursorif you change collections or filters, or if an edit changes which activities the collection is configured to select. Reordering or removing duplicate entries in the same selection keeps the cursor valid. If a cursor saved before the collection query update returns400 validation_failed, restart from the first page. - Display groups: an availability page can split an event/activity display group across page boundaries; use activity-scoped reads when rendering a full option chooser.
- Count timeouts: retry
503 count_timeoutwith backoff instead of displaying0or an estimate.
Browser caching and CORS
The API exposes Content-Language and Buchung-Locale-Fallback through CORS and responds with Cache-Control: private, no-store and Vary: Buchung-Locale, Origin, X-Buchung-Channel-Key. Always include the applied locale in any client-side cache key.