JustFlows

Bookings · Developers

Build on Bookings

Follow bookings from your own plugin, sell services through a commerce provider, add a calendar provider, or script the schedule with a staff session.

What you can build

Your own booking front end

The public routes give free times, holds, and bookings without a session. Build a headless booking flow, or a kiosk.

Plugins that follow bookings

Listen for justflows.bookings.* events: bookings, holds, payments, and credits, with identifiers and times only.

Another store or calendar

Sell services from your own commerce plugin, or add a calendar provider, through the same contracts Shop uses.

AI agents

bookings_* MCP tools cover the schedule, classes, credits, and reports, with the admin's checks and without sensitive details.

Base URL

text
https://your-site.example/api/bookings/v1

Paths in this reference are relative to the base URL. A route only ever sees and changes the current site’s records: an id, token, or key from another site is unknown here.

Who can call a route

KindPathsHow
staffeverything outside /public and /accountA signed-in session (jf_session), an API key, or an MCP agent with the route's capability. Writes send the CSRF token as x-csrf-token.
public/public/…No session. Writes skip the CSRF token but must come from a page on this site (the host's trusted-origin check), and leave the honeypot field website empty.
customer/account/…The signed-in customer, on their own bookings and credits and the participants they may act for. Writes send the CSRF token.
plugin/linked/…Another plugin only, through ctx.plugins.call. A commerce provider reports payment outcomes and credits here, only for itself.
A booking flow on any page of the site
const API = "https://your-site.example/api/bookings/v1";

// 1. Free start times for a service.
const { slots } = await (await fetch(`${API}/public/availability?service=${serviceId}&from=2026-12-14`)).json();

// 2. Hold one while the visitor fills in their details.
const { hold } = await (await fetch(`${API}/public/holds`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ serviceId, start: slots[0].start, key: crypto.randomUUID() }),
})).json();

// 3. Turn the hold into a booking. A paid service answers with paymentUrl.
const { booking } = await (await fetch(`${API}/public/bookings`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ holdId: hold.id, name: "Sam Jansen", email: "sam@example.com", consent: true }),
})).json();
if (booking.paymentUrl) location.href = booking.paymentUrl;
A staff script in the admin's browser session
const API = "https://your-site.example/api/bookings/v1";
const csrf = document.cookie.match(/(?:^|; )jf_csrf=([^;]+)/)?.[1];

// Today's live bookings, then check the first one in.
const { items } = await (await fetch(`${API}/bookings?from=2026-12-14&to=2026-12-14&status=live`, { credentials: "include" })).json();

await fetch(`${API}/bookings/${items[0].id}/transition`, {
  method: "POST",
  credentials: "include",
  headers: { "Content-Type": "application/json", "x-csrf-token": csrf },
  body: JSON.stringify({ to: "checked_in" }),
});

Errors

Failures use one envelope with a stable code. Input problems (422) list each field in details.fields. Messages are English and may change; codes do not.

json
{ "error": { "code": "invalid", "message": "Some fields need attention.", "details": { "fields": [{ "field": "email", "message": "Enter an email address." }] } } }
CodeMeaning
unauthorized (401)The route needs a signed-in customer.
forbidden (403)The session lacks the capability, the request came from another site, or Bookings is off for this website.
not_found (404)No such record here, or one the session may not see. Both look the same.
invalid (422)A field is missing or wrong; see details.fields.
slot_taken, slot_unavailable, hold_expiredThe time was taken, no longer fits the rules, or the hold lapsed. Pick another time.
version_conflictSomeone saved first. Read the record again and resend with the new expectedVersion.
policy_noticeA customer change inside the service's cancellation or reschedule notice.
no_credit, limit_reached, no_guest_pass, options_not_coveredBooking with credits was refused: none left, a plan limit, no guest pass, or options that cost extra.
booking_blocked (403)Online booking is paused for this customer after strikes; details.until says until when.
session_full, enrolment_closed, ineligibleClass places: full, outside enrolment dates, or the participant does not meet the class's rules.
payments_forbidden (403)Confirming without the payment the service asks for needs bookings:payments.
payments_unavailable (503)The service is paid and its commerce plugin is not answering. Nothing was reserved.

Rate limits

Limits are per IP address.

RoutesLimit
Staff reads240 a minute
Staff writes120 a minute
Public reads (services, availability, timetable)120 a minute
Public writes: holds, bookings, class holds, class waiting lists, enrolments30 per 10 minutes
Appointment waiting list, guest-link changes, waiting-list offers20 per 10 minutes
Calendar feeds60 a minute
Calendar change notifications120 a minute
Account reads60 a minute
Account writes and check-in30 per 10 minutes; participant changes 60 per 10 minutes; invitations 10 an hour

Lists, paging, and repeats

  • Lists cap limit at 500. GET /bookings pages with next: send it back as after; it is null at the end. Filters apply before the limit.
  • Holds take a key; the same key returns the same hold. Series, credit grants, and adjustments take key too, and payment and credit messages carry eventKey. A repeat with the same key changes nothing.
  • Saves of services, classes, and other versioned records take expectedVersion.

What a session sees

A booking always shows its number, status, times, service, team member, location, and payment and credit state. Contact details (customerEmail, customerPhone, userId) need bookings:customers; notesPrivate needs the right to change that booking; paymentProvider, paymentLabel, paymentRef, paymentUrl, and entitlementId need bookings:payments. Hidden parts are null and named in hidden.

Limits

WhatLimit
Availability window31 days, 1 000 slots
List page500
Report period366 days, 20 000 bookings
Recurring series2–52 occurrences
Linked calendars5 per owner, 200 per site; 2 000 busy periods each