Appointments
Public booking endpoints for workspaces running the Brandfine Appointments plugin — read availability, submit visitor requests, look up + cancel by token.
Four public endpoints under /external/appointments/*. Three are
workspace-API-key authenticated (X-Api-Key); the visitor-facing
lookup + cancel use a one-time cancellation token instead.
| Method | Path | Auth | Status |
|---|---|---|---|
GET | /external/appointments/availability | X-Api-Key | v1 — returns bookable slots inside the workspace's booking window. |
POST | /external/appointments/requests | X-Api-Key | v1 — submits a visitor's appointment request. Server validates the slot. |
GET | /external/appointments/requests/:token | token in path | Dormant — not called by any first-party SDK or widget. See note in the section below. |
POST | /external/appointments/requests/:token/cancel | token in path | Dormant — same as above. |
All endpoints inherit the permissive /external/* CORS — any
origin may call them with Content-Type: application/json +
X-Api-Key. The site key (brandfine_pk_…) works from the browser
or your server alike; only a verified identity (visitor, and the
lookup below) needs your server, because it is signed with the
identity secret.
The endpoints respond with {"enabled": false, ...}-shaped
responses (instead of throwing) when a workspace has not activated
the Appointments plugin or has toggled "Accepting bookings" off,
so consumer UIs can gracefully degrade.
GET /external/appointments/availability
Returns what a visitor can book inside the workspace's configured window: free slots, and the same by day with the parts of each day that are still free. The server already applies business hours, lead time, booking window, and busy-range filtering — render the response as-is.
The workspace decides what a visitor picks (requestPrecision): an
exact time from slots, a part of a day from days[].parts, or a
whole day from days, and how many options they may give
(requestChoices, 1–3). The team sets the exact time when it
confirms.
Takes the site key in X-Api-Key (a legacy workspace key works too).
Query params
| Param | Type | Notes |
|---|---|---|
from | ISO 8601 string | Optional clamp. Slots before this are excluded. Ignored if it's before the workspace's lead-time floor (server picks the later of the two). |
to | ISO 8601 string | Optional clamp. Slots after this are excluded. Ignored if it's after the workspace's booking-window ceiling. |
Request
GET /external/appointments/availability HTTP/1.1
Host: api.brandfine.co
X-Api-Key: bfwk_xxx
Accept: application/jsonResponse — 200 OK
{
"enabled": true,
"timezone": "Europe/Istanbul",
"slotDurationMinutes": 30,
"leadTimeHours": 24,
"bookingWindowDays": 14,
"policyText": "Please give 24h notice for cancellations.",
"requestPrecision": "part",
"requestChoices": 2,
"slots": [
{ "start": "2026-06-08T06:00:00.000Z", "end": "2026-06-08T06:30:00.000Z" },
{ "start": "2026-06-08T06:30:00.000Z", "end": "2026-06-08T07:00:00.000Z" }
],
"days": [
{
"date": "2026-06-08",
"start": "2026-06-08T06:00:00.000Z",
"end": "2026-06-08T15:00:00.000Z",
"parts": [
{ "part": "morning", "start": "2026-06-08T06:00:00.000Z", "end": "2026-06-08T09:00:00.000Z" },
{ "part": "afternoon", "start": "2026-06-08T11:00:00.000Z", "end": "2026-06-08T15:00:00.000Z" }
]
}
],
"windowStart": "2026-06-05T12:00:00.000Z",
"windowEnd": "2026-06-19T12:00:00.000Z"
}| Field | Type | Notes |
|---|---|---|
enabled | boolean | false = plugin not activated for this workspace, or customer toggled bookings off. Render a "not accepting bookings" state. |
timezone | string | IANA timezone the workspace's business hours are configured in. Render visitor slots in their LOCAL timezone; show this as a small "(host's time: HH:MM)" subtext. |
slotDurationMinutes | number | Always 15/30/45/60 in v1. |
leadTimeHours | number | Minimum notice the customer requires. Slots within this window are already filtered out. |
bookingWindowDays | number | How far ahead booking is open. Slots beyond this date are filtered out. |
policyText | string | null | Free-text policy the customer wrote — surface verbatim before the visitor submits. |
requestPrecision | string | What a visitor picks: "time" (an exact slot), "part" (a part of a day) or "day" (a whole day). |
requestChoices | number | How many options a visitor may give, 1–3. |
slots[] | array | UTC ISO 8601 starts + ends, ordered chronologically. Skipped: confirmed-conflict slots, in-the-past slots, lead-time slots, outside-business-hours slots. |
days[] | array | The days that still have a free slot. date is the workspace's local YYYY-MM-DD (send it back to book); start/end span its business hours (from now, today). parts[] lists the parts of the day with a free slot: morning (opening–12:00), midday (12:00–14:00), afternoon (14:00–closing), in the workspace's timezone, each with its UTC window. A slot belongs to the part it starts in. |
windowStart / windowEnd | string | UTC ISO 8601. The effective range the slots cover after lead-time + booking-window clamps. |
Response — 200 OK (plugin disabled)
{
"enabled": false,
"timezone": "UTC",
"slotDurationMinutes": 30,
"leadTimeHours": 0,
"bookingWindowDays": 14,
"policyText": null,
"requestPrecision": "time",
"requestChoices": 1,
"slots": [],
"days": [],
"windowStart": "2026-06-04T07:00:00.000Z",
"windowEnd": "2026-06-04T07:00:00.000Z"
}Same shape, empty slots and days. Do not throw in your UI — render
a "not accepting bookings right now" state instead.
Errors
- 401 Unauthorized — missing or invalid
X-Api-Key.
POST /external/appointments/requests
Submits a visitor's request: the options they picked. The server checks each is still free against availability (business hours, lead time, not in the past, no overlap with confirmed appointments) before accepting. The team confirms it at an exact time, inside what was asked for or not; the visitor is emailed that time.
Request
POST /external/appointments/requests HTTP/1.1
Host: api.brandfine.co
X-Api-Key: bfwk_xxx
Content-Type: application/json
{
"visitorName": "Visitor Name",
"visitorEmail": "visitor@example.com",
"visitorPhone": "+1 555 0100",
"visitorMessage": "Looking to discuss the product.",
"preferences": [
{ "date": "2026-06-08", "part": "morning" },
{ "date": "2026-06-09" }
],
"visitorSessionId": "abc123",
"locale": "en",
"metadata": { "Treatment": "Implant consultation" }
}Fields
| Field | Type | Required | Notes |
|---|---|---|---|
visitorName | string | ✓ | 1–120 chars. |
visitorEmail | string | ✓ | Server-validated. Up to 200 chars. Used as the destination for the "request received" + confirmation/decline emails. |
visitorPhone | string | — | Up to 40 chars. Free-text — no formatting enforced. |
visitorMessage | string | — | Up to 2,000 chars. Shown to the customer in the inbox row. |
preferences | array | ✓ | 1 to requestChoices options, each one of: { "time": "<slot start, UTC ISO 8601>" } from slots; { "date": "YYYY-MM-DD", "part": "morning" | "midday" | "afternoon" } from days[].parts; { "date": "YYYY-MM-DD" } from days. Any precision is taken whatever requestPrecision says; the setting drives what you show. A lone requestedAt (UTC ISO 8601) is read as [{ "time": requestedAt }], for clients from before preferences. |
visitorSessionId | string | — | Up to 120 chars. Cookie-derived session id from your frontend — an unverified soft link across page loads. For real identity use visitor below. |
locale | string | — | The page's locale, up to 35 chars. The visitor's emails (received, confirmed, rescheduled, declined) go out in it when the workspace has it, in English when it doesn't; absent → the workspace's default locale. |
metadata | object | — | A few labelled values to attach to the booking (a chosen treatment, a room type, a vehicle): at most 10 keys of 1–40 chars, each a string of up to 200 chars; anything else is a 400 naming metadata. Stored as sent and shown to the team (inbox, the email to the business, MCP); never shown to the visitor and never interpreted. |
visitor | object | — | Signed host-app identity: { externalId, name?, email?, attributes?, identityToken } — the SAME shape and HMAC Live Chat accepts (identityToken = HMAC_SHA256(identitySecret, externalId), hex; identitySecret is the workspace's identity secret, shared with Live Chat, so liveChat.identityToken() signs for both plugins). Valid → the booking is attributed: verified name/email take precedence, identityVerified: true, and the shared externalId links it to the person's chat threads. Invalid or absent → the booking proceeds anonymously; never a 400. Caps: externalId ≤128, name ≤120, email ≤200, ≤10 attributes (keys ≤40, values ≤100). |
Response — 201 Created
{
"id": "cln9b2k8w0001abc",
"createdAt": "2026-06-04T15:30:00.000Z",
"preferences": [
{ "kind": "part", "part": "morning", "start": "2026-06-08T06:00:00.000Z", "end": "2026-06-08T09:00:00.000Z" },
{ "kind": "day", "start": "2026-06-09T06:00:00.000Z", "end": "2026-06-09T15:00:00.000Z" }
],
"requestedAt": "2026-06-08T06:00:00.000Z",
"durationMinutes": 30,
"status": "PENDING",
"identityVerified": true,
"cancellationToken": "f8d2c1e3a4b5..."
}| Field | Type | Notes |
|---|---|---|
id | string | Request id. |
createdAt | string | ISO 8601 timestamp the request was persisted. |
preferences | array | The options as stored, sorted by start and without repeats: { kind: "time" | "part" | "day", start, end, part? } in UTC. An exact time is one slot long. |
requestedAt | string | The start of the earliest option, UTC. |
durationMinutes | number | Slot duration the workspace had configured at submission time. |
status | string | Always "PENDING" on creation. |
identityVerified | boolean | True iff visitor.identityToken HMAC-verified — your signal that the booking landed attributed rather than anonymous. |
cancellationToken | string | null | One-time-use token for visitor self-cancellation. Embed in your confirmation email / "your appointment" page. |
The server immediately fires two emails (fire-and-forget — failure doesn't fail your request):
- Visitor — "request received, you'll hear back".
- Customer — "new request for X, review in inbox" — sent to
the plugin's configured
notificationEmail, or the team's notification settings if none.
Errors
- 400 Bad Request — validation failed (missing required field, invalid email, a malformed option, or more options than the workspace takes).
- 401 Unauthorized — missing or invalid
X-Api-Key. - 404 Not Found — workspace doesn't have Appointments activated, OR an option is no longer free (outside the window, or taken between the availability fetch and submit). The body's
messagedistinguishes the cases ("not accepting...", "no longer available..."). Fetch availability again and let the visitor pick another.
Retry policy: don't retry on 400 or 404. A taken option won't
appear in /availability again; re-fetch availability and let the
visitor pick another. Do retry on 5xx +
network errors with exponential backoff.
POST /external/appointments/requests/lookup
Identity-scoped read-back — a signed host app fetches the verified
person's own appointments ("where does my request stand?"). POST
rather than GET so the identityToken never lands in proxy logs or
browser history. Takes the site key; the identityToken, signed with
the workspace's identity secret on your server, is the proof.
Request
POST /external/appointments/requests/lookup HTTP/1.1
Host: api.brandfine.co
X-Api-Key: bfwk_xxx
Content-Type: application/json
{
"externalId": "crm-user:abc123",
"identityToken": "hex-hmac…",
"id": "cln9b2k8w0001abc"
}| Field | Type | Required | Notes |
|---|---|---|---|
externalId | string | ✓ | The person's host-app id — must HMAC-verify against identityToken. |
identityToken | string | ✓ | Same signature as createRequest.visitor.identityToken. Unlike booking, a bad signature here is a hard 401 — reads require proof. |
id | string | — | Narrow to one appointment. 404 when the id doesn't exist or belongs to a different person — indistinguishable by design. |
Response — 200 OK
{
"timezone": "Europe/Istanbul",
"appointments": [
{
"id": "cln9b2k8w0001abc",
"status": "CONFIRMED",
"preferences": [
{ "kind": "part", "part": "morning", "start": "2026-06-08T06:00:00.000Z", "end": "2026-06-08T09:00:00.000Z" }
],
"requestedAt": "2026-06-08T06:00:00.000Z",
"scheduledAt": "2026-06-08T07:30:00.000Z",
"durationMinutes": 30,
"timezone": "Europe/Istanbul",
"declineReason": null,
"rescheduleCount": 0,
"respondedAt": "2026-06-05T09:12:00.000Z",
"createdAt": "2026-06-04T15:30:00.000Z"
}
]
}Newest first, capped at 50. preferences is what the person asked
for; scheduledAt is the time the team set, non-null only once
CONFIRMED (after a reschedule it reflects the new time);
declineReason is the customer's note, populated only on
REJECTED. Only bookings created with a verified identity
appear here — anonymous bookings have no externalId to match.
Errors
- 400 Bad Request — missing/oversized fields.
- 401 Unauthorized — invalid
X-Api-Key, or theidentityTokenfailed verification. - 404 Not Found —
idgiven and no matching appointment for this person.
GET /external/appointments/requests/:token
Dormant in v1. The endpoint exists but isn't called by any first-party SDK or widget in v1. The visitor's only browser-side interaction is the initial request submission; all subsequent status changes (approve / decline / reschedule) are driven by the customer in the CMS and communicated via email. This endpoint is kept available for possible future reschedule-respond flows where the email contains a link the visitor clicks to accept a proposed new time.
Visitor-facing lookup. The token IS the auth — no X-Api-Key
required. Returns just enough to render a "your appointment is
confirmed for X" or "this request was already cancelled" page,
without leaking other workspace data.
Request
GET /external/appointments/requests/f8d2c1e3a4b5... HTTP/1.1
Host: api.brandfine.co
Accept: application/jsonResponse — 200 OK
{
"id": "cln9b2k8w0001abc",
"visitorName": "Visitor Name",
"visitorEmail": "visitor@example.com",
"preferences": [
{ "kind": "time", "start": "2026-06-08T06:00:00.000Z", "end": "2026-06-08T06:30:00.000Z" }
],
"requestedAt": "2026-06-08T06:00:00.000Z",
"scheduledAt": null,
"durationMinutes": 30,
"status": "PENDING",
"workspace": { "name": "Touchwise", "slug": "touchwise" }
}status may be any of PENDING | CONFIRMED | REJECTED | CANCELLED. Render accordingly:
| Status | UI suggestion |
|---|---|
PENDING | Show "Cancel" button + what was asked for (preferences). |
CONFIRMED | Show "Confirmed for X" (scheduledAt). No cancel button (token is revoked). |
REJECTED | Show "Unfortunately X was declined". |
CANCELLED | Show "Already cancelled". |
Errors
- 404 Not Found — token unknown, revoked (already-responded request), or already-consumed (cancelled).
POST /external/appointments/requests/:token/cancel
Dormant in v1. Same status as the lookup endpoint above — the endpoint exists but isn't surfaced through any first-party SDK or widget. Cancellation in v1 is customer-driven from the CMS; no visitor self-cancel on the customer's site.
Visitor self-cancellation. Only works while the request is still
PENDING — once the customer has confirmed or declined, the
token is revoked.
Request
POST /external/appointments/requests/f8d2c1e3a4b5.../cancel HTTP/1.1
Host: api.brandfine.co
Content-Type: application/json
{}(Empty body. The token in the URL IS the credential.)
Response — 200 OK
{ "id": "cln9b2k8w0001abc", "status": "CANCELLED" }Errors
- 400 Bad Request — request is no longer in
PENDING(already confirmed, rejected, or cancelled). - 404 Not Found — token unknown or already revoked.
Where appointment requests show up in the CMS
The CMS Inbox (as bookings, next to chats and forms) and the schedule under sidebar → Plugins → Appointments, which aggregates every workspace in the active team with workspace chips on each row. Each row's Confirm / Decline action fires the corresponding visitor email and clears the cancellation token.
Per-workspace settings (business hours, slot duration, timezone, notification email, policy text) live in the Settings dialog, opened from Inbox → Settings → Bookings, the catalog card's "Manage settings" button or the schedule's Settings button.
SDK
The bf.appointments namespace wraps
all four endpoints with typed inputs / outputs. Use it instead of
calling these endpoints directly from TypeScript.