# Base44 Source: https://opencals.com/docs/ai-agents/base44 Connect a Base44 app to Opencals with one backend function, an app secret and two workspace skills: live availability, cart, checkout and Stripe payments. Base44 builds the app; Opencals runs the booking. Every call goes through one backend function, `opencals`, which adds the API key and version headers and passes each visitor's cart ID and customer token through. Two workspace skills teach Base44's AI the API and the booking flow. > [!NOTE] > > Needs a Base44 **Builder** plan or higher (backend functions and workspace > skills), and a workspace owner or admin to add skills. **1. Create a storefront key** In the Opencals dashboard open **Settings → API Keys** and create a key (`sfk_…`) with **no allowed origins**. The backend function sends no `Origin` header. **2. Add two workspace skills** Workspace name (bottom left) → **Settings** → **Plugins → Skills** → **Add skill** → **Start from scratch**. **Skill 1** · name `opencals-storefront-api` · description: `Use for any code that calls the Opencals booking API: catalogue, availability, cart, appointments, discounts, checkout and payment, customer accounts, reschedule and cancel, errors and rate limits.` > [accordion] Instructions: Opencals Storefront API (\~36k chars) > > ````markdown opencals-storefront-api.md theme={"theme":{"light":"github-light","dark":"github-dark-default"}} > # Opencals Storefront API — complete reference > > The Opencals connector is a hosted booking API for service businesses (salons, clinics, studios, courts, rooms, classes). It owns availability maths, timezones, double-booking prevention, pricing, discounts, tax and payments. The app's job is to call the endpoints below in the right order and render the results. Never implement any of that logic in the app. > > Everything here is copied from the live API. **Never invent endpoints, fields or enum values.** If something isn't listed here, it doesn't exist. > > ## How to call the API > > - All paths are relative to the connector's base URL. The connector adds the store's API key and the `X-Api-Version: 1` header on every request. **Do not add `X-Api-Key` or `X-Api-Version` yourself.** > - Call Opencals from server-side code only, through the connector. The browser must never call Opencals directly or hold the key. > - Request and response bodies are JSON. Send `Content-Type: application/json` on requests with a body. > - The connector's key identifies **one store**. Every endpoint is scoped to that store automatically. There is no store id to pass. > - Two per-request headers the app must pass through itself: > - `X-Cart-Id: ` on cart and checkout calls (see "Cart"). > - `Authorization: Bearer ` for a signed-in customer (see "Customer accounts"). Optional on cart, checkout and booking calls; required on account calls. > > ## Key endpoints > > ### Catalogue (read-only) > | Method | Path | Purpose | > |---|---|---| > | GET | `/storefront/stores/public-settings` | Store name, currency, timezone, time/date format, checkout field rules, marketing opt-in display, contact info | > | GET | `/storefront/products` | Paginated list of services (products), each with `variants[]` | > | GET | `/storefront/products/{productId}` | One product with staff, locations, add-ons, variants, checkout questions | > | GET | `/storefront/products/slug/{slug}` | Same, by slug | > | GET | `/storefront/products/{productId}/add-ons` | Add-ons bookable with this product (query: `locationId`, `staffMemberId`) | > | GET | `/storefront/product-collections` | Collections/categories (query: `isVisible`) | > | GET | `/storefront/product-collections/slug/{slug}` | One collection with its products | > | GET | `/storefront/locations` | Locations | > | GET | `/storefront/locations/{locationId}` · `/storefront/locations/slug/{slug}` | One location | > | GET | `/storefront/staff-members` | Staff members | > | GET | `/storefront/staff-members/slug/{slug}` | One staff member | > | GET | `/storefront/add-ons` · `/storefront/add-ons/{addOnId}` · `/storefront/add-ons/slug/{slug}` | Add-ons | > | GET | `/storefront/images/{imageId}` | Image record (URLs) | > | GET | `/storefront/checkout-questions/{productId}/translations/{language}` | Checkout questions for a product | > | GET | `/storefront/feedback-questions/{productId}/translations/{language}` | Post-appointment feedback questions | > > ### Availability > | Method | Path | Purpose | > |---|---|---| > | GET | `/storefront/products/{productId}/current-availabilities` | Exact bookable slots for one date | > | GET | `/storefront/products/{productId}/current-availability-ranges` | Merged availability windows across the booking horizon (for calendar highlighting) | > | GET | `/storefront/products/{productId}/nearest-availability` | The next available slot (204 when none) | > > ### Cart > | Method | Path | Purpose | > |---|---|---| > | POST | `/storefront/cart` | Create a cart, or return the existing one named by `X-Cart-Id` | > | GET | `/storefront/cart` | Read the cart (`X-Cart-Id`) | > | POST | `/storefront/cart/items` | Add an existing appointment to the cart | > | DELETE | `/storefront/cart/items/{itemId}` | Remove a cart item (and release its held slot) | > | POST | `/storefront/cart/extend` | Push the cart's `expiresAt` further out | > | POST | `/storefront/cart/items/{cartItemId}/add-ons` | Attach an add-on to a cart item | > | PATCH | `/storefront/cart/add-ons/{cartAddOnItemId}` | Change a fixed add-on's quantity | > | DELETE | `/storefront/cart/add-ons/{cartAddOnItemId}` | Remove an add-on | > | POST | `/storefront/cart/discount-code` | Apply a promo code | > | DELETE | `/storefront/cart/discount-code` | Remove the promo code | > > ### Appointments > | Method | Path | Purpose | > |---|---|---| > | POST | `/storefront/appointments` | Create (hold) an appointment for a slot, attached to a cart | > | GET | `/storefront/appointments` | The signed-in customer's appointments (paginated) | > | GET | `/storefront/appointments/{appointmentId}` | One appointment | > | PUT | `/storefront/appointments/{appointmentId}/reschedule` | Move to a new slot | > | PUT | `/storefront/appointments/{appointmentId}/cancel` | Cancel | > | POST | `/storefront/appointments/{appointmentId}/guests` | Invite a guest by email | > | DELETE | `/storefront/appointments/{appointmentId}/guests/{guestId}?notify=true` | Remove a guest (`notify` query is required) | > | POST | `/storefront/appointments/{appointmentId}/feedback` | Submit feedback answers | > | GET | `/storefront/appointments/preferences/booking-history` | The customer's usual product/staff/location, for pre-filling | > > ### Checkout and payment > | Method | Path | Purpose | > |---|---|---| > | GET | `/storefront/cart/checkout/questions/{language}` | Checkout questions for everything in the cart | > | POST | `/storefront/cart/checkout/save-customer` | Attach customer details, billing/delivery address and marketing consent to the cart | > | POST | `/storefront/cart/checkout/save-answers` | Save checkout-question answers | > | GET | `/storefront/payment/providers` | Payment options for this cart (`X-Cart-Id`) | > | POST | `/storefront/cart/checkout/start` | Start payment with the chosen provider; returns a Stripe client secret or redirect | > | POST | `/storefront/cart/checkout/submit` | Finalise: creates the order and confirms the appointments | > | POST | `/storefront/uploads/presign` | Get an upload URL for a file-upload checkout question | > > ### Orders > | Method | Path | Purpose | > |---|---|---| > | GET | `/storefront/orders` | The signed-in customer's orders | > | GET | `/storefront/orders/{orderId}` | One order | > | GET | `/storefront/orders/{orderId}/invoices` | Invoices/receipts for an order | > > ### Customer accounts > | Method | Path | Purpose | > |---|---|---| > | POST | `/storefront/auth/sign-up` | Register with email + password (204) | > | POST | `/storefront/auth/sign-in` | Email + password → tokens | > | POST | `/storefront/auth/request-login-code` | Email a 6-digit login code (204) | > | POST | `/storefront/auth/verify-login-code` | Email + code → tokens | > | GET | `/storefront/auth/resolve-link?token=…` | Resolve a magic link from an email → tokens + where to go | > | GET | `/storefront/auth/refresh` | Refresh token (as `Authorization: Bearer `) → new tokens | > | POST | `/storefront/auth/request-password-reset` | Email a reset link (204) | > | POST | `/storefront/auth/reset-password` | Token + new password (204) | > | POST | `/storefront/auth/request-email-verification` | Resend verification email (204) | > | POST | `/storefront/auth/verify-email` | Token → tokens | > | GET / PUT | `/storefront/self-service/profile` | Read / update name and phone | > | PUT | `/storefront/self-service/password` | Set or change password | > | GET / PUT | `/storefront/self-service/marketing-consent` | Read / update per-channel marketing consent | > > ## Core concepts > > ### IDs and products vs variants > - A **product** is a bookable service. `GET /storefront/products` returns items with a `variants[]` array (e.g. "Haircut" → "Short hair", "Long hair"). Each variant is a full product row with its own `id`, `price`, `duration`, `staffMembers` and `locations`. > - **The bookable id is always a variant's `id`.** Use it in `/storefront/products/{productId}/…` paths and as `slot.productId`. Don't use the `productId` field on a product row: that's a grouping key shared by all its variants. A product with one variant has `variants[0].id === id`. > - IDs are UUID strings. > > ### Time and money > - **All slot dates and times are UTC.** Slots use `fromDate`/`toDate` (`YYYY-MM-DD`) and `fromTime`/`toTime` (`HH:MM:SS`). Appointment `from`/`to` are ISO 8601 UTC timestamps. > - Convert to the store's timezone (`settings.timezone` in public settings) or the visitor's timezone **for display only**. Always send back the exact UTC values the API gave you. > - Durations and gaps are in **seconds** (`duration: 3600` = 1 hour). > - Prices are decimal numbers in the store currency (`currency` in public settings, `paymentCurrencyCode` on carts and orders), e.g. `45` or `12.5`. Not cents. `taxesIncluded` says whether prices already include tax. > > ### Pagination > List endpoints take `page` (1-based, default 1) and `take` (default 50, max 100), and optionally `q` (search), `orderBy`, `order` (`ASC`/`DESC`). They return: > > ```json > { > "data": [ ... ], > "meta": { "page": 1, "take": 50, "itemCount": 12, "pageCount": 1, "hasPreviousPage": false, "hasNextPage": false } > } > ``` > > Single-resource endpoints return the object directly (no wrapper). > > ## Store settings > > `GET /storefront/stores/public-settings` → `{ name, domain, currency, settings, storefrontSettings, contactInfo, checkoutSettings, features }`. > > - `settings.timezone`, `settings.timeFormat` (`12H` | `24H`), `settings.dateFormat`, `settings.defaultAdvanceScheduleDays` (-1 = unlimited). > - `checkoutSettings` controls the customer form: > - `customerFirstNameRequired: boolean`. Last name and email are always required. > - `customerPhoneRequirement`, `customerCompanyNameRequirement`, `customerCompanyVatNumberRequirement`, `customerBillingAddressRequirement`: each `hidden` | `optional` | `required`. > - `emailMarketingOptIn`, `smsMarketingOptIn`, `whatsappMarketingOptIn`: each `dont_show` | `checkout_only` | `checkout_and_account`. > - Fetch this once and cache it. Build the checkout form from it rather than hard-coding fields. > > ## Products > > Useful fields on a product/variant: > > | Field | Meaning | > |---|---| > | `id`, `slug`, `title`, `variantTitle`, `description` | Identity and copy | > | `price`, `taxable`, `duration` (s) | Pricing and length | > | `image`, `images[]` | Images; use `image.url` (can be null) | > | `staffMembers[]`, `locations[]` | Who can perform it, and where | > | `maxAttendees` | Capacity per slot (1 = private; >1 = group class) | > | `allowCustomDuration`, `maxDuration` (s, -1 = unlimited) | Variable-length bookings (see below) | > | `allowGuests`, `maxGuests` (null = unlimited) | Whether named guests can be invited | > | `allowCustomerReschedule`, `rescheduleGap` (s) | Self-service reschedule, and the minimum notice | > | `allowCustomerCancel`, `cancelGap` (s) | Self-service cancel, and the minimum notice | > | `advanceScheduleThreshold` | How many days ahead it can be booked | > | `status` | `active` \| `inactive`. Show active only | > | `collections[]`, `addOns[]`, `checkoutQuestions[]` | On the detail endpoint | > > `GET /storefront/products?status=active&take=100` is the usual catalogue call. Filter by location with `locationId`. > > Locations have `type`: `physical` (has an address; use `displayAddress` if set, else `address`), `online` (has a `link`), or `delivery` (the business comes to the customer, so a customer address is needed at checkout). > > ## Availability > > ### Exact slots for a day > > ``` > GET /storefront/products/{productId}/current-availabilities?date=2026-10-14&timezone=Europe/London&locationId=…&staffMemberId=… > ``` > > Query: `date` (required, `YYYY-MM-DD`), `timezone` (IANA name; aligns the "day" to local time, so always send it), `locationId`, `staffMemberId`, `duration` (seconds as a string, for variable-length bookings), `excludeAppointmentId` (for rescheduling). > > Response: an array of slots: > > ```json > [ > { > "productId": "b2c1…", > "fromDate": "2026-10-14", "fromTime": "09:00:00", > "toDate": "2026-10-14", "toTime": "09:45:00", > "staffMemberIds": ["5f0e…", "91aa…"], > "locationIds": ["c3d4…"], > "attendees": 0, > "maxAttendees": 1 > } > ] > ``` > > - `staffMemberIds` lists who is free for that slot. If the customer picked "anyone", you may omit `staffMemberId` when booking. If they picked a person, filter slots by it (or pass `staffMemberId` in the query) and send it in the slot. > - For group products, spots left = `maxAttendees - attendees`. > - An empty array means no availability that day. > > ### Calendar highlighting > > ``` > GET /storefront/products/{productId}/current-availability-ranges?timezone=Europe/London&locationId=…&staffMemberId=…&duration=… > ``` > > Returns the same slot shape, but each entry is a merged **window** of availability across the horizon (`date` is optional; omit it for the full horizon). Use it to enable or disable days in a date picker, then call `current-availabilities` for the day the customer picks. This costs one request per product instead of one per day. > > ### Next available > > `GET /storefront/products/{productId}/nearest-availability` → one slot (`productId, locationId, staffMemberId, fromDate, fromTime, toDate, toTime`), or HTTP 204 when nothing is bookable. Use it to open the picker on the first bookable day. > > ### Many units in a grid (courts × time, rooms × time) > There is no multi-product availability endpoint. Call `current-availabilities` once per unit for the selected date, cache each result by product + date + duration, and mark a cell available if that unit has a slot starting at that time. Watch the rate limit (see Notes). > > ## Booking flow (the happy path) > > 1. `POST /storefront/cart` with header `X-Cart-Id: ""` (empty on the first call). Store `cart.id` (e.g. in `localStorage`) and send it as `X-Cart-Id` on every later cart/checkout call. > 2. `GET …/current-availabilities`, and the customer picks a slot. > 3. `POST /storefront/appointments` with the slot and `cartId`. The appointment is held in the cart; you don't need to call `/cart/items`. > 4. `GET /storefront/cart` to render the summary (items, add-ons, discounts, totals, `expiresAt`). > 5. Optional: `POST /storefront/cart/discount-code`. > 6. `POST /storefront/cart/checkout/save-customer`. > 7. If `GET /storefront/cart/checkout/questions/{language}` returns questions: `POST /storefront/cart/checkout/save-answers`. > 8. `GET /storefront/payment/providers`, then the customer picks one, then `POST /storefront/cart/checkout/start`. > 9. Pay (Stripe in the browser) if needed, then `POST /storefront/cart/checkout/submit`. > 10. Show the confirmation from the returned `order`. Clear the stored cart id. > > ### Create an appointment > > ``` > POST /storefront/appointments > ``` > > ```json > { > "slot": { > "productId": "b2c1…", > "fromDate": "2026-10-14", "fromTime": "09:00:00", > "toDate": "2026-10-14", "toTime": "09:45:00", > "staffMemberId": "5f0e…", > "locationId": "c3d4…" > }, > "cartId": "8e7d…", > "numberOfAttendees": 1, > "addOns": [{ "addOnId": "a1b2…", "quantity": 1 }], > "guests": [{ "email": "friend@example.com" }], > "customAttributes": { "source": "lovable-site" } > } > ``` > > - `slot` is required. Copy the date/time fields exactly from a returned availability slot. `staffMemberId` and `locationId` are optional (nullable). > - Optional: `cartId` (always send it on the booking path), `numberOfAttendees` (default 1, capped by remaining capacity), `addOns[]`, `guests[]` (only if the product has `allowGuests`), `checkoutQuestionAnswers[]`, `address` (service address for a `delivery` location), `customAttributes` (string→string map, max 250 keys; keys ≤255 chars, values ≤5000 chars). > - Response (201): the appointment (`id`, `name` (a human number like `1001`), `status: "pending"`, `from`, `to`, `product`, `staffMember`, `location`, `addOns`, `guests`, …). It stays `pending` until checkout is submitted. > - 4xx here usually means the slot was just taken, is outside the booking window, or capacity was exceeded. Re-fetch availability and ask the customer to choose again. > > To remove a booking from the cart: `DELETE /storefront/cart/items/{itemId}` using the cart item's `id` (not the appointment id). > > ## Cart > > `POST /storefront/cart` (header `X-Cart-Id`, empty or an existing id) → `CartResponse`: > > | Field | Meaning | > |---|---| > | `id` | Cart id, sent as `X-Cart-Id` | > | `status` | `active` \| `converted` \| `abandoned`. `converted` already has an order: start a new cart. `abandoned` (expired) is revived by adding an item or by checkout while its slots are still free | > | `expiresAt` | When held slots are released (ISO UTC; the store's hold window, 15 minutes by default) | > | `paymentCurrencyCode`, `taxesIncluded` | Currency and tax mode | > | `subtotal`, `totalTax`, `total` | **Authoritative totals.** Display these; never recompute | > | `appliedDiscounts[]` | `{ id, title, totalAmount, code? }` | > | `appliedDiscountCode` | The promo code currently applied, or null | > | `creditCovered`, `creditRemaining`, `creditValueType` | Customer balance used (`time` = minutes, `fixed_amount` = money) | > | `items[]` | One per appointment (below) | > > Each `items[]` entry: `id` (cart item id), `appointmentId`, `appointment` (with `from`, `to`, `product`, `staffMember`, `location`), `quantity`, `originalUnitPrice`, `originalSubtotal`, `totalDiscount`, `discountedSubtotal`, `totalTax`, `discountedTotal`, `discounts[]`, `addOnItems[]`, `addOnSubtotal`, `addOnTotalTax`. Use the line totals (`discountedSubtotal`, `discountedTotal`) for exact per-line amounts. `discountedUnitPrice` and `unitTaxAmount` are approximate. > > ### Expiry > - Show a countdown from `expiresAt`, and recompute it when the tab regains focus. > - While the customer is actively on checkout, call `POST /storefront/cart/extend` (with `X-Cart-Id`) to push `expiresAt` out. Extending (and starting checkout) only moves it later, never earlier. > - An expired cart is revived by checkout `start`/`submit` (and adding an item gives it a fresh hold window) when its slots are still free. If checkout fails with `CART_EXPIRED`, start a new cart (`X-Cart-Id: ""`). Tell the customer their held time was released and let them pick again. Don't retry the old id. > > ### Add-ons > - Product add-ons: `GET /storefront/products/{productId}/add-ons`. Each has `price`, `durationMultiplied` and `maxQuantity`. > - `durationMultiplied: true`: charged per base-duration unit of the appointment. Quantity is set automatically; don't send one. > - `durationMultiplied: false`: a fixed add-on. The customer picks a quantity from 1 to `maxQuantity`. > - Attach at creation (`addOns` on the appointment) or later with `POST /storefront/cart/items/{cartItemId}/add-ons` and body `{ "addOnId": "…", "quantity": 2 }`. Change the quantity with `PATCH /storefront/cart/add-ons/{cartAddOnItemId}` and body `{ "quantity": 3 }`. Each returns the updated cart. > > ## Discounts > > Three kinds, all resolved server-side and reflected in the cart. Never calculate discounts in the app. > > 1. **Automatic**: configured by the merchant and applied when the cart qualifies. No call needed; they appear in `appliedDiscounts` and `items[].discounts`. > 2. **Promo codes**: `POST /storefront/cart/discount-code` with body `{ "code": "SUMMER10" }` returns the updated cart. `DELETE /storefront/cart/discount-code` removes it. On failure you get HTTP 400: > ```json > { "message": "This code has expired", "code": "CODE_EXPIRED", "statusCode": 400 } > ``` > `code` is one of `CODE_NOT_FOUND`, `CODE_EXPIRED`, `CODE_DISABLED`, `CODE_LIMIT_REACHED`, `CODE_CUSTOMER_INELIGIBLE`, `CODE_NO_MATCHING_ITEMS`, `CODE_NO_CREDIT`, `minimum_requirement_not_met`. Show a friendly message next to the code field and keep the customer in checkout. > 3. **Balance / credit**: a customer can hold a money or time balance (e.g. "10 free hours"). It's used up automatically for a signed-in customer and shows as `creditCovered` / `creditRemaining` / `creditValueType` on the cart. > > Per-line discount rows (`items[].discounts[]`, `addOnItems[].discounts[]`): `{ discountId, title, amountPerUnit, valueType: "percentage" | "fixed_amount" | "time", value, targetType: "base" | "add_on" }`. > > If `checkout/start` returns `discountCodeCleared: true`, the code stopped applying (e.g. the cart changed). Tell the customer. > > ## Checkout > > ### Customer object: the `kind` field is required > Every `customer` object in `save-customer`, `checkout/start`, `checkout/submit` and `POST /storefront/appointments` **must** include `kind`: > - New customer: `{ "kind": "new", "email": "…", "firstName": "…", "lastName": "…", "phone": "…" }` > - Existing customer: `{ "kind": "existing", "customerId": "…" }`, e.g. a signed-in customer, or one whose `customerId` came back from `save-customer`. > > If you leave out `kind`, the API can't tell which shape you sent, and the request is rejected or the customer isn't saved. > > ### Save the customer > > ``` > POST /storefront/cart/checkout/save-customer (X-Cart-Id) > ``` > > ```json > { > "customer": { > "kind": "new", > "email": "jo@example.com", > "firstName": "Jo", > "lastName": "Smith", > "phone": "+447700900000", > "billingAddress": { > "companyName": "Smith Ltd", > "taxRegistrationId": "GB123456789", > "addressLine1": "1 High St", "city": "London", "postalCode": "N1 1AA", "country": "GB" > }, > "deliveryAddress": { > "firstName": "Jo", "lastName": "Smith", > "addressLine1": "2 Park Rd", "city": "London", "postalCode": "N2 2BB", "country": "GB" > }, > "marketingConsent": { "email": true, "sms": false, "whatsapp": false } > } > } > ``` > > Response: `{ "customerId": "…" }`. Keep it and use `{ "kind": "existing", "customerId }` in the next steps. > > If the email belongs to an existing customer and the request isn't signed in as them (no customer `Authorization` token), the response is `{}` with no `customerId`. The booking is still attached to that customer, but nothing on their profile changes (name, phone, billing address, marketing consent). In the next steps, send the same `kind: "new"` details again or leave `customer` out: the cart already holds the customer. Save-customer and `checkout/start` don't write anything to the customer: until the order is placed, the billing and delivery addresses entered belong to the cart only, and their `customerId` is `null`. When `checkout/submit` places the order, those addresses are added to the customer's saved addresses (the order and invoice use them as entered). > > - `billingAddress` (optional): `firstName`, `lastName`, `companyName`, `taxRegistrationId` (VAT/GST), `addressLine1`, `addressLine2`, `city`, `state`, `postalCode`, `country`, `email`, `phone`. Company name and VAT id go **here**, not on the customer. Show or require it according to `checkoutSettings`. > - `deliveryAddress` (optional): same fields without `taxRegistrationId`. Needed **only** when the cart has an appointment at a `delivery`-type location. It applies to every delivery appointment in the order and overrides any per-appointment `address`. > - `marketingConsent` (optional): per-channel booleans. Only show the channels whose `…MarketingOptIn` setting isn't `dont_show`. Leave them unticked by default. > - `country` is always a 2-letter uppercase ISO code (`GB`, `US`, `DE`). > - A signed-in customer sends `{ "kind": "existing", "customerId": "", "firstName"?, "lastName"?, "phone"?, "billingAddress"?, "deliveryAddress"?, "marketingConsent"? }`. > - Required billing fields are checked against the `billingAddress` in the request or, if it has none, against the billing already saved on the cart. You don't have to send the billing address again at `checkout/start` or `checkout/submit`. > > ### Checkout questions > > `GET /storefront/cart/checkout/questions/en` (use the site language code) returns an array of `{ id, type, required, order, translations: [{ title, description, options }], existingAnswer?, fileConfig? }`. Use `translations[0].title` as the label (and as `question` when saving). `type` is one of `single-line-text-field`, `multi-line-text-field`, `dropdown`, `rating`, `checkbox`, `file-upload`. Render them in `order`, enforce `required`, and pre-fill from `existingAnswer`. > > ``` > POST /storefront/cart/checkout/save-answers (X-Cart-Id) > ``` > > ```json > { > "answers": [ > { "questionId": "q1…", "question": "Any allergies?", "answer": "None" }, > { "questionId": "q2…", "question": "Upload your referral", "answer": "", "fileIds": ["f9…"] } > ] > } > ``` > > `questionId`, `question` (the question text as shown) and `answer` (a string, even for ratings and checkboxes) are all required. For `file-upload` questions (limits in `fileConfig`): > 1. `POST /storefront/uploads/presign` with `{ "questionId": "…", "questionKind": "checkout", "filename": "referral.pdf", "mime": "application/pdf", "size": 48213 }` → `{ fileId, presignedUrl, expiresIn }`. > 2. From the browser, `PUT` the file bytes to `presignedUrl` with a matching `Content-Type`. This is a direct storage upload, not through the connector. > 3. Send `fileIds: [fileId]` in the answer. > > ### Payment providers > > `GET /storefront/payment/providers` (with `X-Cart-Id`) → `[{ name, displayName, description?, checkoutMode, icon?, mode? }]` > > - `name`: `stripe` | `cash` | `bank_transfer` | `stripe_invoice` | `shopify` | `no_payment_required` > - `checkoutMode`: `internal` (card form in the app, i.e. Stripe), `redirect` (send the browser to `redirectUrl`), `manual` (pay later: cash on arrival, bank transfer or a Stripe-hosted invoice), `none` (nothing to pay) > - `stripe_invoice` is only offered when the store has Stripe connected. Label it "Pay by invoice". > - `mode`: `test` | `live` for Stripe. Show a "test mode" badge when it's `test`. > > Show only what's returned. If there's exactly one option, preselect it. > > ### Start checkout > > ``` > POST /storefront/cart/checkout/start (X-Cart-Id) > { "provider": "stripe", "customer": { "kind": "existing", "customerId": "…" } } > ``` > > Response: > ```json > { > "provider": "stripe", > "clientSecret": "pi_…_secret_…", > "publishableKey": "pk_live_…", > "stripeAccountId": "acct_…", > "redirectUrl": null, > "paymentId": "…", > "cart": { "...": "updated cart" }, > "invalidItemIds": [], > "revivedItemIds": [], > "discountCodeCleared": false > } > ``` > > **Branch on the `provider` in the response, not the one you requested.** When nothing is due (a £0 total, or below the minimum card charge), the API switches the provider to `no_payment_required`. > > - `no_payment_required`, `cash`, `bank_transfer`, `stripe_invoice`: call `submit` straight away (no payment step). > - `stripe`: in the browser, load Stripe.js with `publishableKey` and `{ stripeAccount: stripeAccountId }`, mount the Payment Element with `clientSecret`, then call `stripe.confirmPayment({ elements, redirect: 'if_required' })`. On success, call `submit` with the PaymentIntent id. The app needs no Stripe secret key. The merchant's Stripe account is connected in Opencals. > - `redirectUrl` present: send the browser there. > - `invalidItemIds` not empty: those items were no longer bookable and were removed. Tell the customer and show the updated cart. > > ### Submit > > ``` > POST /storefront/cart/checkout/submit (X-Cart-Id) > { "stripePaymentIntentId": "pi_…", "appointmentsSettings": { "markAsScheduled": true } } > ``` > > - `stripePaymentIntentId`: only for Stripe. > - `appointmentsSettings` is still accepted for older clients, but the store decides when a customer booking is confirmed (straight away, or only when the booking meets the store's conditions, such as being paid in time). Sending `markAsScheduled: true` doesn't skip that. > - Optional `trackingData` (e.g. `{ "gclid": "…" }`) for ad attribution. > > Response: `{ order, auth?, customer?, paymentInstructions? }`. > - `order`: `id`, `name` (e.g. `1042`), `total`, `subtotal`, `totalTax`, `paidTotal`, `dueToPay`, `paymentStatus` (`unpaid` | `paid` | `partially-paid` | `voided`), `paymentDueAt?`, `lineItems[]`, `paymentCurrencyCode`. `voided` means the order was cancelled with nothing paid. > - `paymentInstructions` (optional, pay-later orders only): `{ provider, hostedInvoiceUrl?, dueAt?, bankDetails? }`. Show it on the confirmation page: a "Pay invoice" button for `hostedInvoiceUrl` (Stripe invoice), the bank details (`accountName`, `bankName`, `iban`, `swift`) for bank transfer, and "Please pay by {dueAt}" when `dueAt` is set. Any field can be null. > - The order's appointments may still be `pending` after submit. `pending` on a placed order means **awaiting confirmation**; `pendingReason` is `awaiting_payment` (confirmed once paid) or `awaiting_approval` (the merchant still has to confirm it; a paid booking can still be awaiting approval). Show "Awaiting payment" for `awaiting_payment` and "Awaiting confirmation" otherwise, never "Confirmed". After `order.paymentDueAt` an unpaid booking is cancelled or handed to the merchant to review (then `awaiting_approval`); after `order.approvalDueAt` an unapproved booking is cancelled. If it's cancelled or the merchant declines, the appointment becomes `canceled` with `cancelReason` `unpaid`, `not_approved`, `declined` or `order_cancelled`. The order then has `cancelledAt` and an order `cancelReason` of `unpaid`, `not_approved`, `declined`, `external` or `customer`. > - `auth` and `customer`: only when the request is signed in as the order's customer, or when this checkout created a new customer. Store the `auth` tokens (`{ accessToken, refreshToken }`) to sign the customer in automatically so they can see their booking. When the email belonged to an existing customer and the request wasn't signed in, both are missing: the booking is in that customer's account, and they see it after signing in with a login code. Always treat `auth` as optional. > - After a successful submit, the cart is `converted`. Discard the stored cart id. > > Checkout conflicts come back as **409** with a `code`: > - `CART_EXPIRED`: a held time is gone. `start` and `submit` first revive an expired cart (re-hold every slot that is still free), so this only means a slot was taken. Start a new cart and let the customer pick again. > - `CART_ALREADY_CHECKED_OUT` (`start`): the cart is already an order; the body has its `orderId`. Show that order instead. > - `CHECKOUT_IN_PROGRESS`: another `start` or `submit` of the same cart (double click, second tab) is still running. Keep the cart, say the booking is being processed, and retry `submit` in a moment. It returns the order once placed. > > `submit` answers **402** `PAYMENT_NOT_AUTHORIZED` (with `paymentStatus`, e.g. `requires_payment_method` or `requires_action`) when the card payment isn't authorised: declined, 3-D Secure not completed, or cancelled. No order is placed and the cart is unchanged. Show the card error and let the customer retry the payment, then `submit` again. > > ## Customer accounts > > Storefront reads and bookings work anonymously. Account features (my appointments, reschedule, cancel, profile, consent) need the customer's access token, sent as `Authorization: Bearer `. > > ### Sign in options > - **Passwordless (recommended)**: > 1. `POST /storefront/auth/request-login-code` with `{ "email" }` → 204, and the customer receives a 6-digit code. > 2. `POST /storefront/auth/verify-login-code` with `{ "email", "code" }` → `{ accessToken, refreshToken }`. > - **Password**: `POST /storefront/auth/sign-up` with `{ email, password (min 8), firstName?, lastName? }` → 204 (a verification email is sent). Then `POST /storefront/auth/sign-in` with `{ email, password }` → tokens. > - **Magic links** from Opencals emails: the link carries a `token`. Call `GET /storefront/auth/resolve-link?token=…` → `{ purpose, redirectPath, accessToken?, refreshToken?, requiresAction?, metadata? }`. Store the tokens if present, then route to `redirectPath`. > - **Password reset**: `request-password-reset` with `{ email }`, then `reset-password` with `{ token, newPassword }`. > - **Email verification**: `verify-email` with `{ token }` → tokens. `request-email-verification` with `{ email }` resends it. > > ### Tokens > - The access token is short-lived. When a call returns 401, call `GET /storefront/auth/refresh` with `Authorization: Bearer `, store the new pair, and retry once. If refresh also fails, sign the customer out. > - Store tokens for the session and forward the access token to the server function that calls Opencals. Never log tokens. > > ### Self-service > - `GET /storefront/self-service/profile` → `{ id, email, firstName, lastName, phone, isEmailVerified, isPasswordSet, language, … }`. Use `id` as the `customerId` for `{ "kind": "existing" }` at checkout. Display only name, email and phone. > - `PUT /storefront/self-service/profile` with `{ firstName?, lastName?, phone? }`. > - `PUT /storefront/self-service/password` with `{ currentPassword?, newPassword }`. `currentPassword` is required only if `isPasswordSet`. > - `GET /storefront/self-service/marketing-consent` → `{ emailState, smsState, whatsappState }`, each `not_subscribed` | `subscribed` | `unsubscribed`. It can be `null` if never set. > - `PUT /storefront/self-service/marketing-consent` with `{ email?, sms?, whatsapp? }` (booleans). Only show channels whose opt-in setting is `checkout_and_account`. > > ### My appointments and orders > - `GET /storefront/appointments?status=scheduled&orderBy=from&order=ASC&take=20` is the customer's own appointments. `status` values: `pending`, `scheduled`, `completed`, `canceled`. Other filters: `date` (`YYYY-MM-DD`), `products`, `staffMembers`, `locations` (arrays). > - `GET /storefront/appointments/{appointmentId}` returns the detail, including product (with the reschedule/cancel rules), staff, location and guests. > - `GET /storefront/orders?take=20` and `GET /storefront/orders/{orderId}` return orders. `GET /storefront/orders/{orderId}/invoices` returns receipts/invoices. > - `GET /storefront/appointments/preferences/booking-history` returns the customer's usual choices, for a "book again" shortcut. > > ## Reschedule and cancel > > Show these actions only when the product allows them (`allowCustomerReschedule` / `allowCustomerCancel`) **and** the appointment starts more than `rescheduleGap` / `cancelGap` seconds from now. Otherwise disable the button and explain the notice period. > > ### Reschedule > 1. Fetch availability **excluding the appointment being moved**, so its current slot doesn't show as busy: > ``` > GET /storefront/products/{productId}/current-availabilities?date=2026-10-15&timezone=Europe/London&excludeAppointmentId={appointmentId}&staffMemberId=…&locationId=… > ``` > 2. Move it: > ``` > PUT /storefront/appointments/{appointmentId}/reschedule > { "slot": { "productId": "…", "fromDate": "2026-10-15", "fromTime": "10:00:00", "toDate": "2026-10-15", "toTime": "10:45:00", "staffMemberId": "…", "locationId": "…" }, "notifyCustomer": true } > ``` > `address` is optional (for delivery locations only). The response is the updated appointment. > > ### Cancel > ``` > PUT /storefront/appointments/{appointmentId}/cancel > { "notifyCustomer": true } > ``` > The API applies refund and cancellation policy. Never calculate refunds in the app. Ask the customer to confirm before cancelling. > > ## Attendees and guests > > - **Attendees** is how many people take up capacity: `numberOfAttendees` on create. For group products (`maxAttendees > 1`), show "X spots left" from the slot (`maxAttendees - attendees`) and cap the input at that number. > - **Guests** are named people (by email) who get copies of the appointment emails. They don't use up capacity. Add them at creation (`guests: [{ email }]`) or later with `POST /storefront/appointments/{id}/guests` and body `{ "email": "…", "notify": true }`. Remove one with `DELETE /storefront/appointments/{id}/guests/{guestId}?notify=true`. Only offer guests when `allowGuests` is true, and respect `maxGuests`. > > ## Custom duration (variable-length bookings) > > When a product has `allowCustomDuration: true`, the customer books a whole multiple of the base `duration`, up to `maxDuration` (-1 = unlimited). Example: base 1800 s (30 min) at £15, `maxDuration` 5400, so the options are 30/60/90 min for £15/£30/£45. > > 1. Offer the lengths `duration × n` for n = 1, 2, 3 … while the total is ≤ `maxDuration`. > 2. Fetch slots for the chosen length: `…/current-availabilities?date=…&timezone=…&duration=5400`. Each returned slot already spans the full length. > 3. Book that slot as-is. The API prices it (`ceil(booked / base) × price`). Never send a price. > > If `fixedTimes` is true (with `fixedStartTime` and `fixedEndTime`, e.g. check-in 15:00 and check-out 11:00), the product is booked check-in to check-out: the slot must start at `fixedStartTime` on the first day and end at `fixedEndTime` on the last day, in the product's schedule timezone (the store timezone if the product has no schedule). The server enforces this on `POST /storefront/appointments` and on customer reschedules, and returns `400` ("This product must be booked from HH:MM to HH:MM …") for any other times. Merchant bookings from the dashboard are exempt. Such a stay isn't a whole multiple of the base duration (3 nights from 15:00 to 11:00 is 68 hours), and it's priced by rounding up, so N nights cost N × `price`. To build the date picker, read `…/current-availability-ranges` (or `getCurrentAvailabilitiesMerged`) without `duration`, check that check-in → check-out fits inside one range, then send the slot built from the product's fixed times. > > Don't model "60 min" and "90 min" as separate products for the same physical resource. They wouldn't block each other and the resource could be double-booked. > > ## Errors > > Error responses are JSON: > > ```json > { "message": "Invalid input. Please check your form fields.", "statusCode": 400, > "errors": [{ "property": "email", "messages": ["Email must be an email"] }] } > ``` > > - `errors[]` appears on validation failures. Map `property` to the form field and show `messages`. > - Always show the real `message` and keep the status. Never replace it with a generic "Something went wrong". > > | Status / symptom | Likely cause | Fix | > |---|---|---| > | 404 `Cannot GET /storefront/...` | `X-Api-Version` header missing | The connector sends it. Check the connector's auth config | > | 401 `X-Api-Key header is required` / `Invalid or inactive API key` | Key missing, wrong or revoked | Reconnect with a valid storefront key (`sfk_…` or a private `spk_…`) | > | 401 `Origin not allowed for this API key` | Key has an allowed-origins list; server calls send no Origin | Use a key with no allowed-origins restriction for the connector | > | 401 `This API key can't be used here` | An admin key (`sk_`) was sent to the storefront API | Use a storefront key (`sfk_` or `spk_`) | > | 401 on account endpoints | Missing or expired customer token | Refresh, then sign in again | > | 400 on save-customer/start/submit | Missing `kind` on `customer`, or a required field | Add `kind`; show `errors[]` | > | 400 with a discount `code` | Promo code rejected | Show the mapped message | > | 4xx on create/reschedule | Slot taken, outside the window, over capacity, or inside the notice gap | Re-fetch availability; explain | > | 409 `CART_EXPIRED` / `CART_ALREADY_CHECKED_OUT` / `CHECKOUT_IN_PROGRESS` at checkout | Slot taken after expiry / cart already an order / checkout already running | New cart / show `orderId` / wait and retry `submit` | > | 402 `PAYMENT_NOT_AUTHORIZED` on submit | Card declined or 3-D Secure not completed | Keep the cart, retry the payment, `submit` again | > | Cart calls act on a new/empty cart | `X-Cart-Id` not forwarded | Forward the stored id on every cart/checkout call | > | Slots at the wrong hour | UTC shown as local | Convert for display only; send `timezone` | > | Customer can't pick their own current slot when rescheduling | `excludeAppointmentId` not sent | Add it | > | 429 | Rate limit | Back off and retry (below) | > > ## Notes > > - **Rate limits** apply per API key plus client IP: 50 requests/second, 300 per 10 seconds and 1,200 per minute. Sign-up, sign-in and email endpoints also have per-email limits (for example 3 login-code emails per address per 10 minutes). Through the connector, all visitors share the gateway's IP, so treat the per-IP limits as **app-wide** limits: > - Cache the catalogue (products, collections, locations, staff, public settings) for a few minutes server-side instead of fetching on every page view. > - Use `current-availability-ranges` for the calendar, then `current-availabilities` only for the chosen day. Cache results by product + date + duration for ~30–60 s. > - Don't poll. Don't prefetch availability for every product on the home page. > - On 429, retry with exponential backoff and jitter (500 ms, 1 s, 2 s, 4 s, each plus up to 30%, max 4 attempts). The `Retry-After` header isn't reliable, so don't depend on it. > - **Versioning** uses the `X-Api-Version` header (the connector sends `1`). Paths don't carry a version. > - **Dates**: `YYYY-MM-DD` dates and `HH:MM:SS` times in UTC for slots; ISO 8601 UTC for timestamps. > - **Languages**: question endpoints take a language code (`en`, `de`, `fr`, `es`, `pt_br`, …). Use the site's language, falling back to `en`. > - **What the API doesn't do**: there's no merchant/admin access, no creating services or staff, and no editing prices. That's all done by the merchant in the Opencals dashboard (app.opencals.com). If a service is missing or has no slots, it's a dashboard configuration issue, not a code issue. > - **Don't store or display** internal fields you don't need (`storeId`, `externalId`, `scheduleId`). Show customers only names, images, descriptions, prices, durations and times. > - Human-readable docs: https://opencals.com/docs > ```` **Skill 2** · name `opencals-booking-site` · description: `Use when building a booking website or booking flow on Opencals in Base44: the opencals backend function, choosing the flow for the business type, pages, slot picker, checkout and payment UX, and the launch checklist.` > [accordion] Instructions: booking site playbook for Base44 (\~16k chars) > > ```markdown base44-booking-site-playbook.md theme={"theme":{"light":"github-light","dark":"github-dark-default"}} > # Opencals booking site playbook (Base44) > > How to build a production booking website (or add booking to an existing app) on Opencals inside Base44. The booking engine lives in Opencals. This app is the customer-facing frontend: catalogue, slot picker, cart, checkout, confirmation and a customer account area. For exact endpoints, bodies and response fields, use the **"opencals-storefront-api"** skill. This file covers how to connect and what to build, in what order. > > ## Step 0: the `opencals` backend function (build this first) > > Every Opencals call goes through **one** backend function named `opencals`. The API reference calls it "the connector": wherever it says the connector adds a header, this function does it. > > - The store's Storefront API key is saved in the app's Secrets as `OPENCALS_API_KEY` (it starts with `sfk_`). Read it inside the function. Never put it in frontend code, entities or logs. > - Input: `{ method, path, query?, body?, cartId?, accessToken? }`. > - Allow only paths that start with `/storefront/`. Reject anything else with 400. > - Call `https://api.opencals.com` + `path` (+ `query` as a query string) with these headers: > - `X-Api-Key: ` > - `X-Api-Version: 1` (without it every route returns 404 `Cannot GET …`) > - `Content-Type: application/json` when there is a body > - `X-Cart-Id: ` when `cartId` is given > - `Authorization: Bearer ` when `accessToken` is given > - Return `{ status, data }` with the API's HTTP status and parsed JSON body unchanged (`data` is null for 204). Don't throw on 4xx; the UI needs the API's `message` and `errors[]`. > - The frontend calls it with `base44.functions.invoke('opencals', { ... })`. Keep the cart id and customer tokens in the browser (`localStorage` / session) and pass them in on every call that needs them. > - Test it first: `GET /storefront/stores/public-settings` must return 200 with the store name and currency. 404 `Cannot GET` means the version header is missing; 401 `Origin not allowed` means the key has an allowed-origins list and needs replacing with a key that has none. > > This app doesn't need Base44 entities for services, bookings or customers. Opencals stores all of that; use entities only for content that belongs to the site itself. > > ## Ground rules > > - **Never hard-code services, prices, durations, staff, locations or opening hours.** They come from the API and are managed by the merchant in the Opencals dashboard (app.opencals.com). Copy about the business (hero text, about, FAQs, contact) can live in the app. > - **Never build availability, pricing, discount or tax logic.** Render what the API returns. The cart's totals are the truth. > - **All API calls go through the `opencals` backend function.** The browser never calls Opencals directly and never sees the key. Pass `cartId` and the customer's `accessToken` into the function; it forwards them as headers and returns the API's status and body unchanged. > - **Times are UTC in the API.** Display them in the store timezone (from public settings), and send back exactly what you received. > - **Show real errors.** Surface the API's `message` and field `errors[]`. Never collapse them into "Something went wrong". > - **Watch the rate limit.** Treat it as app-wide: about 120 requests/minute across all visitors. Cache catalogue data, use availability ranges for calendars, and never prefetch slots for every service. > > ## Step 1: understand the business, then choose the booking shape > > Ask, or infer from the brief: > > 1. **What is being booked?** > - *People's time* (stylist, therapist, clinician, coach, tutor). Staff-based booking: customers pick a service, optionally a person, then a time. > - *Things* (courts, rooms, studios, lanes, bays, equipment). Resource booking: each unit is its own bookable product, often shown as a grid. > - *Both* (a padel club with court rentals and coached sessions). Show both paths. > 2. **One-to-one or group?** Groups (classes, workshops) have `maxAttendees > 1`. Show "X spots left" and a party-size picker. > 3. **Fixed or variable length?** If `allowCustomDuration` is set, show a length picker (30/60/90 min) before the time. > 4. **Where?** Several locations mean a location picker first. Online locations show a meeting link after booking. `delivery` locations (a mobile service) need the customer's address at checkout. > 5. **Extras?** Add-ons (products' `addOns`) can be picked after the time is chosen. > > Match the page flow to the booking shape first, and the visual style second. Restyling is cheap; changing the flow isn't. > > | Business | Recommended flow | > |---|---| > | Salon, barber, spa | Services list → service → (staff: "Anyone" or a person) → date → time → extras → checkout | > | Clinic, therapist | Department/collection → service → practitioner → date → time → intake questions → checkout. Keep the tone calm and clinical | > | Fitness classes, workshops | Timetable by day (group products) → class → party size → checkout | > | Courts, rooms, studios | Sport/room type toggle → date → units × time grid → length → checkout | > | Coaches, tutors | Coach profiles → service → date → time → checkout | > > ## Step 2: pages and components > > Build these. They cover most booking sites. > > 1. **Home**: hero, a short intro, featured services (from the API; the first 3–6 active products or one collection), location/contact block, and a clear "Book now" call to action. > 2. **Services** (`/services`): the catalogue from `GET /storefront/products?status=active`, grouped by `GET /storefront/product-collections?isVisible=true` when collections exist. The card shows image, title, duration (formatted from seconds), and price, as "from £X" when variants differ. Products with several `variants` show the variants as options. > 3. **Booking page** (`/book/:slug`): product detail by slug, then the flow for its shape (below). > 4. **Cart / checkout** (`/checkout`): summary, promo code, customer form, questions, payment. > 5. **Confirmation** (`/booking/confirmed`): order number (`order.name`), date/time in local time, location or online link, "Add to calendar", and a link to the account area. > 6. **Account** (`/account`): sign in (6-digit email code), upcoming and past appointments, appointment detail with reschedule/cancel, profile, marketing preferences. > 7. **Staff / team** (optional): from `GET /storefront/staff-members`. Show first name, last name and image only. > 8. **Locations** (optional, multi-location): from `GET /storefront/locations`. > > Reusable components: service card, variant selector, staff selector (with "Anyone available"), date picker (days enabled from availability ranges), time-slot grid (grouped into morning/afternoon/evening), party-size stepper, add-on selector, cart summary with countdown, checkout form driven by settings, payment step, appointment card. > > ## Step 3: the booking flow in detail > > ### Staff-based (salon, clinic, coaching) > 1. Load the product by slug. If `variants.length > 1`, the customer picks a variant first. Every later call uses the **variant `id`**. > 2. If the product has several `locations`, pick a location (or skip if there's one). > 3. Staff: offer "Anyone available" plus the variant's `staffMembers`. > 4. Date picker: call `current-availability-ranges` once for the variant (plus `locationId`/`staffMemberId` when chosen, and `timezone`) and enable only the days covered by a range. Open on the first available day (`nearest-availability`). > 5. Time slots: `current-availabilities?date=…&timezone=…` for the chosen day. Display `fromTime` converted to local time. For "Anyone", a slot is bookable if `staffMemberIds` isn't empty. Don't send `staffMemberId` in the booking unless the customer picked someone. > 6. On slot click: create the cart if needed, then `POST /storefront/appointments` with the slot, `cartId`, `numberOfAttendees` and any add-ons. Then go to checkout. > 7. If booking fails with a 4xx, the slot was probably just taken. Refresh the slots, show "That time was just booked, please choose another", and keep the selections. > > ### Group classes > - The slot list doubles as a timetable. Show `maxAttendees - attendees` spots left, grey out full slots, and cap the party size at the remaining spots. Send `numberOfAttendees`. > - Optional guests: if `allowGuests`, let the customer add friends' emails (up to `maxGuests`). Guests get copies of the emails and don't use up spots. > > ### Resource grid (courts, rooms) > - Rows are units: the variants of the "Court" product, or the products in a collection. Columns are times on the selected date at the base duration. > - Fetch `current-availabilities` per unit for the chosen date (cache each result; retry on 429 with backoff). A cell is free if that unit has a slot starting at that time. > - On cell click: if the product allows custom duration, show the lengths (base × n up to `maxDuration`). Re-query that unit with `duration=` to confirm the block fits, then book the returned slot. > - Each court is one product. Never model the 60-min and 90-min options as separate products; they wouldn't block each other. > > ### Variable length > Show the length picker before the date/time. Pass `duration` (seconds) to both availability calls, and show the price for each length as `ceil(length / base) × price`, clearly marked as an estimate. The cart total is authoritative. > > ## Step 4: cart and checkout > > - Persist `cart.id` in `localStorage`. Pass it as `cartId` to the `opencals` function, which forwards it as `X-Cart-Id`. > - Summary: each item's service, staff, local date/time, add-ons, and the line `discountedTotal`; then `subtotal`, discounts (`appliedDiscounts`), `totalTax` and `total`, formatted in `paymentCurrencyCode`. > - **Countdown**: "Your time is held for 9:32". Compute it from `expiresAt`, recompute on tab focus, call `/cart/extend` while the customer is typing, and on expiry start a new cart and send them back to pick a time. > - **Promo code**: a small "Have a code?" field. Show the mapped error message on failure. Show "Code SUMMER10 applied −£5" on success, with a remove button. > - **Customer form** from `checkoutSettings`: email and last name are always required; first name if `customerFirstNameRequired`; phone, company, VAT and billing address according to their `hidden` / `optional` / `required` values. Marketing checkboxes appear only for channels not set to `dont_show`, and are unticked by default. Show a delivery address only when a cart item is at a `delivery` location. > - A signed-in customer gets the form pre-filled from the profile and sent as `{ "kind": "existing", "customerId" }`. A guest sends `{ "kind": "new", … }`. **`kind` is always required.** > - **Questions**: fetch the cart's checkout questions. If there are any, show them as a step, and send each answer with its question text. > - **Payment**: list the providers from `/payment/providers`. Start checkout with the chosen one and branch on the returned `provider`: > - `stripe`: Stripe Payment Element in the page using the returned `publishableKey`, `stripeAccountId` and `clientSecret`; confirm, then submit with the PaymentIntent id. Install `@stripe/stripe-js` and `@stripe/react-stripe-js`. **No Stripe secret or Stripe connector is needed**, because payments go to the merchant's Stripe account connected in Opencals. > - `cash` / `bank_transfer` / `stripe_invoice`: "Pay at the venue", "Pay by bank transfer" or "Pay by invoice" copy, then submit immediately. After submit, show `paymentInstructions` if present (a "Pay invoice" button for `hostedInvoiceUrl`, the bank details, and the due date `dueAt`). > - `no_payment_required`: the button reads "Confirm booking", then submit immediately. > - Submit with `appointmentsSettings: { markAsScheduled: true }` (older field; the store decides when the booking is confirmed). Appointments that come back `pending` are awaiting confirmation: show "Awaiting payment" when `pendingReason` is `awaiting_payment`, otherwise "Awaiting confirmation". On success, clear the cart id, store `auth` tokens if returned (this signs the customer in), and go to the confirmation page. > > ## Step 5: customer account > > - Sign in with a 6-digit email code (`request-login-code` → `verify-login-code`) as the main path. Password sign-in is optional. Handle magic links at a `/link/:token` route with `resolve-link`, then redirect to `redirectPath`. > - Keep tokens for the session, and pass the access token as `accessToken` to the `opencals` function, which forwards it as `Authorization: Bearer …`. On 401, refresh once, then sign out. > - **Appointments**: two tabs, Upcoming (`status=scheduled`, `orderBy=from`, `order=ASC`) and Past (`completed`, `canceled`). Each card shows service, staff, local date/time, location, and status badge. > - **Appointment detail**: reschedule and cancel buttons only if the product allows them and the start is more than `rescheduleGap` / `cancelGap` away; otherwise explain the notice period. Rescheduling reuses the slot picker with `excludeAppointmentId`. Cancelling asks for confirmation first. > - **Profile**: first name, last name, phone. **Preferences**: marketing channels with `checkout_and_account`. **Receipts**: from order invoices. > > ## Step 6: design > > - Take the look from the brief or inspiration: colour palette, typography, photography style, density. Put colours and fonts in theme tokens (CSS variables / Tailwind theme) so they're easy to change. > - Match the tone to the business: warm and editorial for salons, dark and bold for barbers, calm and trustworthy for clinics, energetic and technical for sports venues. > - The slot picker is the core of the product. Give it large tap targets, a clear selected state, a disabled state for full or past slots, a sticky "Continue" on mobile, and local-time labels with the timezone shown when the visitor's timezone differs from the store's. > - Use skeleton loaders for the catalogue and slots. Show a friendly empty state ("No times left on this day — next available: Thu 16 Oct"). > - Format prices with `Intl.NumberFormat` in the store currency and durations from seconds ("1 h 30 min"). Use the store's 12H/24H `timeFormat`. > - Build mobile first. Most bookings happen on phones. > - Accessibility: slot buttons with `aria-pressed`, labelled form fields, visible focus, and error messages tied to their fields. > - White-label: the site can carry only the merchant's brand. There's no need to show Opencals branding. > > ## Step 7: before calling it done > > Walk through this with the connected store: > > - [ ] Services load from the API; nothing is hard-coded. > - [ ] Days without availability are disabled; slots show in local time. > - [ ] A test booking completes end to end (use a Stripe test-mode store, or cash / no-payment). > - [ ] Refreshing the checkout page keeps the cart; letting it expire recovers cleanly. > - [ ] An invalid promo code shows a clear message; a valid one changes the total. > - [ ] Required checkout fields follow the store's settings. > - [ ] Sign in with the email code works; the new booking shows under Upcoming. > - [ ] Reschedule (including keeping the same day) and cancel work, and are hidden inside the notice window. > - [ ] Errors from the API are shown to the user, not swallowed. > - [ ] No page makes more than a handful of API calls on load; catalogue data is cached. > > ## Troubleshooting > > - **A service is missing or has no times**: the product is inactive, has no schedule/availability, isn't offered at the chosen location, or is outside the advance-booking window. The merchant fixes this in the Opencals dashboard; it isn't a code bug. > - **Everything returns 404 `Cannot GET`**: the `opencals` function isn't sending `X-Api-Version: 1`. > - **401 "Origin not allowed"**: the API key has an allowed-origins list. Save a storefront key without origin restrictions as `OPENCALS_API_KEY`. > - **Checkout 400**: usually a missing `kind` on `customer`, or a field the store requires. Show `errors[]`. > - **Bursts of 429**: too many parallel availability calls. Cache, use ranges, and back off. > ``` Raw files: [opencals-storefront-api.md](https://opencals.com/ai/opencals-storefront-api.md) · [base44-booking-site-playbook.md](https://opencals.com/ai/base44-booking-site-playbook.md) **3. Store the key as an app secret** In the app editor: **Dashboard → Secrets → Add Secret**. Name `OPENCALS_API_KEY`, value your `sfk_…` key. **4. Build the function, then the site** ```text theme={"theme":{"light":"github-light","dark":"github-dark-default"}} Use the opencals-booking-site and opencals-storefront-api skills. First, create the opencals backend function exactly as the playbook's Step 0 describes, using the OPENCALS_API_KEY secret, and test it with GET /storefront/stores/public-settings. Show me the store name it returns. Don't build any pages yet. ``` Once it returns your store name, describe the business (services, prices and times come from Opencals, so leave them out of the prompt). ## The `opencals` function contract | | | | - | - | | Input | `{ method, path, query?, body?, cartId?, accessToken? }` | | Allowed paths | Only `/storefront/*` | | Headers sent | `X-Api-Key` (from secret), `X-Api-Version: 1`, `Content-Type` with a body, `X-Cart-Id` from `cartId`, `Authorization: Bearer` from `accessToken` | | Output | `{ status, data }`, the API's status and JSON unchanged; doesn't throw on 4xx | | Frontend call | `base44.functions.invoke('opencals', { ... })` | > [!NOTE] > > Why not a Base44 custom OpenAPI integration? Those send fixed, admin-configured > headers. Opencals carts and customer sessions need a per-visitor `X-Cart-Id` > and `Authorization` header, which only a backend function can pass through. ## Related * [Lovable](/docs/ai-agents/lovable) · [v0](/docs/ai-agents/v0) * [Storefront API reference](/docs/api-reference/introduction) # opencals-build-booking-site skill Source: https://opencals.com/docs/ai-agents/build-booking-site-skill The Agent Skill that builds a whole booking website on Opencals — pick an official Next.js template, scaffold, wire availability and checkout, rebrand, and deploy to Vercel. The build skill. Install it when you want an agent to stand up a complete booking website — not just call the API. It picks the closest official template, scaffolds it, wires it to a store, restyles it to your brand, and deploys it. For exact API calls it defers to the [opencals-storefront-api skill](/docs/ai-agents/storefront-api-skill). **Repo:** [github.com/letsopencals/skills](https://github.com/letsopencals/skills) · **Install:** [see the overview](/docs/ai-agents/overview#install) ## What it covers * **Choosing a template** by booking shape (people vs resources, groups, multi-location). * **The workflow**: scaffold → configure env → understand the SDK wiring → rebrand → verify → deploy to Vercel. * **Resource-booking** (courts, lanes, rooms, equipment): the three conflict rules, `allowCustomDuration`, and the units × time grid strategy, and multi-location resources with one availability read per location — the [VOLT template](/docs/open-source/volt) is the worked example. * **Rentals by the day** (cars, boats, equipment, villas): 1-day base duration with custom duration on a 24/7 schedule, merged availability ranges with a client-side fit, 00:00-aligned slots, handover details as custom attributes. The [NOIR Drive template](/docs/open-source/noir) is the worked example. * **Nightly stays** (villas, cabins, guest houses, rooms): a one-night base with custom duration and fixed check-in/check-out times that the API enforces, turnover days, guest and arrival details as custom attributes. The [Bali Villa Rentals template](/docs/open-source/bali-villas) is the worked example. * **Schools and classes** (languages, music, coding, tutoring): subjects as collections, levels as variants, teachers as staff, seats left from slot availability, and the online location's `link` for a Join button. The [Fluently template](/docs/open-source/fluently) is the worked example. * **Fitness and Pilates studios** (reformer, yoga, barre, spin): one variant per class × studio × instructor capped at the beds in the room, Full classes inferred from each series' weekly pattern because the API drops full slots, privates sharing a product pool, and dated workshops. The [Tensile template](/docs/open-source/reformer) is the worked example. * **Clinic groups with many clinicians** (dental, physio, multi-site practices): studios as locations with their own hours, departments as collections, options as variants, booking by clinician or "first available" from one cached availability read per studio and treatment, a follow-on visit (the hygienist straight after) as a second cart appointment, and per-patient pre-visit questions. The [Alba Dental template](/docs/open-source/alba) is the worked example. * **Coworking and room hire** (desks, meeting rooms, booths, studios at several sites): every room and desk its own staffless product at one location, an open floor as one capacity product per location booked by the seat, seats left from the availability ranges' `attendees` / `maxAttendees`, one cached availability read per location, a multi-item cart for the whole day with extras suggested in the gaps, and meeting invitees as guests. The [Gable template](/docs/open-source/gable) is the worked example. * **Customising**: colour/font tokens, `siteConfig`, and what comes from the API vs. what you edit in code. ## Templates it builds on > [card] [Haar — salon](/docs/open-source/haar) > [card] [Frisor — barbershop](/docs/open-source/frisor) > [card] [Clear Care — clinic](/docs/open-source/clarity) > [card] [VOLT — padel & squash](/docs/open-source/volt) > [card] [NOIR Drive — car rental](/docs/open-source/noir) > [card] [Fluently — language school](/docs/open-source/fluently) > [card] [Bali Villa Rentals — villa stays](/docs/open-source/bali-villas) > [card] [Tensile — reformer Pilates](/docs/open-source/reformer) > [card] [Alba Dental — dental group](/docs/open-source/alba) > [card] [Gable — coworking](/docs/open-source/gable) ## When it triggers "Build me a booking website", "I run a \[salon / clinic / padel club] and need a booking site", or handing the agent a business idea plus inspiration. ## Related * [Open-source templates](/docs/open-source/templates) — the template gallery * [opencals-storefront-api skill](/docs/ai-agents/storefront-api-skill) — the exact API/SDK reference this skill builds on * [Build a booking page](/docs/guides/build-a-booking-page) — the manual tutorial # Lovable Source: https://opencals.com/docs/ai-agents/lovable Add Opencals to Lovable as a custom connector so Lovable apps take real bookings: live availability, cart, checkout and Stripe payments. Every field ready to copy. A Lovable **custom connector** registers the Opencals API once for the whole workspace. Two knowledge files teach Lovable how to use it, and the key lives in Lovable's encrypted connector credentials, never in project code. Describe a business and Lovable builds a site that reads your real services, shows live availability, holds the slot during checkout and takes payment through your own Stripe account. > [!NOTE] > > You need **admin or owner** rights in the Lovable workspace to create a custom > connector. Anyone in the workspace can connect to it afterwards. **1. Create a storefront key without allowed origins** In the Opencals dashboard open **Settings → API Keys** and create a key (`sfk_…`). Name it "Lovable" and **leave allowed origins empty**: Lovable calls the API from its gateway, which sends no `Origin` header, so a key with an allowlist fails with `401 Origin not allowed for this API key`. **2. Create the connector** In Lovable open **Connectors → + → Custom connector** and fill in the details: | Field | Value | | - | - | | Display name | `Opencals` | | Short description | `Headless commerce for bookable services: cart, checkout, payments` | | Category | `E-commerce` | | Documentation URL | `https://opencals.com/docs` | | Logo | [icon.png](https://opencals.com/images/logo/icon.png) | > [accordion] Description (copy) > > ```text theme={"theme":{"light":"github-light","dark":"github-dark-default"}} > Opencals is a headless commerce API for selling time: services, sessions, classes, and rentable resources such as courts, rooms and studios. It works like a storefront API: a catalogue of bookable products with variants and add-ons, a cart, checkout, payments, discounts, orders and customer accounts. Every product is time-based, and Opencals handles the availability, capacity and double-booking. Lovable builds the storefront; the merchant's live Opencals store supplies the products, prices and rules. > > What the app can do: > - Catalogue: products with variants, prices, images, collections, staff, locations, and add-ons (fixed or charged per hour) > - Real-time availability: exact slots per day or ranges for a calendar, filtered by staff, location and booking length > - Cart: hold slots with an expiry timer, add or change add-ons, apply promo codes, automatic discounts, and customer credit (money or prepaid hours) > - Checkout: customer details, billing address with company and VAT, delivery address for mobile services, marketing consent per channel, and custom checkout questions including file uploads > - Payments: cards through Stripe (paid into the merchant's own connected account), cash, bank transfer, or instant confirmation when nothing is due. Tax-inclusive or tax-exclusive pricing, with authoritative totals from the API > - Orders and receipts: an order number, line items, payment status, and invoices > - Group classes with capacity and spots left, invited guests, and variable-length bookings (e.g. a court for 60 or 90 minutes) > - Customer accounts: email-code or password sign-in, upcoming and past bookings, self-service reschedule and cancel within the merchant's notice rules, profile, and marketing preferences > > The server side handles availability, timezones, double-booking prevention, pricing, tax, discounts, payment capture, and confirmation and reminder emails. The merchant manages products, staff, schedules, discounts and payment settings in the Opencals dashboard (app.opencals.com). You need an Opencals store and a Storefront API key (sfk_…) created in the Opencals dashboard. > ``` **3. Authentication: Advanced, two headers** Set **API base URL** to `https://api.opencals.com` and choose **Advanced**: | Key | Label | Send as | Secret | | - | - | - | - | | `X-Api-Key` | Storefront API key (sfk\_…) | Header | Yes | | `X-Api-Version` | API version (enter 1) | Header | No | **Test request:** `GET` `/storefront/stores/public-settings`. It returns 200 with the store name and currency when the key and version header are right. > [!WARNING] > > Every storefront route returns `404 Cannot GET …` without `X-Api-Version: 1`, > including the test request. **4. Add the two knowledge files** Click **Add knowledge file** twice. Use the name and description exactly; Lovable reads the description to decide which file to open. **File 1**. Name: `Opencals Storefront API`. Description: `Complete endpoint reference: catalogue, availability, cart, appointments, discounts, checkout and payment, customer accounts, reschedule/cancel, errors and rate limits.` > [accordion] Content: Opencals Storefront API (\~36k chars) > > ````markdown opencals-storefront-api.md theme={"theme":{"light":"github-light","dark":"github-dark-default"}} > # Opencals Storefront API — complete reference > > The Opencals connector is a hosted booking API for service businesses (salons, clinics, studios, courts, rooms, classes). It owns availability maths, timezones, double-booking prevention, pricing, discounts, tax and payments. The app's job is to call the endpoints below in the right order and render the results. Never implement any of that logic in the app. > > Everything here is copied from the live API. **Never invent endpoints, fields or enum values.** If something isn't listed here, it doesn't exist. > > ## How to call the API > > - All paths are relative to the connector's base URL. The connector adds the store's API key and the `X-Api-Version: 1` header on every request. **Do not add `X-Api-Key` or `X-Api-Version` yourself.** > - Call Opencals from server-side code only, through the connector. The browser must never call Opencals directly or hold the key. > - Request and response bodies are JSON. Send `Content-Type: application/json` on requests with a body. > - The connector's key identifies **one store**. Every endpoint is scoped to that store automatically. There is no store id to pass. > - Two per-request headers the app must pass through itself: > - `X-Cart-Id: ` on cart and checkout calls (see "Cart"). > - `Authorization: Bearer ` for a signed-in customer (see "Customer accounts"). Optional on cart, checkout and booking calls; required on account calls. > > ## Key endpoints > > ### Catalogue (read-only) > | Method | Path | Purpose | > |---|---|---| > | GET | `/storefront/stores/public-settings` | Store name, currency, timezone, time/date format, checkout field rules, marketing opt-in display, contact info | > | GET | `/storefront/products` | Paginated list of services (products), each with `variants[]` | > | GET | `/storefront/products/{productId}` | One product with staff, locations, add-ons, variants, checkout questions | > | GET | `/storefront/products/slug/{slug}` | Same, by slug | > | GET | `/storefront/products/{productId}/add-ons` | Add-ons bookable with this product (query: `locationId`, `staffMemberId`) | > | GET | `/storefront/product-collections` | Collections/categories (query: `isVisible`) | > | GET | `/storefront/product-collections/slug/{slug}` | One collection with its products | > | GET | `/storefront/locations` | Locations | > | GET | `/storefront/locations/{locationId}` · `/storefront/locations/slug/{slug}` | One location | > | GET | `/storefront/staff-members` | Staff members | > | GET | `/storefront/staff-members/slug/{slug}` | One staff member | > | GET | `/storefront/add-ons` · `/storefront/add-ons/{addOnId}` · `/storefront/add-ons/slug/{slug}` | Add-ons | > | GET | `/storefront/images/{imageId}` | Image record (URLs) | > | GET | `/storefront/checkout-questions/{productId}/translations/{language}` | Checkout questions for a product | > | GET | `/storefront/feedback-questions/{productId}/translations/{language}` | Post-appointment feedback questions | > > ### Availability > | Method | Path | Purpose | > |---|---|---| > | GET | `/storefront/products/{productId}/current-availabilities` | Exact bookable slots for one date | > | GET | `/storefront/products/{productId}/current-availability-ranges` | Merged availability windows across the booking horizon (for calendar highlighting) | > | GET | `/storefront/products/{productId}/nearest-availability` | The next available slot (204 when none) | > > ### Cart > | Method | Path | Purpose | > |---|---|---| > | POST | `/storefront/cart` | Create a cart, or return the existing one named by `X-Cart-Id` | > | GET | `/storefront/cart` | Read the cart (`X-Cart-Id`) | > | POST | `/storefront/cart/items` | Add an existing appointment to the cart | > | DELETE | `/storefront/cart/items/{itemId}` | Remove a cart item (and release its held slot) | > | POST | `/storefront/cart/extend` | Push the cart's `expiresAt` further out | > | POST | `/storefront/cart/items/{cartItemId}/add-ons` | Attach an add-on to a cart item | > | PATCH | `/storefront/cart/add-ons/{cartAddOnItemId}` | Change a fixed add-on's quantity | > | DELETE | `/storefront/cart/add-ons/{cartAddOnItemId}` | Remove an add-on | > | POST | `/storefront/cart/discount-code` | Apply a promo code | > | DELETE | `/storefront/cart/discount-code` | Remove the promo code | > > ### Appointments > | Method | Path | Purpose | > |---|---|---| > | POST | `/storefront/appointments` | Create (hold) an appointment for a slot, attached to a cart | > | GET | `/storefront/appointments` | The signed-in customer's appointments (paginated) | > | GET | `/storefront/appointments/{appointmentId}` | One appointment | > | PUT | `/storefront/appointments/{appointmentId}/reschedule` | Move to a new slot | > | PUT | `/storefront/appointments/{appointmentId}/cancel` | Cancel | > | POST | `/storefront/appointments/{appointmentId}/guests` | Invite a guest by email | > | DELETE | `/storefront/appointments/{appointmentId}/guests/{guestId}?notify=true` | Remove a guest (`notify` query is required) | > | POST | `/storefront/appointments/{appointmentId}/feedback` | Submit feedback answers | > | GET | `/storefront/appointments/preferences/booking-history` | The customer's usual product/staff/location, for pre-filling | > > ### Checkout and payment > | Method | Path | Purpose | > |---|---|---| > | GET | `/storefront/cart/checkout/questions/{language}` | Checkout questions for everything in the cart | > | POST | `/storefront/cart/checkout/save-customer` | Attach customer details, billing/delivery address and marketing consent to the cart | > | POST | `/storefront/cart/checkout/save-answers` | Save checkout-question answers | > | GET | `/storefront/payment/providers` | Payment options for this cart (`X-Cart-Id`) | > | POST | `/storefront/cart/checkout/start` | Start payment with the chosen provider; returns a Stripe client secret or redirect | > | POST | `/storefront/cart/checkout/submit` | Finalise: creates the order and confirms the appointments | > | POST | `/storefront/uploads/presign` | Get an upload URL for a file-upload checkout question | > > ### Orders > | Method | Path | Purpose | > |---|---|---| > | GET | `/storefront/orders` | The signed-in customer's orders | > | GET | `/storefront/orders/{orderId}` | One order | > | GET | `/storefront/orders/{orderId}/invoices` | Invoices/receipts for an order | > > ### Customer accounts > | Method | Path | Purpose | > |---|---|---| > | POST | `/storefront/auth/sign-up` | Register with email + password (204) | > | POST | `/storefront/auth/sign-in` | Email + password → tokens | > | POST | `/storefront/auth/request-login-code` | Email a 6-digit login code (204) | > | POST | `/storefront/auth/verify-login-code` | Email + code → tokens | > | GET | `/storefront/auth/resolve-link?token=…` | Resolve a magic link from an email → tokens + where to go | > | GET | `/storefront/auth/refresh` | Refresh token (as `Authorization: Bearer `) → new tokens | > | POST | `/storefront/auth/request-password-reset` | Email a reset link (204) | > | POST | `/storefront/auth/reset-password` | Token + new password (204) | > | POST | `/storefront/auth/request-email-verification` | Resend verification email (204) | > | POST | `/storefront/auth/verify-email` | Token → tokens | > | GET / PUT | `/storefront/self-service/profile` | Read / update name and phone | > | PUT | `/storefront/self-service/password` | Set or change password | > | GET / PUT | `/storefront/self-service/marketing-consent` | Read / update per-channel marketing consent | > > ## Core concepts > > ### IDs and products vs variants > - A **product** is a bookable service. `GET /storefront/products` returns items with a `variants[]` array (e.g. "Haircut" → "Short hair", "Long hair"). Each variant is a full product row with its own `id`, `price`, `duration`, `staffMembers` and `locations`. > - **The bookable id is always a variant's `id`.** Use it in `/storefront/products/{productId}/…` paths and as `slot.productId`. Don't use the `productId` field on a product row: that's a grouping key shared by all its variants. A product with one variant has `variants[0].id === id`. > - IDs are UUID strings. > > ### Time and money > - **All slot dates and times are UTC.** Slots use `fromDate`/`toDate` (`YYYY-MM-DD`) and `fromTime`/`toTime` (`HH:MM:SS`). Appointment `from`/`to` are ISO 8601 UTC timestamps. > - Convert to the store's timezone (`settings.timezone` in public settings) or the visitor's timezone **for display only**. Always send back the exact UTC values the API gave you. > - Durations and gaps are in **seconds** (`duration: 3600` = 1 hour). > - Prices are decimal numbers in the store currency (`currency` in public settings, `paymentCurrencyCode` on carts and orders), e.g. `45` or `12.5`. Not cents. `taxesIncluded` says whether prices already include tax. > > ### Pagination > List endpoints take `page` (1-based, default 1) and `take` (default 50, max 100), and optionally `q` (search), `orderBy`, `order` (`ASC`/`DESC`). They return: > > ```json > { > "data": [ ... ], > "meta": { "page": 1, "take": 50, "itemCount": 12, "pageCount": 1, "hasPreviousPage": false, "hasNextPage": false } > } > ``` > > Single-resource endpoints return the object directly (no wrapper). > > ## Store settings > > `GET /storefront/stores/public-settings` → `{ name, domain, currency, settings, storefrontSettings, contactInfo, checkoutSettings, features }`. > > - `settings.timezone`, `settings.timeFormat` (`12H` | `24H`), `settings.dateFormat`, `settings.defaultAdvanceScheduleDays` (-1 = unlimited). > - `checkoutSettings` controls the customer form: > - `customerFirstNameRequired: boolean`. Last name and email are always required. > - `customerPhoneRequirement`, `customerCompanyNameRequirement`, `customerCompanyVatNumberRequirement`, `customerBillingAddressRequirement`: each `hidden` | `optional` | `required`. > - `emailMarketingOptIn`, `smsMarketingOptIn`, `whatsappMarketingOptIn`: each `dont_show` | `checkout_only` | `checkout_and_account`. > - Fetch this once and cache it. Build the checkout form from it rather than hard-coding fields. > > ## Products > > Useful fields on a product/variant: > > | Field | Meaning | > |---|---| > | `id`, `slug`, `title`, `variantTitle`, `description` | Identity and copy | > | `price`, `taxable`, `duration` (s) | Pricing and length | > | `image`, `images[]` | Images; use `image.url` (can be null) | > | `staffMembers[]`, `locations[]` | Who can perform it, and where | > | `maxAttendees` | Capacity per slot (1 = private; >1 = group class) | > | `allowCustomDuration`, `maxDuration` (s, -1 = unlimited) | Variable-length bookings (see below) | > | `allowGuests`, `maxGuests` (null = unlimited) | Whether named guests can be invited | > | `allowCustomerReschedule`, `rescheduleGap` (s) | Self-service reschedule, and the minimum notice | > | `allowCustomerCancel`, `cancelGap` (s) | Self-service cancel, and the minimum notice | > | `advanceScheduleThreshold` | How many days ahead it can be booked | > | `status` | `active` \| `inactive`. Show active only | > | `collections[]`, `addOns[]`, `checkoutQuestions[]` | On the detail endpoint | > > `GET /storefront/products?status=active&take=100` is the usual catalogue call. Filter by location with `locationId`. > > Locations have `type`: `physical` (has an address; use `displayAddress` if set, else `address`), `online` (has a `link`), or `delivery` (the business comes to the customer, so a customer address is needed at checkout). > > ## Availability > > ### Exact slots for a day > > ``` > GET /storefront/products/{productId}/current-availabilities?date=2026-10-14&timezone=Europe/London&locationId=…&staffMemberId=… > ``` > > Query: `date` (required, `YYYY-MM-DD`), `timezone` (IANA name; aligns the "day" to local time, so always send it), `locationId`, `staffMemberId`, `duration` (seconds as a string, for variable-length bookings), `excludeAppointmentId` (for rescheduling). > > Response: an array of slots: > > ```json > [ > { > "productId": "b2c1…", > "fromDate": "2026-10-14", "fromTime": "09:00:00", > "toDate": "2026-10-14", "toTime": "09:45:00", > "staffMemberIds": ["5f0e…", "91aa…"], > "locationIds": ["c3d4…"], > "attendees": 0, > "maxAttendees": 1 > } > ] > ``` > > - `staffMemberIds` lists who is free for that slot. If the customer picked "anyone", you may omit `staffMemberId` when booking. If they picked a person, filter slots by it (or pass `staffMemberId` in the query) and send it in the slot. > - For group products, spots left = `maxAttendees - attendees`. > - An empty array means no availability that day. > > ### Calendar highlighting > > ``` > GET /storefront/products/{productId}/current-availability-ranges?timezone=Europe/London&locationId=…&staffMemberId=…&duration=… > ``` > > Returns the same slot shape, but each entry is a merged **window** of availability across the horizon (`date` is optional; omit it for the full horizon). Use it to enable or disable days in a date picker, then call `current-availabilities` for the day the customer picks. This costs one request per product instead of one per day. > > ### Next available > > `GET /storefront/products/{productId}/nearest-availability` → one slot (`productId, locationId, staffMemberId, fromDate, fromTime, toDate, toTime`), or HTTP 204 when nothing is bookable. Use it to open the picker on the first bookable day. > > ### Many units in a grid (courts × time, rooms × time) > There is no multi-product availability endpoint. Call `current-availabilities` once per unit for the selected date, cache each result by product + date + duration, and mark a cell available if that unit has a slot starting at that time. Watch the rate limit (see Notes). > > ## Booking flow (the happy path) > > 1. `POST /storefront/cart` with header `X-Cart-Id: ""` (empty on the first call). Store `cart.id` (e.g. in `localStorage`) and send it as `X-Cart-Id` on every later cart/checkout call. > 2. `GET …/current-availabilities`, and the customer picks a slot. > 3. `POST /storefront/appointments` with the slot and `cartId`. The appointment is held in the cart; you don't need to call `/cart/items`. > 4. `GET /storefront/cart` to render the summary (items, add-ons, discounts, totals, `expiresAt`). > 5. Optional: `POST /storefront/cart/discount-code`. > 6. `POST /storefront/cart/checkout/save-customer`. > 7. If `GET /storefront/cart/checkout/questions/{language}` returns questions: `POST /storefront/cart/checkout/save-answers`. > 8. `GET /storefront/payment/providers`, then the customer picks one, then `POST /storefront/cart/checkout/start`. > 9. Pay (Stripe in the browser) if needed, then `POST /storefront/cart/checkout/submit`. > 10. Show the confirmation from the returned `order`. Clear the stored cart id. > > ### Create an appointment > > ``` > POST /storefront/appointments > ``` > > ```json > { > "slot": { > "productId": "b2c1…", > "fromDate": "2026-10-14", "fromTime": "09:00:00", > "toDate": "2026-10-14", "toTime": "09:45:00", > "staffMemberId": "5f0e…", > "locationId": "c3d4…" > }, > "cartId": "8e7d…", > "numberOfAttendees": 1, > "addOns": [{ "addOnId": "a1b2…", "quantity": 1 }], > "guests": [{ "email": "friend@example.com" }], > "customAttributes": { "source": "lovable-site" } > } > ``` > > - `slot` is required. Copy the date/time fields exactly from a returned availability slot. `staffMemberId` and `locationId` are optional (nullable). > - Optional: `cartId` (always send it on the booking path), `numberOfAttendees` (default 1, capped by remaining capacity), `addOns[]`, `guests[]` (only if the product has `allowGuests`), `checkoutQuestionAnswers[]`, `address` (service address for a `delivery` location), `customAttributes` (string→string map, max 250 keys; keys ≤255 chars, values ≤5000 chars). > - Response (201): the appointment (`id`, `name` (a human number like `1001`), `status: "pending"`, `from`, `to`, `product`, `staffMember`, `location`, `addOns`, `guests`, …). It stays `pending` until checkout is submitted. > - 4xx here usually means the slot was just taken, is outside the booking window, or capacity was exceeded. Re-fetch availability and ask the customer to choose again. > > To remove a booking from the cart: `DELETE /storefront/cart/items/{itemId}` using the cart item's `id` (not the appointment id). > > ## Cart > > `POST /storefront/cart` (header `X-Cart-Id`, empty or an existing id) → `CartResponse`: > > | Field | Meaning | > |---|---| > | `id` | Cart id, sent as `X-Cart-Id` | > | `status` | `active` \| `converted` \| `abandoned`. `converted` already has an order: start a new cart. `abandoned` (expired) is revived by adding an item or by checkout while its slots are still free | > | `expiresAt` | When held slots are released (ISO UTC; the store's hold window, 15 minutes by default) | > | `paymentCurrencyCode`, `taxesIncluded` | Currency and tax mode | > | `subtotal`, `totalTax`, `total` | **Authoritative totals.** Display these; never recompute | > | `appliedDiscounts[]` | `{ id, title, totalAmount, code? }` | > | `appliedDiscountCode` | The promo code currently applied, or null | > | `creditCovered`, `creditRemaining`, `creditValueType` | Customer balance used (`time` = minutes, `fixed_amount` = money) | > | `items[]` | One per appointment (below) | > > Each `items[]` entry: `id` (cart item id), `appointmentId`, `appointment` (with `from`, `to`, `product`, `staffMember`, `location`), `quantity`, `originalUnitPrice`, `originalSubtotal`, `totalDiscount`, `discountedSubtotal`, `totalTax`, `discountedTotal`, `discounts[]`, `addOnItems[]`, `addOnSubtotal`, `addOnTotalTax`. Use the line totals (`discountedSubtotal`, `discountedTotal`) for exact per-line amounts. `discountedUnitPrice` and `unitTaxAmount` are approximate. > > ### Expiry > - Show a countdown from `expiresAt`, and recompute it when the tab regains focus. > - While the customer is actively on checkout, call `POST /storefront/cart/extend` (with `X-Cart-Id`) to push `expiresAt` out. Extending (and starting checkout) only moves it later, never earlier. > - An expired cart is revived by checkout `start`/`submit` (and adding an item gives it a fresh hold window) when its slots are still free. If checkout fails with `CART_EXPIRED`, start a new cart (`X-Cart-Id: ""`). Tell the customer their held time was released and let them pick again. Don't retry the old id. > > ### Add-ons > - Product add-ons: `GET /storefront/products/{productId}/add-ons`. Each has `price`, `durationMultiplied` and `maxQuantity`. > - `durationMultiplied: true`: charged per base-duration unit of the appointment. Quantity is set automatically; don't send one. > - `durationMultiplied: false`: a fixed add-on. The customer picks a quantity from 1 to `maxQuantity`. > - Attach at creation (`addOns` on the appointment) or later with `POST /storefront/cart/items/{cartItemId}/add-ons` and body `{ "addOnId": "…", "quantity": 2 }`. Change the quantity with `PATCH /storefront/cart/add-ons/{cartAddOnItemId}` and body `{ "quantity": 3 }`. Each returns the updated cart. > > ## Discounts > > Three kinds, all resolved server-side and reflected in the cart. Never calculate discounts in the app. > > 1. **Automatic**: configured by the merchant and applied when the cart qualifies. No call needed; they appear in `appliedDiscounts` and `items[].discounts`. > 2. **Promo codes**: `POST /storefront/cart/discount-code` with body `{ "code": "SUMMER10" }` returns the updated cart. `DELETE /storefront/cart/discount-code` removes it. On failure you get HTTP 400: > ```json > { "message": "This code has expired", "code": "CODE_EXPIRED", "statusCode": 400 } > ``` > `code` is one of `CODE_NOT_FOUND`, `CODE_EXPIRED`, `CODE_DISABLED`, `CODE_LIMIT_REACHED`, `CODE_CUSTOMER_INELIGIBLE`, `CODE_NO_MATCHING_ITEMS`, `CODE_NO_CREDIT`, `minimum_requirement_not_met`. Show a friendly message next to the code field and keep the customer in checkout. > 3. **Balance / credit**: a customer can hold a money or time balance (e.g. "10 free hours"). It's used up automatically for a signed-in customer and shows as `creditCovered` / `creditRemaining` / `creditValueType` on the cart. > > Per-line discount rows (`items[].discounts[]`, `addOnItems[].discounts[]`): `{ discountId, title, amountPerUnit, valueType: "percentage" | "fixed_amount" | "time", value, targetType: "base" | "add_on" }`. > > If `checkout/start` returns `discountCodeCleared: true`, the code stopped applying (e.g. the cart changed). Tell the customer. > > ## Checkout > > ### Customer object: the `kind` field is required > Every `customer` object in `save-customer`, `checkout/start`, `checkout/submit` and `POST /storefront/appointments` **must** include `kind`: > - New customer: `{ "kind": "new", "email": "…", "firstName": "…", "lastName": "…", "phone": "…" }` > - Existing customer: `{ "kind": "existing", "customerId": "…" }`, e.g. a signed-in customer, or one whose `customerId` came back from `save-customer`. > > If you leave out `kind`, the API can't tell which shape you sent, and the request is rejected or the customer isn't saved. > > ### Save the customer > > ``` > POST /storefront/cart/checkout/save-customer (X-Cart-Id) > ``` > > ```json > { > "customer": { > "kind": "new", > "email": "jo@example.com", > "firstName": "Jo", > "lastName": "Smith", > "phone": "+447700900000", > "billingAddress": { > "companyName": "Smith Ltd", > "taxRegistrationId": "GB123456789", > "addressLine1": "1 High St", "city": "London", "postalCode": "N1 1AA", "country": "GB" > }, > "deliveryAddress": { > "firstName": "Jo", "lastName": "Smith", > "addressLine1": "2 Park Rd", "city": "London", "postalCode": "N2 2BB", "country": "GB" > }, > "marketingConsent": { "email": true, "sms": false, "whatsapp": false } > } > } > ``` > > Response: `{ "customerId": "…" }`. Keep it and use `{ "kind": "existing", "customerId }` in the next steps. > > If the email belongs to an existing customer and the request isn't signed in as them (no customer `Authorization` token), the response is `{}` with no `customerId`. The booking is still attached to that customer, but nothing on their profile changes (name, phone, billing address, marketing consent). In the next steps, send the same `kind: "new"` details again or leave `customer` out: the cart already holds the customer. Save-customer and `checkout/start` don't write anything to the customer: until the order is placed, the billing and delivery addresses entered belong to the cart only, and their `customerId` is `null`. When `checkout/submit` places the order, those addresses are added to the customer's saved addresses (the order and invoice use them as entered). > > - `billingAddress` (optional): `firstName`, `lastName`, `companyName`, `taxRegistrationId` (VAT/GST), `addressLine1`, `addressLine2`, `city`, `state`, `postalCode`, `country`, `email`, `phone`. Company name and VAT id go **here**, not on the customer. Show or require it according to `checkoutSettings`. > - `deliveryAddress` (optional): same fields without `taxRegistrationId`. Needed **only** when the cart has an appointment at a `delivery`-type location. It applies to every delivery appointment in the order and overrides any per-appointment `address`. > - `marketingConsent` (optional): per-channel booleans. Only show the channels whose `…MarketingOptIn` setting isn't `dont_show`. Leave them unticked by default. > - `country` is always a 2-letter uppercase ISO code (`GB`, `US`, `DE`). > - A signed-in customer sends `{ "kind": "existing", "customerId": "", "firstName"?, "lastName"?, "phone"?, "billingAddress"?, "deliveryAddress"?, "marketingConsent"? }`. > - Required billing fields are checked against the `billingAddress` in the request or, if it has none, against the billing already saved on the cart. You don't have to send the billing address again at `checkout/start` or `checkout/submit`. > > ### Checkout questions > > `GET /storefront/cart/checkout/questions/en` (use the site language code) returns an array of `{ id, type, required, order, translations: [{ title, description, options }], existingAnswer?, fileConfig? }`. Use `translations[0].title` as the label (and as `question` when saving). `type` is one of `single-line-text-field`, `multi-line-text-field`, `dropdown`, `rating`, `checkbox`, `file-upload`. Render them in `order`, enforce `required`, and pre-fill from `existingAnswer`. > > ``` > POST /storefront/cart/checkout/save-answers (X-Cart-Id) > ``` > > ```json > { > "answers": [ > { "questionId": "q1…", "question": "Any allergies?", "answer": "None" }, > { "questionId": "q2…", "question": "Upload your referral", "answer": "", "fileIds": ["f9…"] } > ] > } > ``` > > `questionId`, `question` (the question text as shown) and `answer` (a string, even for ratings and checkboxes) are all required. For `file-upload` questions (limits in `fileConfig`): > 1. `POST /storefront/uploads/presign` with `{ "questionId": "…", "questionKind": "checkout", "filename": "referral.pdf", "mime": "application/pdf", "size": 48213 }` → `{ fileId, presignedUrl, expiresIn }`. > 2. From the browser, `PUT` the file bytes to `presignedUrl` with a matching `Content-Type`. This is a direct storage upload, not through the connector. > 3. Send `fileIds: [fileId]` in the answer. > > ### Payment providers > > `GET /storefront/payment/providers` (with `X-Cart-Id`) → `[{ name, displayName, description?, checkoutMode, icon?, mode? }]` > > - `name`: `stripe` | `cash` | `bank_transfer` | `stripe_invoice` | `shopify` | `no_payment_required` > - `checkoutMode`: `internal` (card form in the app, i.e. Stripe), `redirect` (send the browser to `redirectUrl`), `manual` (pay later: cash on arrival, bank transfer or a Stripe-hosted invoice), `none` (nothing to pay) > - `stripe_invoice` is only offered when the store has Stripe connected. Label it "Pay by invoice". > - `mode`: `test` | `live` for Stripe. Show a "test mode" badge when it's `test`. > > Show only what's returned. If there's exactly one option, preselect it. > > ### Start checkout > > ``` > POST /storefront/cart/checkout/start (X-Cart-Id) > { "provider": "stripe", "customer": { "kind": "existing", "customerId": "…" } } > ``` > > Response: > ```json > { > "provider": "stripe", > "clientSecret": "pi_…_secret_…", > "publishableKey": "pk_live_…", > "stripeAccountId": "acct_…", > "redirectUrl": null, > "paymentId": "…", > "cart": { "...": "updated cart" }, > "invalidItemIds": [], > "revivedItemIds": [], > "discountCodeCleared": false > } > ``` > > **Branch on the `provider` in the response, not the one you requested.** When nothing is due (a £0 total, or below the minimum card charge), the API switches the provider to `no_payment_required`. > > - `no_payment_required`, `cash`, `bank_transfer`, `stripe_invoice`: call `submit` straight away (no payment step). > - `stripe`: in the browser, load Stripe.js with `publishableKey` and `{ stripeAccount: stripeAccountId }`, mount the Payment Element with `clientSecret`, then call `stripe.confirmPayment({ elements, redirect: 'if_required' })`. On success, call `submit` with the PaymentIntent id. The app needs no Stripe secret key. The merchant's Stripe account is connected in Opencals. > - `redirectUrl` present: send the browser there. > - `invalidItemIds` not empty: those items were no longer bookable and were removed. Tell the customer and show the updated cart. > > ### Submit > > ``` > POST /storefront/cart/checkout/submit (X-Cart-Id) > { "stripePaymentIntentId": "pi_…", "appointmentsSettings": { "markAsScheduled": true } } > ``` > > - `stripePaymentIntentId`: only for Stripe. > - `appointmentsSettings` is still accepted for older clients, but the store decides when a customer booking is confirmed (straight away, or only when the booking meets the store's conditions, such as being paid in time). Sending `markAsScheduled: true` doesn't skip that. > - Optional `trackingData` (e.g. `{ "gclid": "…" }`) for ad attribution. > > Response: `{ order, auth?, customer?, paymentInstructions? }`. > - `order`: `id`, `name` (e.g. `1042`), `total`, `subtotal`, `totalTax`, `paidTotal`, `dueToPay`, `paymentStatus` (`unpaid` | `paid` | `partially-paid` | `voided`), `paymentDueAt?`, `lineItems[]`, `paymentCurrencyCode`. `voided` means the order was cancelled with nothing paid. > - `paymentInstructions` (optional, pay-later orders only): `{ provider, hostedInvoiceUrl?, dueAt?, bankDetails? }`. Show it on the confirmation page: a "Pay invoice" button for `hostedInvoiceUrl` (Stripe invoice), the bank details (`accountName`, `bankName`, `iban`, `swift`) for bank transfer, and "Please pay by {dueAt}" when `dueAt` is set. Any field can be null. > - The order's appointments may still be `pending` after submit. `pending` on a placed order means **awaiting confirmation**; `pendingReason` is `awaiting_payment` (confirmed once paid) or `awaiting_approval` (the merchant still has to confirm it; a paid booking can still be awaiting approval). Show "Awaiting payment" for `awaiting_payment` and "Awaiting confirmation" otherwise, never "Confirmed". After `order.paymentDueAt` an unpaid booking is cancelled or handed to the merchant to review (then `awaiting_approval`); after `order.approvalDueAt` an unapproved booking is cancelled. If it's cancelled or the merchant declines, the appointment becomes `canceled` with `cancelReason` `unpaid`, `not_approved`, `declined` or `order_cancelled`. The order then has `cancelledAt` and an order `cancelReason` of `unpaid`, `not_approved`, `declined`, `external` or `customer`. > - `auth` and `customer`: only when the request is signed in as the order's customer, or when this checkout created a new customer. Store the `auth` tokens (`{ accessToken, refreshToken }`) to sign the customer in automatically so they can see their booking. When the email belonged to an existing customer and the request wasn't signed in, both are missing: the booking is in that customer's account, and they see it after signing in with a login code. Always treat `auth` as optional. > - After a successful submit, the cart is `converted`. Discard the stored cart id. > > Checkout conflicts come back as **409** with a `code`: > - `CART_EXPIRED`: a held time is gone. `start` and `submit` first revive an expired cart (re-hold every slot that is still free), so this only means a slot was taken. Start a new cart and let the customer pick again. > - `CART_ALREADY_CHECKED_OUT` (`start`): the cart is already an order; the body has its `orderId`. Show that order instead. > - `CHECKOUT_IN_PROGRESS`: another `start` or `submit` of the same cart (double click, second tab) is still running. Keep the cart, say the booking is being processed, and retry `submit` in a moment. It returns the order once placed. > > `submit` answers **402** `PAYMENT_NOT_AUTHORIZED` (with `paymentStatus`, e.g. `requires_payment_method` or `requires_action`) when the card payment isn't authorised: declined, 3-D Secure not completed, or cancelled. No order is placed and the cart is unchanged. Show the card error and let the customer retry the payment, then `submit` again. > > ## Customer accounts > > Storefront reads and bookings work anonymously. Account features (my appointments, reschedule, cancel, profile, consent) need the customer's access token, sent as `Authorization: Bearer `. > > ### Sign in options > - **Passwordless (recommended)**: > 1. `POST /storefront/auth/request-login-code` with `{ "email" }` → 204, and the customer receives a 6-digit code. > 2. `POST /storefront/auth/verify-login-code` with `{ "email", "code" }` → `{ accessToken, refreshToken }`. > - **Password**: `POST /storefront/auth/sign-up` with `{ email, password (min 8), firstName?, lastName? }` → 204 (a verification email is sent). Then `POST /storefront/auth/sign-in` with `{ email, password }` → tokens. > - **Magic links** from Opencals emails: the link carries a `token`. Call `GET /storefront/auth/resolve-link?token=…` → `{ purpose, redirectPath, accessToken?, refreshToken?, requiresAction?, metadata? }`. Store the tokens if present, then route to `redirectPath`. > - **Password reset**: `request-password-reset` with `{ email }`, then `reset-password` with `{ token, newPassword }`. > - **Email verification**: `verify-email` with `{ token }` → tokens. `request-email-verification` with `{ email }` resends it. > > ### Tokens > - The access token is short-lived. When a call returns 401, call `GET /storefront/auth/refresh` with `Authorization: Bearer `, store the new pair, and retry once. If refresh also fails, sign the customer out. > - Store tokens for the session and forward the access token to the server function that calls Opencals. Never log tokens. > > ### Self-service > - `GET /storefront/self-service/profile` → `{ id, email, firstName, lastName, phone, isEmailVerified, isPasswordSet, language, … }`. Use `id` as the `customerId` for `{ "kind": "existing" }` at checkout. Display only name, email and phone. > - `PUT /storefront/self-service/profile` with `{ firstName?, lastName?, phone? }`. > - `PUT /storefront/self-service/password` with `{ currentPassword?, newPassword }`. `currentPassword` is required only if `isPasswordSet`. > - `GET /storefront/self-service/marketing-consent` → `{ emailState, smsState, whatsappState }`, each `not_subscribed` | `subscribed` | `unsubscribed`. It can be `null` if never set. > - `PUT /storefront/self-service/marketing-consent` with `{ email?, sms?, whatsapp? }` (booleans). Only show channels whose opt-in setting is `checkout_and_account`. > > ### My appointments and orders > - `GET /storefront/appointments?status=scheduled&orderBy=from&order=ASC&take=20` is the customer's own appointments. `status` values: `pending`, `scheduled`, `completed`, `canceled`. Other filters: `date` (`YYYY-MM-DD`), `products`, `staffMembers`, `locations` (arrays). > - `GET /storefront/appointments/{appointmentId}` returns the detail, including product (with the reschedule/cancel rules), staff, location and guests. > - `GET /storefront/orders?take=20` and `GET /storefront/orders/{orderId}` return orders. `GET /storefront/orders/{orderId}/invoices` returns receipts/invoices. > - `GET /storefront/appointments/preferences/booking-history` returns the customer's usual choices, for a "book again" shortcut. > > ## Reschedule and cancel > > Show these actions only when the product allows them (`allowCustomerReschedule` / `allowCustomerCancel`) **and** the appointment starts more than `rescheduleGap` / `cancelGap` seconds from now. Otherwise disable the button and explain the notice period. > > ### Reschedule > 1. Fetch availability **excluding the appointment being moved**, so its current slot doesn't show as busy: > ``` > GET /storefront/products/{productId}/current-availabilities?date=2026-10-15&timezone=Europe/London&excludeAppointmentId={appointmentId}&staffMemberId=…&locationId=… > ``` > 2. Move it: > ``` > PUT /storefront/appointments/{appointmentId}/reschedule > { "slot": { "productId": "…", "fromDate": "2026-10-15", "fromTime": "10:00:00", "toDate": "2026-10-15", "toTime": "10:45:00", "staffMemberId": "…", "locationId": "…" }, "notifyCustomer": true } > ``` > `address` is optional (for delivery locations only). The response is the updated appointment. > > ### Cancel > ``` > PUT /storefront/appointments/{appointmentId}/cancel > { "notifyCustomer": true } > ``` > The API applies refund and cancellation policy. Never calculate refunds in the app. Ask the customer to confirm before cancelling. > > ## Attendees and guests > > - **Attendees** is how many people take up capacity: `numberOfAttendees` on create. For group products (`maxAttendees > 1`), show "X spots left" from the slot (`maxAttendees - attendees`) and cap the input at that number. > - **Guests** are named people (by email) who get copies of the appointment emails. They don't use up capacity. Add them at creation (`guests: [{ email }]`) or later with `POST /storefront/appointments/{id}/guests` and body `{ "email": "…", "notify": true }`. Remove one with `DELETE /storefront/appointments/{id}/guests/{guestId}?notify=true`. Only offer guests when `allowGuests` is true, and respect `maxGuests`. > > ## Custom duration (variable-length bookings) > > When a product has `allowCustomDuration: true`, the customer books a whole multiple of the base `duration`, up to `maxDuration` (-1 = unlimited). Example: base 1800 s (30 min) at £15, `maxDuration` 5400, so the options are 30/60/90 min for £15/£30/£45. > > 1. Offer the lengths `duration × n` for n = 1, 2, 3 … while the total is ≤ `maxDuration`. > 2. Fetch slots for the chosen length: `…/current-availabilities?date=…&timezone=…&duration=5400`. Each returned slot already spans the full length. > 3. Book that slot as-is. The API prices it (`ceil(booked / base) × price`). Never send a price. > > If `fixedTimes` is true (with `fixedStartTime` and `fixedEndTime`, e.g. check-in 15:00 and check-out 11:00), the product is booked check-in to check-out: the slot must start at `fixedStartTime` on the first day and end at `fixedEndTime` on the last day, in the product's schedule timezone (the store timezone if the product has no schedule). The server enforces this on `POST /storefront/appointments` and on customer reschedules, and returns `400` ("This product must be booked from HH:MM to HH:MM …") for any other times. Merchant bookings from the dashboard are exempt. Such a stay isn't a whole multiple of the base duration (3 nights from 15:00 to 11:00 is 68 hours), and it's priced by rounding up, so N nights cost N × `price`. To build the date picker, read `…/current-availability-ranges` (or `getCurrentAvailabilitiesMerged`) without `duration`, check that check-in → check-out fits inside one range, then send the slot built from the product's fixed times. > > Don't model "60 min" and "90 min" as separate products for the same physical resource. They wouldn't block each other and the resource could be double-booked. > > ## Errors > > Error responses are JSON: > > ```json > { "message": "Invalid input. Please check your form fields.", "statusCode": 400, > "errors": [{ "property": "email", "messages": ["Email must be an email"] }] } > ``` > > - `errors[]` appears on validation failures. Map `property` to the form field and show `messages`. > - Always show the real `message` and keep the status. Never replace it with a generic "Something went wrong". > > | Status / symptom | Likely cause | Fix | > |---|---|---| > | 404 `Cannot GET /storefront/...` | `X-Api-Version` header missing | The connector sends it. Check the connector's auth config | > | 401 `X-Api-Key header is required` / `Invalid or inactive API key` | Key missing, wrong or revoked | Reconnect with a valid storefront key (`sfk_…` or a private `spk_…`) | > | 401 `Origin not allowed for this API key` | Key has an allowed-origins list; server calls send no Origin | Use a key with no allowed-origins restriction for the connector | > | 401 `This API key can't be used here` | An admin key (`sk_`) was sent to the storefront API | Use a storefront key (`sfk_` or `spk_`) | > | 401 on account endpoints | Missing or expired customer token | Refresh, then sign in again | > | 400 on save-customer/start/submit | Missing `kind` on `customer`, or a required field | Add `kind`; show `errors[]` | > | 400 with a discount `code` | Promo code rejected | Show the mapped message | > | 4xx on create/reschedule | Slot taken, outside the window, over capacity, or inside the notice gap | Re-fetch availability; explain | > | 409 `CART_EXPIRED` / `CART_ALREADY_CHECKED_OUT` / `CHECKOUT_IN_PROGRESS` at checkout | Slot taken after expiry / cart already an order / checkout already running | New cart / show `orderId` / wait and retry `submit` | > | 402 `PAYMENT_NOT_AUTHORIZED` on submit | Card declined or 3-D Secure not completed | Keep the cart, retry the payment, `submit` again | > | Cart calls act on a new/empty cart | `X-Cart-Id` not forwarded | Forward the stored id on every cart/checkout call | > | Slots at the wrong hour | UTC shown as local | Convert for display only; send `timezone` | > | Customer can't pick their own current slot when rescheduling | `excludeAppointmentId` not sent | Add it | > | 429 | Rate limit | Back off and retry (below) | > > ## Notes > > - **Rate limits** apply per API key plus client IP: 50 requests/second, 300 per 10 seconds and 1,200 per minute. Sign-up, sign-in and email endpoints also have per-email limits (for example 3 login-code emails per address per 10 minutes). Through the connector, all visitors share the gateway's IP, so treat the per-IP limits as **app-wide** limits: > - Cache the catalogue (products, collections, locations, staff, public settings) for a few minutes server-side instead of fetching on every page view. > - Use `current-availability-ranges` for the calendar, then `current-availabilities` only for the chosen day. Cache results by product + date + duration for ~30–60 s. > - Don't poll. Don't prefetch availability for every product on the home page. > - On 429, retry with exponential backoff and jitter (500 ms, 1 s, 2 s, 4 s, each plus up to 30%, max 4 attempts). The `Retry-After` header isn't reliable, so don't depend on it. > - **Versioning** uses the `X-Api-Version` header (the connector sends `1`). Paths don't carry a version. > - **Dates**: `YYYY-MM-DD` dates and `HH:MM:SS` times in UTC for slots; ISO 8601 UTC for timestamps. > - **Languages**: question endpoints take a language code (`en`, `de`, `fr`, `es`, `pt_br`, …). Use the site's language, falling back to `en`. > - **What the API doesn't do**: there's no merchant/admin access, no creating services or staff, and no editing prices. That's all done by the merchant in the Opencals dashboard (app.opencals.com). If a service is missing or has no slots, it's a dashboard configuration issue, not a code issue. > - **Don't store or display** internal fields you don't need (`storeId`, `externalId`, `scheduleId`). Show customers only names, images, descriptions, prices, durations and times. > - Human-readable docs: https://opencals.com/docs > ```` **File 2**. Name: `Opencals booking site playbook`. Description: `How to build a booking website on Opencals: choosing the booking flow for the business type, pages and components, slot picker, checkout and payment UX, design and launch checklist.` > [accordion] Content: Opencals booking site playbook (\~14k chars) > > ```markdown lovable-booking-site-playbook.md theme={"theme":{"light":"github-light","dark":"github-dark-default"}} > # Opencals booking site playbook > > How to build a production booking website (or add booking to an existing app) on the Opencals connector. The booking engine lives in Opencals. This app is the customer-facing frontend: catalogue, slot picker, cart, checkout, confirmation and a customer account area. For exact endpoints, bodies and response fields, use the **"Opencals Storefront API"** knowledge file. This file covers what to build and in what order. > > ## Ground rules > > - **Never hard-code services, prices, durations, staff, locations or opening hours.** They come from the API and are managed by the merchant in the Opencals dashboard (app.opencals.com). Copy about the business (hero text, about, FAQs, contact) can live in the app. > - **Never build availability, pricing, discount or tax logic.** Render what the API returns. The cart's totals are the truth. > - **All API calls go through the Opencals connector from server-side code.** The browser talks to your own server functions, never to Opencals directly. Build one thin server function per operation (e.g. `get-services`, `get-slots`, `book-slot`, `checkout-start`), forward the `X-Cart-Id` and customer `Authorization` headers the browser sends, and return the API's status and body unchanged. > - **Times are UTC in the API.** Display them in the store timezone (from public settings), and send back exactly what you received. > - **Show real errors.** Surface the API's `message` and field `errors[]`. Never collapse them into "Something went wrong". > - **Watch the rate limit.** It's app-wide (about 120 requests/minute across all visitors). Cache catalogue data, use availability ranges for calendars, and never prefetch slots for every service. > > ## Step 1: understand the business, then choose the booking shape > > Ask, or infer from the brief: > > 1. **What is being booked?** > - *People's time* (stylist, therapist, clinician, coach, tutor). Staff-based booking: customers pick a service, optionally a person, then a time. > - *Things* (courts, rooms, studios, lanes, bays, equipment). Resource booking: each unit is its own bookable product, often shown as a grid. > - *Both* (a padel club with court rentals and coached sessions). Show both paths. > 2. **One-to-one or group?** Groups (classes, workshops) have `maxAttendees > 1`. Show "X spots left" and a party-size picker. > 3. **Fixed or variable length?** If `allowCustomDuration` is set, show a length picker (30/60/90 min) before the time. > 4. **Where?** Several locations mean a location picker first. Online locations show a meeting link after booking. `delivery` locations (a mobile service) need the customer's address at checkout. > 5. **Extras?** Add-ons (products' `addOns`) can be picked after the time is chosen. > > Match the page flow to the booking shape first, and the visual style second. Restyling is cheap; changing the flow isn't. > > | Business | Recommended flow | > |---|---| > | Salon, barber, spa | Services list → service → (staff: "Anyone" or a person) → date → time → extras → checkout | > | Clinic, therapist | Department/collection → service → practitioner → date → time → intake questions → checkout. Keep the tone calm and clinical | > | Fitness classes, workshops | Timetable by day (group products) → class → party size → checkout | > | Courts, rooms, studios | Sport/room type toggle → date → units × time grid → length → checkout | > | Coaches, tutors | Coach profiles → service → date → time → checkout | > > ## Step 2: pages and components > > Build these. They cover most booking sites. > > 1. **Home**: hero, a short intro, featured services (from the API; the first 3–6 active products or one collection), location/contact block, and a clear "Book now" call to action. > 2. **Services** (`/services`): the catalogue from `GET /storefront/products?status=active`, grouped by `GET /storefront/product-collections?isVisible=true` when collections exist. The card shows image, title, duration (formatted from seconds), and price, as "from £X" when variants differ. Products with several `variants` show the variants as options. > 3. **Booking page** (`/book/:slug`): product detail by slug, then the flow for its shape (below). > 4. **Cart / checkout** (`/checkout`): summary, promo code, customer form, questions, payment. > 5. **Confirmation** (`/booking/confirmed`): order number (`order.name`), date/time in local time, location or online link, "Add to calendar", and a link to the account area. > 6. **Account** (`/account`): sign in (6-digit email code), upcoming and past appointments, appointment detail with reschedule/cancel, profile, marketing preferences. > 7. **Staff / team** (optional): from `GET /storefront/staff-members`. Show first name, last name and image only. > 8. **Locations** (optional, multi-location): from `GET /storefront/locations`. > > Reusable components: service card, variant selector, staff selector (with "Anyone available"), date picker (days enabled from availability ranges), time-slot grid (grouped into morning/afternoon/evening), party-size stepper, add-on selector, cart summary with countdown, checkout form driven by settings, payment step, appointment card. > > ## Step 3: the booking flow in detail > > ### Staff-based (salon, clinic, coaching) > 1. Load the product by slug. If `variants.length > 1`, the customer picks a variant first. Every later call uses the **variant `id`**. > 2. If the product has several `locations`, pick a location (or skip if there's one). > 3. Staff: offer "Anyone available" plus the variant's `staffMembers`. > 4. Date picker: call `current-availability-ranges` once for the variant (plus `locationId`/`staffMemberId` when chosen, and `timezone`) and enable only the days covered by a range. Open on the first available day (`nearest-availability`). > 5. Time slots: `current-availabilities?date=…&timezone=…` for the chosen day. Display `fromTime` converted to local time. For "Anyone", a slot is bookable if `staffMemberIds` isn't empty. Don't send `staffMemberId` in the booking unless the customer picked someone. > 6. On slot click: create the cart if needed, then `POST /storefront/appointments` with the slot, `cartId`, `numberOfAttendees` and any add-ons. Then go to checkout. > 7. If booking fails with a 4xx, the slot was probably just taken. Refresh the slots, show "That time was just booked, please choose another", and keep the selections. > > ### Group classes > - The slot list doubles as a timetable. Show `maxAttendees - attendees` spots left, grey out full slots, and cap the party size at the remaining spots. Send `numberOfAttendees`. > - Optional guests: if `allowGuests`, let the customer add friends' emails (up to `maxGuests`). Guests get copies of the emails and don't use up spots. > > ### Resource grid (courts, rooms) > - Rows are units: the variants of the "Court" product, or the products in a collection. Columns are times on the selected date at the base duration. > - Fetch `current-availabilities` per unit for the chosen date (cache each result; retry on 429 with backoff). A cell is free if that unit has a slot starting at that time. > - On cell click: if the product allows custom duration, show the lengths (base × n up to `maxDuration`). Re-query that unit with `duration=` to confirm the block fits, then book the returned slot. > - Each court is one product. Never model the 60-min and 90-min options as separate products; they wouldn't block each other. > > ### Variable length > Show the length picker before the date/time. Pass `duration` (seconds) to both availability calls, and show the price for each length as `ceil(length / base) × price`, clearly marked as an estimate. The cart total is authoritative. > > ## Step 4: cart and checkout > > - Persist `cart.id` in `localStorage`. Send it as `X-Cart-Id` to your server functions, which forward it. > - Summary: each item's service, staff, local date/time, add-ons, and the line `discountedTotal`; then `subtotal`, discounts (`appliedDiscounts`), `totalTax` and `total`, formatted in `paymentCurrencyCode`. > - **Countdown**: "Your time is held for 9:32". Compute it from `expiresAt`, recompute on tab focus, call `/cart/extend` while the customer is typing, and on expiry start a new cart and send them back to pick a time. > - **Promo code**: a small "Have a code?" field. Show the mapped error message on failure. Show "Code SUMMER10 applied −£5" on success, with a remove button. > - **Customer form** from `checkoutSettings`: email and last name are always required; first name if `customerFirstNameRequired`; phone, company, VAT and billing address according to their `hidden` / `optional` / `required` values. Marketing checkboxes appear only for channels not set to `dont_show`, and are unticked by default. Show a delivery address only when a cart item is at a `delivery` location. > - A signed-in customer gets the form pre-filled from the profile and sent as `{ "kind": "existing", "customerId" }`. A guest sends `{ "kind": "new", … }`. **`kind` is always required.** > - **Questions**: fetch the cart's checkout questions. If there are any, show them as a step, and send each answer with its question text. > - **Payment**: list the providers from `/payment/providers`. Start checkout with the chosen one and branch on the returned `provider`: > - `stripe`: Stripe Payment Element in the page using the returned `publishableKey`, `stripeAccountId` and `clientSecret`; confirm, then submit with the PaymentIntent id. Install `@stripe/stripe-js` and `@stripe/react-stripe-js`. **No Stripe secret or Stripe connector is needed**, because payments go to the merchant's Stripe account connected in Opencals. > - `cash` / `bank_transfer` / `stripe_invoice`: "Pay at the venue", "Pay by bank transfer" or "Pay by invoice" copy, then submit immediately. After submit, show `paymentInstructions` if present (a "Pay invoice" button for `hostedInvoiceUrl`, the bank details, and the due date `dueAt`). > - `no_payment_required`: the button reads "Confirm booking", then submit immediately. > - Submit with `appointmentsSettings: { markAsScheduled: true }` (older field; the store decides when the booking is confirmed). Appointments that come back `pending` are awaiting confirmation: show "Awaiting payment" when `pendingReason` is `awaiting_payment`, otherwise "Awaiting confirmation". On success, clear the cart id, store `auth` tokens if returned (this signs the customer in), and go to the confirmation page. > > ## Step 5: customer account > > - Sign in with a 6-digit email code (`request-login-code` → `verify-login-code`) as the main path. Password sign-in is optional. Handle magic links at a `/link/:token` route with `resolve-link`, then redirect to `redirectPath`. > - Keep tokens for the session, and send the access token to your server functions, which forward it as `Authorization: Bearer …`. On 401, refresh once, then sign out. > - **Appointments**: two tabs, Upcoming (`status=scheduled`, `orderBy=from`, `order=ASC`) and Past (`completed`, `canceled`). Each card shows service, staff, local date/time, location, and status badge. > - **Appointment detail**: reschedule and cancel buttons only if the product allows them and the start is more than `rescheduleGap` / `cancelGap` away; otherwise explain the notice period. Rescheduling reuses the slot picker with `excludeAppointmentId`. Cancelling asks for confirmation first. > - **Profile**: first name, last name, phone. **Preferences**: marketing channels with `checkout_and_account`. **Receipts**: from order invoices. > > ## Step 6: design > > - Take the look from the brief or inspiration: colour palette, typography, photography style, density. Put colours and fonts in theme tokens (CSS variables / Tailwind theme) so they're easy to change. > - Match the tone to the business: warm and editorial for salons, dark and bold for barbers, calm and trustworthy for clinics, energetic and technical for sports venues. > - The slot picker is the core of the product. Give it large tap targets, a clear selected state, a disabled state for full or past slots, a sticky "Continue" on mobile, and local-time labels with the timezone shown when the visitor's timezone differs from the store's. > - Use skeleton loaders for the catalogue and slots. Show a friendly empty state ("No times left on this day — next available: Thu 16 Oct"). > - Format prices with `Intl.NumberFormat` in the store currency and durations from seconds ("1 h 30 min"). Use the store's 12H/24H `timeFormat`. > - Build mobile first. Most bookings happen on phones. > - Accessibility: slot buttons with `aria-pressed`, labelled form fields, visible focus, and error messages tied to their fields. > - White-label: the site can carry only the merchant's brand. There's no need to show Opencals branding. > > ## Step 7: before calling it done > > Walk through this with the connected store: > > - [ ] Services load from the API; nothing is hard-coded. > - [ ] Days without availability are disabled; slots show in local time. > - [ ] A test booking completes end to end (use a Stripe test-mode store, or cash / no-payment). > - [ ] Refreshing the checkout page keeps the cart; letting it expire recovers cleanly. > - [ ] An invalid promo code shows a clear message; a valid one changes the total. > - [ ] Required checkout fields follow the store's settings. > - [ ] Sign in with the email code works; the new booking shows under Upcoming. > - [ ] Reschedule (including keeping the same day) and cancel work, and are hidden inside the notice window. > - [ ] Errors from the API are shown to the user, not swallowed. > - [ ] No page makes more than a handful of API calls on load; catalogue data is cached. > > ## Troubleshooting > > - **A service is missing or has no times**: the product is inactive, has no schedule/availability, isn't offered at the chosen location, or is outside the advance-booking window. The merchant fixes this in the Opencals dashboard; it isn't a code bug. > - **Everything returns 404 `Cannot GET`**: the connector isn't sending `X-Api-Version: 1`. Fix the connector configuration. > - **401 "Origin not allowed"**: the API key has an allowed-origins list. Use a storefront key without origin restrictions for the connector. > - **Checkout 400**: usually a missing `kind` on `customer`, or a field the store requires. Show `errors[]`. > - **Bursts of 429**: too many parallel availability calls. Cache, use ranges, and back off. > ``` Raw files: [opencals-storefront-api.md](https://opencals.com/ai/opencals-storefront-api.md) · [lovable-booking-site-playbook.md](https://opencals.com/ai/lovable-booking-site-playbook.md). Then click **Create**. **5. Connect and describe the business** Open the connector, **Add connection**, enter your `sfk_…` key and `1`, choose who can use it, and link it to a project. Then prompt with the business, not the booking system: ```text theme={"theme":{"light":"github-light","dark":"github-dark-default"}} Build a booking website for Fade & Co, a three-chair barbershop in Manchester. Use the Opencals connector for services, prices, barbers and availability. Customers pick a service, then a barber or "anyone", then a time. Dark and bold: black, off-white, one brass accent. Pages: home, services, booking flow, checkout with card payment, confirmation. ``` ## How it works Lovable generates one thin server function per operation (list services, get slots, book, start checkout) that calls Opencals through the connector; the browser only talks to those functions. Card payments render Stripe's Payment Element with the `publishableKey`, `stripeAccountId` and `clientSecret` that `checkout/start` returns, so **no Stripe connector or Stripe secret** is needed in Lovable. ## Limits * **Rate limits are app-wide.** The API allows 20 req/s, 60 per 10 s and 120 per minute per key and client IP. Lovable's gateway sends all visitors from the same IP range, so one Lovable site shares \~120 requests/minute. The playbook tells Lovable to cache the catalogue and use availability ranges for calendars. * **Development stores** run Stripe in test mode. Switch the store to production to take real payments. ## Troubleshooting | Symptom | Fix | | - | - | | `404 Cannot GET /storefront/...` | The `X-Api-Version` header field is missing or the connection value isn't `1` | | `401 Origin not allowed for this API key` | Use a key with no allowed origins | | Service missing or no times | Product inactive, no schedule, or outside the booking window. Fix in the dashboard | | Bursts of `429` | Too many parallel availability calls; cache and back off | ## Related * [v0](/docs/ai-agents/v0) · [Base44](/docs/ai-agents/base44) * [Storefront API reference](/docs/api-reference/introduction) # AI Agents & App Builders Source: https://opencals.com/docs/ai-agents/overview Agent Skills that teach AI coding tools — Claude Code, Cursor, Codex, Gemini CLI — to build booking integrations on the Opencals API correctly. Install once and let your agent scaffold, wire, and debug. Most Opencals integrations are now written inside an AI coding agent. **Agent Skills** give that agent ground-truth knowledge of the Opencals API and SDK — the real method names, argument shapes, and flows — so it builds working code instead of guessing. Skills follow the open [Agent Skills](https://code.claude.com/docs/en/skills) standard (a folder with a `SKILL.md`), supported by Claude Code, Cursor, OpenAI Codex, Gemini CLI and more. They live in one public repo: **[github.com/letsopencals/skills](https://github.com/letsopencals/skills)**. ## The two skills > [card] opencals-storefront-api > > Ground truth for any code that talks to the Opencals API / SDK — availability, > carts, appointments, checkout, discounts, customer accounts, guests & > attendees, custom durations, reschedule/cancel, rate limits. > [Details →](/docs/ai-agents/storefront-api-skill) > [card] opencals-build-booking-site > > Build a whole booking website — pick an official template, scaffold, wire it > up, rebrand, deploy. Uses the API skill for exact call shapes. > [Details →](/docs/ai-agents/build-booking-site-skill) ## The primary journey **1. Describe your business** Hand your agent a business idea and some inspiration — screenshots, a competitor site, a brand feel. **2. The agent builds it** `opencals-build-booking-site` picks the closest template and scaffolds it; `opencals-storefront-api` supplies the exact API calls to wire availability, booking and checkout. **3. Rebrand & deploy** The agent restyles to your inspiration and deploys to Vercel. You add your Opencals API key. Bookings, checkout and payments work out of the box. ## Install > [tab] Claude Code > > ``` > /plugin marketplace add letsopencals/skills > /plugin install opencals@opencals > ``` > > Both skills load automatically and trigger on relevant requests. > [tab] Cursor / Codex / Gemini > > Agent Skills are portable — a folder with a `SKILL.md`. Clone the repo and > copy the skill folders into your tool's skills directory: > > ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} > git clone https://github.com/letsopencals/skills opencals-skills > # copy opencals-storefront-api/ and opencals-build-booking-site/ > # into your agent's skills folder > ``` > > > [!NOTE] > > > > The exact skills directory differs per tool — check your tool's current Agent Skills / rules docs for where skill folders go. > [tab] Any agent (manual) > > Clone the repo and point your agent at the relevant `SKILL.md`: > > > Follow the skill in `opencals-storefront-api/SKILL.md` when writing Opencals > > API code, and `opencals-build-booking-site/SKILL.md` to scaffold a site. > [tab] v0 / Lovable / Base44 > > Each AI app builder has its own setup, with every field ready to copy: > > * **[Lovable](/docs/ai-agents/lovable)**: a custom connector with two knowledge files. > * **[v0](/docs/ai-agents/v0)**: attach these skills from skills.sh (`letsopencals/skills`). > * **[Base44](/docs/ai-agents/base44)**: one backend function, an app secret and two workspace skills. > > For other builders (Bolt, Replit), paste the > [API reference](https://opencals.com/ai/opencals-storefront-api.md) and > [booking-site playbook](https://opencals.com/ai/lovable-booking-site-playbook.md) > into the project instructions. ## Docs MCP server The Opencals developer docs are also an MCP server, so an agent can look things up while it codes instead of relying on what it remembers: ``` https://opencals.com/docs/mcp ``` It speaks streamable HTTP, needs no API key, and exposes two read-only tools: | Tool | What it does | | - | - | | `search_opencals_developer_docs` | Searches every docs page and returns matching passages with links | | `query_docs_filesystem_opencals_developer_docs` | Reads full pages and the OpenAPI spec with shell-style commands (`cat`, `head`, `grep`) | > [tab] Claude Code > > ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} > claude mcp add --transport http opencals-docs https://opencals.com/docs/mcp > ``` > > Add `--scope project` to share it with your team through `.mcp.json`. > [tab] Cursor > > Add this to `.cursor/mcp.json` in your project, or to `~/.cursor/mcp.json` > for every project: > > ```json theme={"theme":{"light":"github-light","dark":"github-dark-default"}} > { > "mcpServers": { > "opencals-docs": { > "url": "https://opencals.com/docs/mcp" > } > } > } > ``` > [tab] Other clients > > Any MCP client that supports remote (streamable HTTP) servers can connect to > `https://opencals.com/docs/mcp`. Check your client's MCP docs for where the > URL goes. > [!NOTE] > > The MCP server searches documentation only. It can't read or change store > data or bookings; your code does that through the > [Storefront API](/docs/api-reference/introduction) with an API key. Skills and the MCP server work well together: the skills tell the agent how to build, and the MCP server lets it check a detail it isn't sure of. ## AI app builders > [card] [Lovable](/docs/ai-agents/lovable) > > Custom connector + knowledge files > [card] [v0](/docs/ai-agents/v0) > > Opencals skills from skills.sh > [card] [Base44](/docs/ai-agents/base44) > > Backend function + workspace skills ## For AI agents reading this The full documentation is available as machine-readable Markdown: > [card] [llms.txt](https://opencals.com/docs/llms.txt) > > Structured index of every docs page. > [card] [llms-full.txt](https://opencals.com/docs/llms-full.txt) > > The complete docs in one file for maximum context. The [API reference](/docs/api-reference/introduction) is generated from the OpenAPI spec — download it via the **Download spec** action, or fetch [openapi.json](/docs/api-reference/openapi.json) directly. # opencals-storefront-api skill Source: https://opencals.com/docs/ai-agents/storefront-api-skill The ground-truth Agent Skill for building on the Opencals API and @opencals/storefront-sdk — availability, carts, appointments, checkout, discounts, customer accounts, guests, custom durations, reschedule/cancel and rate limits. The ground-truth reference skill. Install it whenever an agent writes, reviews or debugs code against the Opencals API / `@opencals/storefront-sdk`. It carries the real method names, argument shapes and enums copied from the generated SDK — so the agent stops inventing APIs. **Repo:** [github.com/letsopencals/skills](https://github.com/letsopencals/skills) · **Install:** [see the overview](/docs/ai-agents/overview#install) ## What it covers A `SKILL.md` router plus focused reference files, loaded on demand: | Reference | Covers | | - | - | | `setup.md` | `setupOpencals`, service classes, `X-Api-Version`, `OpencalsApiError`, the `throwOnError` gotcha | | `availability.md` | `getCurrentAvailabilities` vs `getCurrentAvailabilitiesMerged`, the `duration` param, `excludeAppointmentId`, slot shape, grid fan-out | | `custom-duration.md` | `allowCustomDuration` / `maxDuration`, the quantity = duration-units pricing rule | | `guests-attendees.md` | `numberOfAttendees`, `attendees` / `maxAttendees`, `addGuest` / `removeGuest` | | `cart-lifecycle.md` | create/get, `X-Cart-Id`, `expiresAt`, `extendExpiration`, expiry countdown | | `checkout.md` | `saveCustomer` timing, billing vs delivery address, marketing consent, checkout questions, payment | | `auth-self-service.md` | password + passwordless + OAuth login, sessions, `SelfService` (profile, consent) | | `reschedule-cancel.md` | `reschedule` / `cancel`, `rescheduleGap` / `cancelGap`, excluding the moved appointment | | `discounts.md` | automatic vs code vs balance credit (`valueType: 'time'`), error codes | | `rate-limiting.md` | 429 handling, exponential-backoff retry pattern, allowed origins, per-key throttling | | `debugging.md` | reading `OpencalsApiError`, the top recurring mistakes and how to spot them | ## When it triggers Requests like "show available slots", "book an appointment", "apply a discount code", "let customers reschedule", "add a guest", "collect a billing address", "why am I getting a 429", "custom booking length", "customer login". ## Related * [Build a booking page](/docs/guides/build-a-booking-page) — the same flow, walked through * [Storefront SDK](/docs/guides/storefront-sdk) — SDK setup and reference * [opencals-build-booking-site skill](/docs/ai-agents/build-booking-site-skill) — scaffold a whole site # v0 Source: https://opencals.com/docs/ai-agents/v0 Attach the Opencals agent skills in v0 from skills.sh, add OPENCALS_API_KEY, and v0 builds a Next.js booking site on the Opencals SDK with live availability and Stripe checkout. v0 supports [Agent Skills](/docs/ai-agents/overview), so it uses the same two Opencals skills as Claude Code and Cursor. It generates a standard Next.js app on `@opencals/storefront-sdk`, which you can keep developing anywhere. **1. Create a storefront key** In the Opencals dashboard open **Settings → API Keys** and create a key (`sfk_…`). Leave allowed origins empty: the SDK runs in server code, which sends no `Origin` header. **2. Attach the skills** In the v0 prompt bar open the skills menu (type `/` in the composer) and add the Opencals skills from skills.sh: ```text theme={"theme":{"light":"github-light","dark":"github-dark-default"}} letsopencals/skills ``` Attach both **opencals-build-booking-site** and **opencals-storefront-api**, and save them to your personal or team scope. **3. Add the environment variable** v0 asks for missing environment variables above the composer, or add them to the project yourself: | Variable | Value | | - | - | | `OPENCALS_API_KEY` | Your `sfk_…` key (required) | | `OPENCALS_API_URL` | `https://api.opencals.com` (optional, default) | | `AUTH_SECRET` | Random string, only if the site adds customer sign-in | **4. Describe the business** ```text theme={"theme":{"light":"github-light","dark":"github-dark-default"}} Build a booking website for Ridge Padel, a six-court padel club in Valencia. Use the Opencals skills. Players pick a date and see every court against time in one grid, then choose 60 or 90 minutes. Coached group sessions are bookable separately, with spots left shown. Dark, sporty, one electric-lime accent. Pages: home, book a court, coaching, checkout, confirmation. ``` ## Other tools, same skills ```bash skills CLI theme={"theme":{"light":"github-light","dark":"github-dark-default"}} npx skills add letsopencals/skills ``` ```text Claude Code theme={"theme":{"light":"github-light","dark":"github-dark-default"}} /plugin marketplace add letsopencals/skills /plugin install opencals@opencals ``` ## Check before publishing * Slot times from the API are **UTC**. If the picker shows raw UTC, tell v0: "slot times are UTC, show them in the store's timezone". * Book end to end with Stripe's test card `4242 4242 4242 4242` and confirm the booking appears in the dashboard. * Publish to Vercel, then switch the store to production to take real payments. ## Related * [opencals-build-booking-site skill](/docs/ai-agents/build-booking-site-skill) · [opencals-storefront-api skill](/docs/ai-agents/storefront-api-skill) * [Lovable](/docs/ai-agents/lovable) · [Base44](/docs/ai-agents/base44) # Get an add-on by ID Source: https://opencals.com/docs/api-reference/add-ons/get-an-add-on-by-id /api-reference/openapi.json get /storefront/add-ons/{addOnId} # Get an add-on by slug Source: https://opencals.com/docs/api-reference/add-ons/get-an-add-on-by-slug /api-reference/openapi.json get /storefront/add-ons/slug/{slug} # List add-ons for the current store Source: https://opencals.com/docs/api-reference/add-ons/list-add-ons-for-the-current-store /api-reference/openapi.json get /storefront/add-ons # Add a guest to an appointment Source: https://opencals.com/docs/api-reference/appointments/add-a-guest-to-an-appointment /api-reference/openapi.json post /storefront/appointments/{appointmentId}/guests Adds a guest (by email) to an appointment. Guests are copied on appointment notifications. # Cancel appointment Source: https://opencals.com/docs/api-reference/appointments/cancel-appointment /api-reference/openapi.json put /storefront/appointments/{appointmentId}/cancel Cancels an existing appointment. Subject to cancel_gap restrictions defined in the service configuration. # Create appointment Source: https://opencals.com/docs/api-reference/appointments/create-appointment /api-reference/openapi.json post /storefront/appointments Creates a new appointment for a customer. Authentication is optional. When signed in as a customer, the appointment is always booked for that customer and any `customer` in the body is ignored. Anonymous callers pass the customer by email (a brand-new customer is created and returned). If the email or `externalId` matches an existing customer, the appointment is attached to that customer, but their profile is not changed and `customer`/`customerId` are omitted (null) from the response. A `customerId` is only accepted from an anonymous caller when it is the customer this `cartId` created or is already bound to; otherwise the request is rejected with 400 (sign in, or send an email instead). # Get appointment by external order name Source: https://opencals.com/docs/api-reference/appointments/get-appointment-by-external-order-name /api-reference/openapi.json get /storefront/appointments/by-external-order-name/{externalOrderName} Deprecated: look the order up instead. Returns a single appointment by the name of its order on the store's platform (e.g. a Shopify order name). # Get appointment by ID Source: https://opencals.com/docs/api-reference/appointments/get-appointment-by-id /api-reference/openapi.json get /storefront/appointments/{appointmentId} Returns a single appointment by ID for the authenticated customer # Get customer booking preferences Source: https://opencals.com/docs/api-reference/appointments/get-customer-booking-preferences /api-reference/openapi.json get /storefront/appointments/preferences/booking-history Returns frequently booked services, locations, and staff members based on customer booking history. Results are cached for 24 hours to optimize performance. # List customer appointments Source: https://opencals.com/docs/api-reference/appointments/list-customer-appointments /api-reference/openapi.json get /storefront/appointments Returns all appointments for the authenticated customer with pagination # Remove a guest from an appointment Source: https://opencals.com/docs/api-reference/appointments/remove-a-guest-from-an-appointment /api-reference/openapi.json delete /storefront/appointments/{appointmentId}/guests/{guestId} Removes a guest from an appointment and (by default) notifies them of the removal. # Reschedule appointment Source: https://opencals.com/docs/api-reference/appointments/reschedule-appointment /api-reference/openapi.json put /storefront/appointments/{appointmentId}/reschedule Reschedules an existing appointment to a new time. Subject to reschedule_gap restrictions defined in the service configuration. The new time must be the same length (the same number of billed units) as the current booking, otherwise 400 is returned; the product cannot be changed. # Submit appointment feedback Source: https://opencals.com/docs/api-reference/appointments/submit-appointment-feedback /api-reference/openapi.json post /storefront/appointments/{appointmentId}/feedback Allows customers to submit feedback for a completed appointment # Customer OAuth sign in Source: https://opencals.com/docs/api-reference/auth/customer-oauth-sign-in /api-reference/openapi.json post /storefront/auth/oauth Authenticate or register a storefront customer using an OAuth provider (e.g. Google) # Customer sign in with credentials Source: https://opencals.com/docs/api-reference/auth/customer-sign-in-with-credentials /api-reference/openapi.json post /storefront/auth/sign-in Authenticate a storefront customer using email and password # Refresh customer tokens Source: https://opencals.com/docs/api-reference/auth/refresh-customer-tokens /api-reference/openapi.json get /storefront/auth/refresh Exchange a valid customer refresh token for a new pair of access and refresh tokens # Register a new customer Source: https://opencals.com/docs/api-reference/auth/register-a-new-customer /api-reference/openapi.json post /storefront/auth/sign-up Create a new customer account on the storefront and send a verification email # Request a login code Source: https://opencals.com/docs/api-reference/auth/request-a-login-code /api-reference/openapi.json post /storefront/auth/request-login-code Send a 6-digit login code to the customer email for passwordless authentication # Request customer email verification Source: https://opencals.com/docs/api-reference/auth/request-customer-email-verification /api-reference/openapi.json post /storefront/auth/request-email-verification Send a verification email to the customer for account activation within the store context # Request customer password reset Source: https://opencals.com/docs/api-reference/auth/request-customer-password-reset /api-reference/openapi.json post /storefront/auth/request-password-reset Send a password reset email to the customer within the store context # Reset customer password Source: https://opencals.com/docs/api-reference/auth/reset-customer-password /api-reference/openapi.json post /storefront/auth/reset-password Reset the customer password using a valid reset token received via email # Resolve a magic link token Source: https://opencals.com/docs/api-reference/auth/resolve-a-magic-link-token /api-reference/openapi.json get /storefront/auth/resolve-link Validate a magic link token, authenticate the customer, and return redirect information # Verify a login code Source: https://opencals.com/docs/api-reference/auth/verify-a-login-code /api-reference/openapi.json post /storefront/auth/verify-login-code Verify the 6-digit login code and return auth tokens for passwordless sign-in # Verify customer email Source: https://opencals.com/docs/api-reference/auth/verify-customer-email /api-reference/openapi.json post /storefront/auth/verify-email Confirm customer email ownership using the verification token and return auth tokens # Add an add-on to a cart item Source: https://opencals.com/docs/api-reference/cart/add-an-add-on-to-a-cart-item /api-reference/openapi.json post /storefront/cart/items/{cartItemId}/add-ons # Add appointment to cart Source: https://opencals.com/docs/api-reference/cart/add-appointment-to-cart /api-reference/openapi.json post /storefront/cart/items # Apply a discount/promo code to the cart Source: https://opencals.com/docs/api-reference/cart/apply-a-discountpromo-code-to-the-cart /api-reference/openapi.json post /storefront/cart/discount-code # Create or fetch cart Source: https://opencals.com/docs/api-reference/cart/create-or-fetch-cart /api-reference/openapi.json post /storefront/cart # Extend cart expiration by 5 minutes Source: https://opencals.com/docs/api-reference/cart/extend-cart-expiration-by-5-minutes /api-reference/openapi.json post /storefront/cart/extend # Fetch cart Source: https://opencals.com/docs/api-reference/cart/fetch-cart /api-reference/openapi.json get /storefront/cart # Remove a cart add-on item Source: https://opencals.com/docs/api-reference/cart/remove-a-cart-add-on-item /api-reference/openapi.json delete /storefront/cart/add-ons/{cartAddOnItemId} # Remove cart item Source: https://opencals.com/docs/api-reference/cart/remove-cart-item /api-reference/openapi.json delete /storefront/cart/items/{itemId} # Remove the applied discount/promo code from the cart Source: https://opencals.com/docs/api-reference/cart/remove-the-applied-discountpromo-code-from-the-cart /api-reference/openapi.json delete /storefront/cart/discount-code # Update quantity of a cart add-on item Source: https://opencals.com/docs/api-reference/cart/update-quantity-of-a-cart-add-on-item /api-reference/openapi.json patch /storefront/cart/add-ons/{cartAddOnItemId} # List checkout questions translations for a product Source: https://opencals.com/docs/api-reference/checkout-questions/list-checkout-questions-translations-for-a-product /api-reference/openapi.json get /storefront/checkout-questions/{productId}/translations/{language} # Get all checkout questions for current cart Source: https://opencals.com/docs/api-reference/checkout/get-all-checkout-questions-for-current-cart /api-reference/openapi.json get /storefront/cart/checkout/questions/{language} # Save checkout question answers to appointments Source: https://opencals.com/docs/api-reference/checkout/save-checkout-question-answers-to-appointments /api-reference/openapi.json post /storefront/cart/checkout/save-answers # Save customer information to cart and appointments Source: https://opencals.com/docs/api-reference/checkout/save-customer-information-to-cart-and-appointments /api-reference/openapi.json post /storefront/cart/checkout/save-customer # Start checkout for cart (create payment, validate items) Source: https://opencals.com/docs/api-reference/checkout/start-checkout-for-cart-create-payment-validate-items /api-reference/openapi.json post /storefront/cart/checkout/start # Submit checkout (capture payment, create order, auto-authenticate customer) Source: https://opencals.com/docs/api-reference/checkout/submit-checkout-capture-payment-create-order-auto-authenticate-customer /api-reference/openapi.json post /storefront/cart/checkout/submit Creates the order. Returns `auth` tokens (and `customer`) only when the request is authenticated as the order customer, or when this checkout created a new customer. Otherwise the order is attached to the existing customer, who signs in by code to see it. # Generate a presigned S3 URL for a customer file upload Source: https://opencals.com/docs/api-reference/customer-uploads/generate-a-presigned-s3-url-for-a-customer-file-upload /api-reference/openapi.json post /storefront/uploads/presign # List feedback questions translations Source: https://opencals.com/docs/api-reference/feedback-questions/list-feedback-questions-translations /api-reference/openapi.json get /storefront/feedback-questions/{productId}/translations/{language} # Get image by ID Source: https://opencals.com/docs/api-reference/images/get-image-by-id /api-reference/openapi.json get /storefront/images/{imageId} # API Reference Source: https://opencals.com/docs/api-reference/introduction Base URL, authentication, and conventions for the Opencals Storefront API — plus an interactive playground for every endpoint. The Storefront API is a REST API for building custom booking experiences: services, real-time availability, staff members, locations, carts, checkout, payments, and customer self-service. ## Base URL ```text theme={"theme":{"light":"github-light","dark":"github-dark-default"}} https://api.opencals.com ``` All endpoint paths are prefixed with `/storefront`. Responses are JSON with camelCase property names, and all date/time values are UTC. ## Authentication Every request requires a Storefront API key in the `X-Api-Key` header: ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} curl "https://api.opencals.com/storefront/products" \ -H "X-Api-Key: sfk_your_api_key" ``` Keys are scoped to a single store: a private key (`spk_`) for server code, a public key (`sfk_`) for browser code (see [API keys](/docs/authentication#api-keys)). Create one in the dashboard under **Users → your user → API Keys**, or [contact us](https://opencals.com/contact) if you don't have an account yet and want to evaluate the API. Customer-scoped endpoints (appointments, orders, profile) additionally require a customer JWT as a Bearer token — see the [Authentication guide](/docs/authentication) for the full token flow. > [!NOTE] > > Every endpoint page in this reference includes an **interactive playground**: paste a public `sfk_` key into the authorization field, fill in the parameters, and send real requests against your store directly from the docs. The playground runs in your browser, so a private `spk_` key is rejected there. ## Conventions * **Pagination** — list endpoints accept `page` (1-indexed) and `take` (max 100) and return a `meta` object with `itemCount`, `pageCount`, `hasPreviousPage`, and `hasNextPage`. * **Carts** — cart and checkout endpoints identify the active cart with the `X-Cart-Id` header. * **Errors** — conventional HTTP status codes with a JSON body; `400` responses include a per-field `errors` array. See [error responses](/docs/authentication#error-responses). * **Rate limits** — per API key and visitor IP: 50 requests / second and 1,200 / minute for general endpoints, per-email and per-IP limits on sign-up, sign-in and email flows. See [rate limits](/docs/quickstart#rate-limits). # List invoices issued for the authenticated customer order Source: https://opencals.com/docs/api-reference/invoices/list-invoices-issued-for-the-authenticated-customer-order /api-reference/openapi.json get /storefront/orders/{orderId}/invoices # Get location by ID Source: https://opencals.com/docs/api-reference/locations/get-location-by-id /api-reference/openapi.json get /storefront/locations/{locationId} Retrieve a location by its internal ID for current store # Get location by slug Source: https://opencals.com/docs/api-reference/locations/get-location-by-slug /api-reference/openapi.json get /storefront/locations/slug/{slug} Retrieve a location by its URL-friendly slug for current store # List store locations Source: https://opencals.com/docs/api-reference/locations/list-store-locations /api-reference/openapi.json get /storefront/locations Retrieve a paginated list of locations for the current store # Get order by ID Source: https://opencals.com/docs/api-reference/orders/get-order-by-id /api-reference/openapi.json get /storefront/orders/{orderId} Returns a single order by ID for the authenticated customer # List customer orders Source: https://opencals.com/docs/api-reference/orders/list-customer-orders /api-reference/openapi.json get /storefront/orders Returns all orders for the authenticated customer with pagination # Get available payment providers for checkout Source: https://opencals.com/docs/api-reference/payment/get-available-payment-providers-for-checkout /api-reference/openapi.json get /storefront/payment/providers Returns the active, eligible payment providers configured for this store. When the cart is identified (X-Cart-Id header or cart_id cookie) the list is amount-aware: only providers that can charge the current total are returned, and when nothing is collectible (fully discounted, or below every method’s minimum) a single "no_payment_required" provider is returned. # Get public payment settings Source: https://opencals.com/docs/api-reference/payment/get-public-payment-settings /api-reference/openapi.json get /storefront/payment/settings Returns public payment configuration like currency and capture method. # Get product collection by slug Source: https://opencals.com/docs/api-reference/product-collections/get-product-collection-by-slug /api-reference/openapi.json get /storefront/product-collections/slug/{slug} Retrieve a product collection by its URL-friendly slug for the current store # List store product collections Source: https://opencals.com/docs/api-reference/product-collections/list-store-product-collections /api-reference/openapi.json get /storefront/product-collections Retrieve a paginated list of product collections for the current store # Get a product by external variant ID Source: https://opencals.com/docs/api-reference/products/get-a-product-by-external-variant-id /api-reference/openapi.json get /storefront/products/by-external-variant-id/{productExternalVariantId} Retrieve a product by its external variant ID (e.g., Shopify variant ID) for the current store # Get current availabilities for a product Source: https://opencals.com/docs/api-reference/products/get-current-availabilities-for-a-product /api-reference/openapi.json get /storefront/products/{productId}/current-availabilities Retrieve individual bookable time slots for a product on a given date. # Get merged availability ranges for a product Source: https://opencals.com/docs/api-reference/products/get-merged-availability-ranges-for-a-product /api-reference/openapi.json get /storefront/products/{productId}/current-availability-ranges Retrieve merged availability ranges (broad time windows) for a product. Useful for calendar date highlighting. # Get product by ID Source: https://opencals.com/docs/api-reference/products/get-product-by-id /api-reference/openapi.json get /storefront/products/{productId} Retrieve a product by its internal ID for the current store # Get product by slug Source: https://opencals.com/docs/api-reference/products/get-product-by-slug /api-reference/openapi.json get /storefront/products/slug/{slug} Retrieve a product by its URL-friendly slug for the current store # Get products by external ID Source: https://opencals.com/docs/api-reference/products/get-products-by-external-id /api-reference/openapi.json get /storefront/products/by-external-id/{productExternalId} Retrieve products by their external platform ID (e.g., Shopify product ID) for the current store # Get the nearest available slot for a product Source: https://opencals.com/docs/api-reference/products/get-the-nearest-available-slot-for-a-product /api-reference/openapi.json get /storefront/products/{productId}/nearest-availability Find the nearest upcoming availability slot for a product. Returns null/204 if no slot exists within the advance schedule window. # List available add-ons for a product Source: https://opencals.com/docs/api-reference/products/list-available-add-ons-for-a-product /api-reference/openapi.json get /storefront/products/{productId}/add-ons Returns active add-ons available for the given product, filtered by location and staff member assignments. # List available add-ons for a product by slug Source: https://opencals.com/docs/api-reference/products/list-available-add-ons-for-a-product-by-slug /api-reference/openapi.json get /storefront/products/slug/{slug}/add-ons Returns active add-ons available for the given product slug, filtered by location and staff member assignments. # List store products Source: https://opencals.com/docs/api-reference/products/list-store-products /api-reference/openapi.json get /storefront/products Retrieve a paginated list of active products for the current store, for the current store # Change current customer password Source: https://opencals.com/docs/api-reference/self-service/change-current-customer-password /api-reference/openapi.json put /storefront/self-service/password # Get current customer marketing consent Source: https://opencals.com/docs/api-reference/self-service/get-current-customer-marketing-consent /api-reference/openapi.json get /storefront/self-service/marketing-consent # Get current customer profile Source: https://opencals.com/docs/api-reference/self-service/get-current-customer-profile /api-reference/openapi.json get /storefront/self-service/profile # Update current customer marketing consent Source: https://opencals.com/docs/api-reference/self-service/update-current-customer-marketing-consent /api-reference/openapi.json put /storefront/self-service/marketing-consent # Update current customer profile Source: https://opencals.com/docs/api-reference/self-service/update-current-customer-profile /api-reference/openapi.json put /storefront/self-service/profile # Get staff member by slug Source: https://opencals.com/docs/api-reference/staff-members/get-staff-member-by-slug /api-reference/openapi.json get /storefront/staff-members/slug/{slug} Retrieve a staff member by their URL-friendly slug for current store # List store staff members Source: https://opencals.com/docs/api-reference/staff-members/list-store-staff-members /api-reference/openapi.json get /storefront/staff-members Retrieve a paginated list of staff members for the current store # Get store public settings Source: https://opencals.com/docs/api-reference/store/get-store-public-settings /api-reference/openapi.json get /storefront/stores/public-settings # Authentication Source: https://opencals.com/docs/authentication How authentication works in the Opencals Storefront API: public and private API keys, forwarding the buyer IP, customer JWT tokens, refresh flows, and error responses. The Storefront API uses two layers of authentication: an **API key** that identifies your store on every request, and optional **customer tokens** (JWTs) for endpoints that act on behalf of a logged-in customer. ## API keys Every request must include an API key in the `X-Api-Key` header: ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} curl "https://api.opencals.com/storefront/products" \ -H "X-Api-Key: spk_your_key_here" ``` Keys are created in the dashboard under **Users → your user → API Keys** and are scoped to a single store. Pick the kind by where your code runs: | Key | Prefix | Use it in | Restrict it with | | - | - | - | - | | Private storefront key | `spk_` | Server code: Next.js server components and API routes, serverless functions, your backend | Optional allowed server IPs | | Public storefront key | `sfk_` | Browser code: embedded widgets, client-side apps | Allowed origins (your domains) | Both work with every storefront endpoint. Admin keys (`sk_`) are for admin integrations such as Zapier and aren't accepted by the storefront API. > [!WARNING] > > Private keys are secrets: keep them in server-side environment variables. The API doesn't block them in a browser, so you can test from anywhere, but anyone who can read your browser code can use the key. A public key is visible to anyone who opens your site, so restrict it to your domains with allowed origins. ### Forward the buyer's IP When your server calls the API for its visitors, every request comes from your server's IP. Rate limits and sign-up, login and email protection then can't tell your visitors apart. With a private key, send each visitor's IP in `X-Opencals-Buyer-Ip`, and the API counts per buyer instead: ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} curl -X POST "https://api.opencals.com/storefront/auth/request-login-code" \ -H "X-Api-Key: spk_your_key_here" \ -H "X-Opencals-Buyer-Ip: 203.0.113.7" \ -H "Content-Type: application/json" \ -d '{ "email": "customer@example.com" }' ``` The header is optional, and it's ignored with a public key and on requests sent from a browser. Take the IP from the header your host sets (for example `x-real-ip` or the first `x-forwarded-for` entry on Vercel), never from the request body. With the SDK, use the [`buyerIp` option](/docs/guides/storefront-sdk#forward-the-buyer-s-ip). ## Customer authentication Endpoints that read or modify a specific customer's data — their appointments, orders, and profile — additionally require a customer access token as a Bearer token: ```text theme={"theme":{"light":"github-light","dark":"github-dark-default"}} Authorization: Bearer X-Api-Key: sfk_your_key_here ``` ### Sign in Exchange a customer's credentials for a token pair: ```bash Request theme={"theme":{"light":"github-light","dark":"github-dark-default"}} curl -X POST "https://api.opencals.com/storefront/auth/sign-in" \ -H "X-Api-Key: sfk_your_key_here" \ -H "Content-Type: application/json" \ -d '{ "email": "customer@example.com", "password": "securepassword" }' ``` ```json Response theme={"theme":{"light":"github-light","dark":"github-dark-default"}} { "accessToken": "eyJhbGciOi…", "refreshToken": "eyJhbGciOi…" } ``` ### Refresh tokens Access tokens expire. Get a fresh pair by calling the refresh endpoint with the **refresh token** as the Bearer token: ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} curl "https://api.opencals.com/storefront/auth/refresh" \ -H "X-Api-Key: sfk_your_key_here" \ -H "Authorization: Bearer " ``` ### All auth endpoints | Method | Endpoint | Description | | - | - | - | | `POST` | `/storefront/auth/sign-up` | Register a new customer (sends a verification email) | | `POST` | `/storefront/auth/sign-in` | Sign in with email and password | | `POST` | `/storefront/auth/oauth` | Sign in or register via an OAuth provider | | `GET` | `/storefront/auth/refresh` | Refresh tokens (pass the refresh token as Bearer) | | `POST` | `/storefront/auth/request-email-verification` | Resend the verification email | | `POST` | `/storefront/auth/verify-email` | Verify an email with the emailed token | | `POST` | `/storefront/auth/request-password-reset` | Send a password reset email | | `POST` | `/storefront/auth/reset-password` | Reset a password with the emailed token | See the [API reference](/docs/api-reference/introduction) for full request and response shapes. ### Which endpoints need a customer token? Customer-scoped endpoints — appointments, orders, and self-service profile management — require a customer Bearer token. Catalog endpoints (products, availability, staff members, locations, collections, store settings) need only the API key. > [!NOTE] > > Cart and checkout endpoints accept an *optional* customer token: guests can book without an account, and checkout can return auth tokens for new customers so they're signed in automatically after their first booking. Checkout never returns tokens for an existing customer identified only by the email in the request; that customer signs in themselves to see the booking. ## Error responses Errors use conventional HTTP status codes with a JSON body: ```json theme={"theme":{"light":"github-light","dark":"github-dark-default"}} { "statusCode": 400, "message": "Validation failed", "errors": [ { "property": "email", "messages": ["Email is required"] } ] } ``` | Status | Meaning | | - | - | | `400` | Validation error — check the `errors` array for per-field details | | `401` | Invalid or missing API key or customer token | | `404` | Resource not found | | `429` | Rate limit exceeded — see [rate limits](/docs/quickstart#rate-limits) | ## Security checklist * Use a private key (`spk_`) on your server and keep it in environment variables, never in client bundles or repositories. * Forward the buyer's IP (`X-Opencals-Buyer-Ip`) from your server so each visitor gets their own rate limits. * If your server has fixed outgoing IPs, add them to the private key's allowed IPs. * Use a public key (`sfk_`) only in browser code, and set its allowed origins to your domains. * Store customer refresh tokens in `httpOnly` cookies rather than `localStorage` where possible. * Rotate API keys from the dashboard if a key is ever exposed. # Changelog Source: https://opencals.com/docs/changelog What's new in the Opencals developer platform — Storefront API, TypeScript SDK, open-source templates, and developer docs. Stay up to date with releases across the Opencals developer platform. Subscribe to releases on [GitHub](https://github.com/letsopencals) to get notified. > [!NOTE] > > Each release is its own page in the sidebar, grouped by month. The > [Storefront SDK](/docs/changelog/storefront-sdk) page tracks every version so you > can see exactly which release a feature first shipped in. ## October 2026 > [card] [Booking confirmation and Pay by invoice](/docs/changelog/booking-confirmation) > > October 29 · API + Payments — bookings can wait for payment or the merchant, `pendingReason` explains pending appointments, checkout submit returns `paymentInstructions`, and `stripe_invoice` is a new payment method. > [card] [Gable — coworking template](/docs/changelog/gable-template) > > October 28 · Template — open-source coworking site with six houses, a search-style planner, a day sheet for desks, rooms and booths on one checkout, and a `coworking` seed dataset. > [card] [Frisør, rebuilt — barbershop template](/docs/changelog/frisor-template) > > October 27 · Template — new design, a three-step booking flow with the total always in view, retail products sold with the booking, and a `frisor` seed dataset. > [card] [Alba Dental — dental group template](/docs/changelog/alba-template) > > October 25 · Template — open-source dental group site with five studios, Smile Check, a chair-time booking planner and Alba Kids, plus a `dental_clinic` seed dataset. > [card] [Docs MCP server](/docs/changelog/docs-mcp-server) > > October 25 · AI Agents — search and read the developer docs from Claude Code, Cursor or any MCP client at `opencals.com/docs/mcp`. > [card] [Tensile — reformer Pilates template](/docs/changelog/reformer-template) > > October 23 · Template — open-source reformer Pilates studio site with a multi-studio timetable, Full classes and privates, and a `reformer_studio` seed dataset. > [card] [One confirmation email per order](/docs/changelog/order-confirmation-email) > > October 21 · Emails — customers get one Order Confirmation listing every appointment they booked, instead of one email per appointment. > [card] [Customer reschedules keep the booking length](/docs/changelog/reschedule-same-length) > > October 19 · API — a customer reschedule must keep the booking's length and product; a different length returns `400`. > [card] [Checkout: existing customers and booking addresses](/docs/changelog/checkout-customer-trust) > > October 18 · API — no tokens or profile changes for an existing customer named only by email; addresses entered for that booking are saved to the customer once the order is placed. > [card] [Bali Villa Rentals — villa template](/docs/changelog/bali-villas-template) > > October 12 · Template + API — open-source villa-rental site with nightly stays, a `villa_resort` seed dataset, and fixed check-in/check-out times enforced on customer bookings. > [card] [Staff contact details removed](/docs/changelog/storefront-sdk) > > October 9 · Breaking · SDK v0.3.17 — staff `email` and `userId` are no longer in Storefront API responses or types. > [card] [Fluently — language school template](/docs/changelog/fluently-template) > > October 9 · Template — open-source language-school site and a `language_school` seed dataset with online classroom links. > [card] [NOIR Drive — car rental template](/docs/changelog/noir-template) > > October 7 · Template + fix — open-source luxury car-rental site, a `car_rental` seed dataset, and correct validation for bookings longer than 24 hours. ## September 2026 > [card] [Appointment order fields deprecated](/docs/changelog/storefront-sdk) > > September 27 · Deprecation · SDK v0.3.17 — use `appointment.order` instead of `externalOrderId` / `externalOrderName`. > [card] [VOLT — padel & squash template](/docs/changelog/volt-template) > > September 20 · Template — open-source padel & squash club booking site, with a multi-court grid and custom durations. ## August 2026 > [card] [Clear Care — clinic template](/docs/changelog/clarity-template) > > August 15 · Template — open-source medical clinic booking site. > [card] [Custom Attributes](/docs/changelog/custom-attributes) > > August 1 · New feature · SDK v0.3.11 — attach arbitrary key-value data to appointments at booking time. ## June 2026 > [card] [Discounts](/docs/changelog/discounts) > > June 21 · New feature · SDK v0.3.2 — automatic and promo-code discounts. > [card] [Frisor — barbershop template](/docs/changelog/frisor-template) > > June 17 · Template — open-source barbershop booking site. > [card] [Add-Ons](/docs/changelog/add-ons) > > June 13 · New feature · SDK v0.3.0 — optional extras at booking time. > [card] [Developer docs launched](/docs/changelog/developer-docs) > > June 13 · Docs — API reference, guides, and the in-browser playground. > [card] [Haar — salon template](/docs/changelog/haar-template) > > June 7 · Template — open-source salon booking site. > [card] [Storefront API — v1](/docs/changelog/storefront-api) > > June 5 · API — the public customer-facing booking API. > [card] [Storefront SDK](/docs/changelog/storefront-sdk) > > Version history — the official TypeScript client, v0.1.0 → v0.3.2. # Add-Ons Source: https://opencals.com/docs/changelog/add-ons Optional extras attached to any bookable service, selected during the booking flow and paid in one transaction. Storefront SDK v0.3.0. **June 13, 2026** ## Add-Ons — new feature Service businesses can now attach optional extras to any bookable service. Customers select add-ons during the booking flow — after picking a service and time slot, before checkout — and pay the combined total in one transaction. **What's in the release:** * `GET /storefront/add-ons` — list add-ons, filter by `productId` * `GET /storefront/products/:id/add-ons` — add-ons for a specific service * `POST /storefront/cart/add-ons` — add an add-on to a cart item * `PATCH /storefront/cart/add-ons/:id` — update quantity * `DELETE /storefront/cart/add-ons/:id` — remove from cart **Key behaviors:** * Add-ons are scoped to products. Only add-ons linked to the booked service appear. * Two pricing modes: **fixed** (customer picks quantity) and **duration-multiplied** (quantity auto-set to the number of duration units, useful for per-day or per-hour charges). * Prices are snapshotted at cart creation — later catalog changes don't affect existing orders. * Add-ons appear in order line items (`OrderAddOnLineItem`) and on appointment records (`AppointmentAddOn`). Partial quantity refunds are supported. * Works on both `platform='opencals'` and `platform='shopify'`. **SDK support** — available in `@opencals/storefront-sdk` [v0.3.0](/docs/changelog/storefront-sdk) and higher (via `AddonService`). Older versions do not include add-on methods or types. ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} # List add-ons for a service curl -H "X-Api-Key: sfk_your_key" \ https://api.opencals.com/storefront/products/{productId}/add-ons # Add to cart curl -X POST -H "X-Api-Key: sfk_your_key" \ -H "X-Cart-Id: {cartId}" \ -H "Content-Type: application/json" \ -d '{"cartItemId": "...", "addOnId": "...", "quantity": 1}' \ https://api.opencals.com/storefront/cart/add-ons ``` See the [Add-Ons feature page](https://opencals.com/features/add-ons) for the full overview and use cases. # AI Agent Skills Source: https://opencals.com/docs/changelog/ai-agent-skills Opencals Agent Skills — ground-truth Skills that teach Claude Code, Cursor, Codex and Gemini CLI to build booking integrations on the Opencals API and SDK, plus a new AI Agents docs section and machine-readable llms.txt. **September 20, 2026** ## Agent Skills for building on Opencals Most integrations are now written inside an AI coding agent. So we shipped **Agent Skills** that give those agents ground-truth knowledge of the Opencals API and SDK — real method names, argument shapes and flows, no guessing. They follow the open [Agent Skills](https://code.claude.com/docs/en/skills) standard and work in Claude Code, Cursor, OpenAI Codex, Gemini CLI and more. Two skills, in one public repo ([github.com/letsopencals/skills](https://github.com/letsopencals/skills)): * **`opencals-storefront-api`** — the ground-truth reference: availability (slots and ranges, custom durations), carts and expiry, appointments, checkout (addresses, marketing consent), customer accounts, guests and attendees, discounts (automatic, codes, balance credit), reschedule/cancel, and rate limiting. * **`opencals-build-booking-site`** — builds a whole booking website: pick an official template, scaffold, wire it up, rebrand, deploy. Install in Claude Code: ``` /plugin marketplace add letsopencals/skills /plugin install opencals@opencals ``` Also new: * A dedicated **[AI Agents](/docs/ai-agents/overview)** section in the docs, with per-tool install instructions (including v0 / Lovable / Bolt). * Machine-readable docs at **[llms.txt](https://opencals.com/docs/llms.txt)** and **[llms-full.txt](https://opencals.com/docs/llms-full.txt)** for agents that consume docs directly. [Skills repo ↗](https://github.com/letsopencals/skills) · [AI Agents docs](/docs/ai-agents/overview) # Lovable, v0 and Base44 Source: https://opencals.com/docs/changelog/ai-app-builders Setup guides for building Opencals booking sites in Lovable (custom connector), v0 (agent skills) and Base44 (backend function + workspace skills). **September 26, 2026** ## Build booking sites in Lovable, v0 and Base44 Three new guides in the renamed **[AI & Builders](/docs/ai-agents/overview)** tab, each with every field and file ready to copy: * **[Lovable](/docs/ai-agents/lovable)**: add Opencals as a custom connector with Advanced auth (`X-Api-Key` + `X-Api-Version`) and two knowledge files. * **[v0](/docs/ai-agents/v0)**: attach `letsopencals/skills` from skills.sh and set `OPENCALS_API_KEY`. * **[Base44](/docs/ai-agents/base44)**: an `opencals` backend function, an app secret and two workspace skills. The knowledge files are also published as plain Markdown at [opencals.com/ai/opencals-storefront-api.md](https://opencals.com/ai/opencals-storefront-api.md), [lovable-booking-site-playbook.md](https://opencals.com/ai/lovable-booking-site-playbook.md) and [base44-booking-site-playbook.md](https://opencals.com/ai/base44-booking-site-playbook.md). # Alba Dental — dental group template Source: https://opencals.com/docs/changelog/alba-template Alba Dental, a free open-source dental group website template built on the Storefront API, with a separate children's site, plus a dental-clinic seed dataset. **October 25, 2026** ## Alba Dental — open-source dental group template The ninth open-source Opencals template is a **dental group with five London studios**, video consultations and 26 clinicians, and the first with a separate children's site. The same [Storefront API](/docs/api-reference/introduction) and typed [TypeScript SDK](/docs/guides/storefront-sdk) as the other templates, with a light, precise design of porcelain, lagoon teal and brass, and dental-chart annotations throughout. * **Smile Check** — a questionnaire on a 32-tooth chart: tap the teeth, say what's going on, set a comfort dial, and get the right visit at the studio with the soonest time, with the booking pre-filled * **The chair planner** — the visit drawn to scale on a chair-time track; after a check-up the hygienist straight after snaps on as a second appointment in the cart * **Many clinicians, many studios** — book by name or "first available"; every clinician's free windows are read once per studio and treatment for the whole booking window and cached, and the live studio board, day strip and times are derived from it * **Departments as collections, options as variants** — hygiene clean / deep clean / AirFlow, kids check-ups by age band; a treatment appears only at the studios where its clinicians work * **Pre-visit questions per patient** — who the visit is for, comfort level, smile concern and a child's nickname, answered per visit so a family cart keeps each patient apart * **A flippable appointment card** as the confirmation, with a six-month recall reminder for your calendar * **My Smile** — a recall ring, history, family visits, reschedule and cancel up to 24 hours before * **Alba Kids** — a cut-paper, risograph picture book: the kids services as a board-game road, a two-minute brushing game, a questionnaire for parents, a printable certificate of bravery and a stamp passport * `Dentist` structured data, Open Graph, `robots.txt` and `sitemap.xml` configured * Stack: Next.js 15, TypeScript, Tailwind v4, `@opencals/storefront-sdk` v0.3.19 * MIT licensed — clone, rebrand, deploy. One-click Vercel deploy. ### Dental-clinic seed dataset New Dev Stores can choose the **Alba Dental** dataset (`dental_clinic`; create the store in the United Kingdom for GBP). It seeds the five studios with their own hours and the video location, 26 clinicians, 25 treatments in eight departments, add-ons (happy air, fluoride varnish, AirFlow polish, X-rays), the pre-visit questions, a `NEWSMILE` code and an early-bird hygiene discount, and sample bookings, so the template matches the demo out of the box. [Live demo ↗](https://template-alba.vercel.app) · [GitHub ↗](https://github.com/letsopencals/template-alba) · [Template docs](/docs/open-source/alba) # Bali Villa Rentals — villa booking template Source: https://opencals.com/docs/changelog/bali-villas-template Bali Villa Rentals, a free open-source villa and holiday-rental website template built on the Storefront API, plus a villa-resort seed dataset and server-side enforcement of fixed check-in and check-out times. **October 12, 2026** ## Bali Villa Rentals — open-source villa booking template The seventh open-source Opencals template is live, and the first one built around **nightly stays**. **Bali Villa Rentals** is a villa-rental website for a demo resort, Lumbung Sidemen: ten villas in the rice fields of East Bali. The same [Storefront API](/docs/api-reference/introduction) and typed [TypeScript SDK](/docs/guides/storefront-sdk) as the other templates, with a warm, quiet design and every nightly rate on show. * **Booked by the night** — each villa is one staffless product with a one-night base duration, `allowCustomDuration`, and fixed check-in 15:00 / check-out 11:00, on a continuous 24/7 schedule * **Calendar on live availability** — reads `getCurrentAvailabilitiesMerged` and checks on the client that check-in → check-out fits inside one range * **Turnover days** — a check-out day can be the next guest's check-in day * **Guest details as custom attributes** — adults, children, infants, arrival time, flight number and occasion * Per-stay extras (airport transfer, floating breakfast, early check-in request), checkout questions and promo codes * Trip-aware customer accounts: dates in the resort timezone, night count, change dates (same number of nights) or cancel up to 14 days before check-in * Passwordless login and one-time email links * `LodgingBusiness`, `VacationRental` and `FAQPage` structured data, Open Graph, `robots.txt` and `sitemap.xml` configured * Stack: Next.js 15, TypeScript, Tailwind v4, Framer Motion, `@opencals/storefront-sdk` v0.3.17 * MIT licensed — clone, rebrand, deploy. One-click Vercel deploy. ### Villa-resort seed dataset New Dev Stores can choose the **Bali Villa Rentals** dataset (category Villa resort, `villa_resort`). It seeds ten villas on a 24/7 schedule with fixed check-in and check-out, four collections, per-stay extras, checkout questions and sample stays, so the template matches the demo out of the box. ### Fixed check-in and check-out are now enforced Products with **custom duration** and **fixed times** (`fixedTimes`, `fixedStartTime`, `fixedEndTime`) now have those times enforced by the server. A customer booking must start at `fixedStartTime` and end at `fixedEndTime` in the product's schedule timezone (the store timezone if the product has no schedule), or the API returns `400`. This applies to creating an appointment (`POST /storefront/appointments`, with or without a cart) and to customer reschedules (`PUT /storefront/appointments/{appointmentId}/reschedule`). Bookings and reschedules made by the merchant in the dashboard are exempt, so you can still give a guest an early check-in or a late check-out. A fixed-times stay is priced by whole nights: a 15:00 → 11:00 stay of N nights is shorter than N × 24 hours and is charged as N nights. No SDK changes. If your site already sends check-in → check-out slots built from the product's fixed times, nothing changes for you. [Live demo ↗](https://template-bali-villas.vercel.app) · [GitHub ↗](https://github.com/letsopencals/template-bali-villas) · [Template docs](/docs/open-source/bali-villas) # Booking confirmation, payment deadlines and Pay by invoice Source: https://opencals.com/docs/changelog/booking-confirmation Bookings can wait for payment or for the merchant before they are confirmed. Pending appointments now carry a reason, pay-later checkouts return payment instructions, and Stripe-hosted invoices are a new payment method. **October 29, 2026** ## Booking confirmation, payment deadlines and Pay by invoice A customer booking isn't always confirmed at checkout any more. Depending on the store, it may wait for the customer to pay, or for the merchant to approve it. Most stores still confirm every booking straight away; nothing changes for them. ### `pending` now means "awaiting confirmation" An appointment on a placed order can stay `pending` after checkout. A new optional field, `pendingReason`, says why: * `awaiting_payment`: the booking is confirmed once the order is paid. Pay by the order's `paymentDueAt` when it has one. * `awaiting_approval`: the merchant confirms or declines it. If the order has an `approvalDueAt`, an unapproved booking is cancelled at that time. A paid booking can still be awaiting approval. When the payment deadline passes, the booking is either cancelled or handed to the merchant to review (it then becomes `awaiting_approval`). Cash orders never get a payment deadline. When the approval deadline passes, the merchant declines, or the order is cancelled on its sales channel, the appointment becomes `canceled` with a `cancelReason`: `unpaid`, `not_approved`, `declined` or `order_cancelled`. The order gets `cancelledAt` and its own `cancelReason`: `unpaid`, `not_approved`, `declined`, `external` or `customer`. Its `paymentStatus` is `voided` when nothing was paid. Show pending bookings as "Awaiting payment" or "Awaiting confirmation", never as confirmed. ### Pay by invoice (`stripe_invoice`) Stores with Stripe connected can offer `stripe_invoice` at checkout. It works like `bank_transfer`: start checkout with it and submit without a payment step. The customer pays a Stripe-hosted invoice afterwards. ### `paymentInstructions` on checkout submit `POST /storefront/cart/checkout/submit` returns an optional `paymentInstructions` object for pay-later orders: `provider`, `hostedInvoiceUrl` (Stripe invoice), `bankDetails` (bank transfer) and `dueAt`. Show it on your confirmation page. See [Build a booking page](/docs/guides/build-a-booking-page). ### Checkout conflicts and cart holds Checkout `start` and `submit` answer **409** with an error `code`: * `CART_EXPIRED`: a held time is gone. `start` and `submit` now revive an expired cart when its slots are still free, so this only means a slot was taken. * `CART_ALREADY_CHECKED_OUT`: the cart is already an order; the body has its `orderId`. * `CHECKOUT_IN_PROGRESS`: another checkout of the same cart is still running. Keep the cart and retry in a moment. `submit` answers **402** with `code: PAYMENT_NOT_AUTHORIZED` (and the `paymentStatus`) when the card payment isn't authorised, for example after a decline or an unfinished 3-D Secure check. No order is placed and the cart is unchanged, so the customer can retry the payment. Every store now has a hold window (15 minutes by default). Extending a cart or starting checkout only moves `expiresAt` later, never earlier. Adding an item to an expired cart re-opens it with a fresh hold window. ### What to change Appointment status values are the same, but a few things change under you: * **Orders no longer include `logs`.** Order logs are merchant-only, so the Storefront API stopped returning them. Drop any read of `order.logs`. * **New enum values.** `paymentStatus` can be `voided`, the payment provider can be `stripe_invoice`, and appointments carry `pendingReason` and `cancelReason`. Code that switches over these values needs a branch for the new ones. * **New checkout errors.** Handle **409** `CART_ALREADY_CHECKED_OUT`, `CART_EXPIRED` and `CHECKOUT_IN_PROGRESS`, and **402** `PAYMENT_NOT_AUTHORIZED`, as described above. `appointmentsSettings.markAsScheduled` is still accepted, but the store now decides when a customer booking is confirmed. To support the new flows, render `paymentInstructions` after submit and label pending bookings using `pendingReason`. SDK users get all of this in [v0.3.20](/docs/changelog/storefront-sdk). # Checkout: existing customers and booking addresses Source: https://opencals.com/docs/changelog/checkout-customer-trust Storefront checkout no longer returns tokens for, or changes, an existing customer identified only by the email in the request. Addresses entered for such a booking are saved to the customer once the order is placed. **October 18, 2026** ## Existing customers at checkout Storefront API keys are public, so an email or `customerId` in a checkout request is a claim, not proof of who is booking. A customer named in the request is now only treated as the caller when the request is signed in as that customer (customer `Authorization` token), or when this cart's checkout created them. When a guest enters the email of an existing customer and isn't signed in: * The booking is still attached to that customer, so it shows in their account after they sign in (for example with a login code). * Nothing on their profile is overwritten: name, phone, billing address and marketing consent stay as they were. * `checkout/submit` returns no `auth` or `customer`, and `checkout/save-customer` returns `{}` without a `customerId`. * Cart and appointment responses show `customer` and `customerId` as `null`. The `customerFirstName`, `customerEmail` and other snapshot fields echo what was entered. ### Addresses `checkout/save-customer` and `checkout/start` don't write to the customer. Until the order is placed, billing and delivery addresses entered for such a booking belong to the cart only, and their `customerId` is `null` (for example `cart.billingAddress.customerId`). When `checkout/submit` places the order, they're added to the customer's saved addresses. The order and invoice use them as entered. Treat an address's `customerId` as nullable. ### Billing at submit Required billing fields are checked against the `billingAddress` in the request, or, when the request has none, against the billing address already saved on the cart. You no longer need to send the billing address again at `checkout/start` or `checkout/submit`. A billing address sent for the first time with `checkout/submit` is linked to the order. A submit rejected for missing customer details leaves the cart's reservation in place until the cart expires as usual. **What to change in your integration:** always treat `auth` on the submit response as optional, and don't rely on `save-customer` returning a `customerId`. When it doesn't, either send the same customer details again in the next steps or leave `customer` out: the cart already holds the customer. # Clear Care — clinic template Source: https://opencals.com/docs/changelog/clarity-template Clear Care, a free open-source medical clinic booking website template built on the Storefront API — Next.js 15, department-first booking, medical intake, passwordless accounts, Stripe checkout. **August 15, 2026** ## Clear Care — open-source clinic booking template The third open-source Opencals template is live. **Clear Care** is a medical clinic booking website — the clinical counterpart to [Haar](/docs/changelog/haar-template) and [Frisor](/docs/changelog/frisor-template): the same [Storefront API](/docs/api-reference/introduction) and typed [TypeScript SDK](/docs/guides/storefront-sdk) underneath, a different vertical and a warm, organic clinical design. Every screen — departments, service picker, clinician and location selectors, time slots, medical intake, checkout, customer account — is built with the public API. * Department-first browsing (product collections) across nine specialties * Clinician & multi-location booking, real-time availability with live group capacity * Medical intake captured at checkout and saved to the appointment * Passwordless customer accounts — 6-digit email login with password fallback, one-time email links via `/link/[token]` * Stripe payments with deposit support * Stack: Next.js 15, TypeScript, Tailwind v4, `@opencals/storefront-sdk` * MIT licensed — clone, rebrand, deploy. One-click Vercel deploy. [Live demo ↗](https://template-clarity.vercel.app) · [GitHub ↗](https://github.com/letsopencals/template-clarity) · [Template docs](/docs/open-source/clarity) # Custom Attributes Source: https://opencals.com/docs/changelog/custom-attributes Attach arbitrary key-value data to appointments at booking time. Storefront SDK v0.3.11. **August 1, 2026** ## Custom attributes on appointments Custom booking frontends can now attach arbitrary data to an appointment at creation time — a booking source, a party size, an external reference id, or small JSON strings. Custom attributes are a flat map of string keys to string values (the same idea as Shopify order note/custom attributes): no data types, no access rules, not searchable — just a simple bag of key-value pairs that travels with the appointment. **What's in the release:** * `POST /storefront/appointments` accepts an optional `customAttributes` object — a map of string keys to string values. * Appointment responses now echo `customAttributes`. * The merchant dashboard shows custom attributes on the appointment detail page. **Key behaviors:** * Keys and values are always strings (a value can itself be a JSON string — it is stored verbatim and never parsed). * Limits: up to **250** attributes per appointment, keys up to **255** characters, values up to **5000** characters. * Not searchable by design — attributes are stored inline with the appointment for fast reads, not indexed for querying. **SDK support** — available in `@opencals/storefront-sdk` [v0.3.11](/docs/changelog/storefront-sdk) and higher. `CreateAppointment` gains an optional `customAttributes` field. ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} # Create an appointment with custom attributes curl -X POST -H "X-Api-Key: sfk_your_key" \ -H "Content-Type: application/json" \ -d '{ "slot": { "fromDate": "2026-08-15", "fromTime": "10:00:00", "toDate": "2026-08-15", "toTime": "11:00:00", "productId": "..." }, "customAttributes": { "source": "widget", "party_size": "4" } }' \ https://api.opencals.com/storefront/appointments ``` # Developer docs launched Source: https://opencals.com/docs/changelog/developer-docs The Opencals developer documentation is live — interactive API reference, quickstart, guides, and open-source templates. **June 13, 2026** ## Developer docs launched The Opencals developer documentation is now live at **[opencals.com/docs](https://opencals.com/docs)**. * Interactive [API Reference](/docs/api-reference/introduction) with an in-browser playground — try every endpoint without leaving the docs * [Quickstart guide](/docs/quickstart) — first API call in under 5 minutes * [Build a booking page](/docs/guides/build-a-booking-page) — end-to-end tutorial (services → staff → availability → cart → checkout) * [TypeScript SDK guide](/docs/guides/storefront-sdk) — typed client with Zod schemas and formatting helpers * [Webhooks overview](/docs/guides/webhooks) — planned event catalog for appointment and order lifecycle events * [Open-source templates](/docs/open-source/templates) — production-ready booking site starters # Discounts Source: https://opencals.com/docs/changelog/discounts Automatic and promo-code discounts — target by product, staff, location, and schedule, with stacking and usage caps. Storefront SDK v0.3.2. **June 21, 2026** ## Discounts — new feature Storefronts can now apply **automatic discounts** and **promo codes** to a cart before checkout. Automatic discounts apply to every qualifying booking without customer action; code discounts require the customer to enter a promo code. **What's in the release:** * `POST /storefront/cart/discount-code` — apply a promo code to the cart * `DELETE /storefront/cart/discount-code` — remove the applied code * Every cart-returning endpoint now includes an `appliedDiscounts[]` field and per-line-item `discounts[]`, so you can render a "you saved \$X" summary * Order line items carry `OrderLineItemDiscount` records for accurate receipts and refunds **Key behaviors:** * Two methods: **automatic** (applies silently) and **code** (customer enters a promo code). * Two value formats: **percentage** or **fixed amount**. * Two scopes: **line-item** (distributed across qualifying lines) and **order** (applied to the cart total). * Targeting by **product**, **staff member**, **location**, and an **include add-ons** toggle. Discounts re-evaluate on every cart mutation. * **Scheduling**: always-active, weekly-recurring windows, or fixed date ranges — evaluated in the store's timezone. * **Requirements**: minimum purchase amount and/or appointment duration range. * **Stacking**: combinable discounts stack; exclusive discounts apply the single best deal for the customer. * **Usage caps**: total redemption cap and per-customer cap. Usage is tracked per store on multi-store and Shopify setups. **SDK support** — available in `@opencals/storefront-sdk` [v0.3.2](/docs/changelog/storefront-sdk) and higher: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { CartService } from "@opencals/storefront-sdk"; // Apply a promo code const { data: cart } = await CartService.applyDiscountCode({ body: { code: "WELCOME10" }, }); // cart.appliedDiscounts now reflects the discount // Remove it await CartService.removeDiscountCode(); ``` ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} # Apply a promo code over HTTP curl -X POST -H "X-Api-Key: sfk_your_key" \ -H "X-Cart-Id: {cartId}" \ -H "Content-Type: application/json" \ -d '{"code": "WELCOME10"}' \ https://api.opencals.com/storefront/cart/discount-code ``` See the [Discounts feature page](https://opencals.com/features/discounts) for the full overview, and the [Build a booking page guide](/docs/guides/build-a-booking-page) for where promo codes fit in the checkout flow. # Docs MCP server Source: https://opencals.com/docs/changelog/docs-mcp-server The Opencals developer docs are available as an MCP server at opencals.com/docs/mcp, with search and read tools for Claude Code, Cursor and other MCP clients. **October 25, 2026** ## Search the docs from your coding agent The developer docs now run as an MCP server at `https://opencals.com/docs/mcp`. Connect it to Claude Code, Cursor or any MCP client that supports remote servers, and your agent can search the docs and read full pages, including the OpenAPI spec, while it writes code. It needs no API key. Two read-only tools: * **`search_opencals_developer_docs`** returns matching passages with links. * **`query_docs_filesystem_opencals_developer_docs`** reads full pages with `cat`, `head` or `grep`. Add it in Claude Code: ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} claude mcp add --transport http opencals-docs https://opencals.com/docs/mcp ``` Setup for Cursor and other clients is on the [AI Agents overview](/docs/ai-agents/overview#docs-mcp-server). The server covers documentation only; store data and bookings go through the [Storefront API](/docs/api-reference/introduction). # Fluently — language school template Source: https://opencals.com/docs/changelog/fluently-template Fluently, a free open-source language school website template built on the Storefront API, plus a language-school seed dataset with online classroom links. **October 9, 2026** ## Fluently — open-source language school template The sixth open-source Opencals template is live, and the first one built for **schools and courses**. **Fluently** is a language-school website set in New York with two campuses and an online classroom: the same [Storefront API](/docs/api-reference/introduction) and typed [TypeScript SDK](/docs/guides/storefront-sdk) as the other templates, with a friendly, colorful design. * **Subjects are collections** and **levels are variants**: group classes with A1–B1 levels, private lessons by length, and a \$0 free trial * **Format from the data**: online vs campus groups come from location types, so the template works for any school without code changes * **This week timetable**: upcoming group sessions across every class with live seats left and one-click booking * **Teachers** from staff, with "Book with " deep links that preselect the teacher * **Join lesson** button on online bookings, using the online location's `link` * A level-finder quiz, placement questions at checkout, and extras such as a workbook and lesson recording * Passwordless student accounts, Stripe checkout and the no-payment path for the trial * `LanguageSchool` and `FAQPage` structured data, Open Graph, `robots.txt` and `sitemap.xml` configured * Stack: Next.js 15, TypeScript, Tailwind v4, Framer Motion, `@opencals/storefront-sdk` v0.3.14 * MIT licensed — clone, rebrand, deploy. One-click Vercel deploy. ### Language-school seed dataset New Dev Stores can choose the **Fluently** dataset (`language_school`). It seeds six languages, campus and online group classes with level variants, private lessons, the trial and conversation club, teachers, two campuses and an online classroom with its meeting link, so the template matches out of the box. Seeded online locations can now carry a meeting link. No API or SDK changes. [GitHub ↗](https://github.com/letsopencals/template-fluently) · [Template docs](/docs/open-source/fluently) # Frisør — barbershop template Source: https://opencals.com/docs/changelog/frisor-template Frisor, a free open-source barbershop booking website template built on the Storefront API — Next.js 15, Stripe checkout, add-ons, customer accounts. **October 27, 2026** ## Frisør, rebuilt: barbershop and apothecary **Frisør** has a new design and a new booking flow, and now sells the shop's retail products with the booking. * Three-step booking: shop and service, barber and time (the date strip sits directly above the times), then The Shelf. The total and the Continue button are always in view, in a sticky panel on desktop and a bar on phones. * Retail as add-ons: products with the slug prefix `shelf-` are picked up at the chair. They're offered in booking, at checkout, on service and barber pages, on `/shelf`, and as restock links after the visit. `SHELF15` (15% off add-ons only) is applied automatically. * Checkout with sign-in by emailed code, an editable receipt and a last-call shelf row; a confirmation page with an apothecary-style appointment label; an account with Book again, move and cancel. * New `frisor` Dev Store dataset: three Berlin shops, thirteen barbers, twelve shelf products, `SHELF15` and `FIRSTCHAIR`. [Live demo ↗](https://template-frisor-sage.vercel.app) · [GitHub ↗](https://github.com/letsopencals/template-frisor) · [Template docs](/docs/open-source/frisor) **June 17, 2026** ## Frisor — open-source barbershop booking template The second open-source Opencals template is live. **Frisor** is the barbershop counterpart to [Haar](/docs/changelog/haar-template): same [Storefront API](/docs/api-reference/introduction) and typed [TypeScript SDK](/docs/guides/storefront-sdk) underneath, a different vertical and a dark editorial design. Every screen — services, barber picker, time slots, add-ons, cart, checkout, customer account — is built with the public API. * Service catalog, barber & multi-location booking, real-time availability * Add-ons at checkout, Stripe payments with deposit support * Customer accounts with reschedule and cancellation * Stack: Next.js 15, TypeScript, Tailwind v4, `@opencals/storefront-sdk` * MIT licensed — clone, rebrand, deploy. One-click Vercel deploy. [Live demo ↗](https://template-frisor-sage.vercel.app) · [GitHub ↗](https://github.com/letsopencals/template-frisor) · [Template docs](/docs/open-source/frisor) # Gable — coworking template Source: https://opencals.com/docs/changelog/gable-template Gable, a free open-source coworking website template built on the Storefront API, with a multi-item day sheet and extras suggested in the gaps, plus a coworking seed dataset. **October 28, 2026** ## Gable — open-source coworking template The tenth open-source Opencals template is a **coworking network with six houses** in Dublin, Cork and Galway, and the first built around a multi-item cart: a desk, a room and a booth on one day, one checkout. The same [Storefront API](/docs/api-reference/introduction) and typed [TypeScript SDK](/docs/guides/storefront-sdk) as the other templates, drawn as an architect's drawing set in cobalt and marigold. * **The planner** — a search by house, day, length, start and people; the results are the spaces that fit, with the price for that span, a hatched day bar and "Free at 10:00" or "23 seats free" * **The day sheet** — the cart as a timeline of the day, with the total and Check out always in view, and suggestions in the gaps: a desk around your meetings, a booth between two meetings, lunch for the room, a bigger room free at the same time, parking * **Seats on the open floor** — one capacity product per house; teams book several seats, and seats left come from the availability ranges' `attendees` / `maxAttendees` * **One availability read per house** — every space's free ranges for the whole booking window, cached for 60 s; free now, next free, start times and the day strip are derived from it * **Invitees as guests** — room bookings invite the attendees, who get the calendar invite * **A printable day sheet** as the confirmation, with a section through the house and the route from the front door * **Week plan** — the account opens on the week; change time, stay longer, invite and cancel * `CoworkingSpace` structured data per house, Open Graph, `robots.txt` and `sitemap.xml` configured * Stack: Next.js 15, TypeScript, Tailwind v4, `@opencals/storefront-sdk` v0.3.19 * MIT licensed — clone, rebrand, deploy. One-click Vercel deploy. ### Coworking seed dataset New Dev Stores can choose the **Gable** dataset (`coworking`; create the store in Ireland for EUR). It seeds six houses with their hours and coordinates, 77 spaces (flex floors, studio desks, meeting rooms, phone booths, a podcast studio, a photo studio, event spaces and day offices), 16 extras from coffee for the room to a sound engineer, the checkout questions, a first-day discount, a `GABLETEAM` code, Friday-afternoon room pricing and sample bookings, so the template matches the demo out of the box. [Live demo ↗](https://template-gable.vercel.app) · [GitHub ↗](https://github.com/letsopencals/template-gable) · [Template docs](/docs/open-source/gable) # Haar — salon template Source: https://opencals.com/docs/changelog/haar-template Haar, the first open-source Opencals template — a complete beauty-salon booking website built on the Storefront API. **June 7, 2026** ## Haar — open-source salon booking template The first open-source Opencals template is live. **Haar** is a complete beauty-salon booking website built on the [Storefront API](/docs/api-reference/introduction): service catalog, staff and multi-location booking, real-time availability, Stripe checkout, and customer accounts. * Stack: Next.js 15, TypeScript, Tailwind, `@opencals/storefront-sdk` * MIT licensed — clone, rebrand, deploy for yourself or clients * One-click Vercel deploy [Live demo ↗](https://template-haar.vercel.app) · [GitHub ↗](https://github.com/letsopencals/template-haar) · [Template docs](/docs/open-source/haar) # NOIR Drive — car rental template Source: https://opencals.com/docs/changelog/noir-template NOIR Drive, a free open-source luxury car rental website template built on the Storefront API, plus a car-rental seed dataset and correct validation for multi-day bookings longer than 24 hours. **October 7, 2026** ## NOIR Drive — open-source luxury car rental template The fifth open-source Opencals template is live, and the first one built around **multi-day bookings**. **NOIR Drive** is a luxury car-rental website set in Dubai: the same [Storefront API](/docs/api-reference/introduction) and typed [TypeScript SDK](/docs/guides/storefront-sdk) as [Haar](/docs/changelog/haar-template), [Frisor](/docs/changelog/frisor-template), [Clear Care](/docs/changelog/clarity-template) and [VOLT](/docs/changelog/volt-template), with a black cinematic design and cars booked by the day. Two booking surfaces over one store: a multi-day rental flow for the fleet, and a classic staff flow for chauffeur packages. Every screen is built with the public API. * **Booked by the day** — each car is one staffless product with a 1-day base duration and `allowCustomDuration`, on a continuous 24/7 schedule * **Range calendar on live availability** — reads `getCurrentAvailabilitiesMerged` and checks on the client that pick-up → return fits inside one range * **Delivery or garage** — a `DELIVERY` location with the address captured at checkout, or a `PHYSICAL` garage * **Handover details as custom attributes** — handover and return windows, flight number, collection address * **Per-day extras** with `durationMultiplied`, plus one-off extras * Licence and ID uploads and a deposit-and-terms checkbox as checkout questions * **Chauffeur packages** with real drivers and a preferred-car request * Rental-aware customer accounts: dates in the store timezone, day count, change dates (same length) or cancel within policy * `AutoRental` and `Product` structured data, Open Graph, `robots.txt` and `sitemap.xml` configured * Stack: Next.js 15, TypeScript, Tailwind v4, Framer Motion, `@opencals/storefront-sdk` v0.3.14 * MIT licensed — clone, rebrand, deploy. One-click Vercel deploy. ### Car-rental seed dataset New Dev Stores can choose the **NOIR Drive** dataset (category Car rental, `car_rental`). It seeds twelve cars on a 24/7 schedule, a garage and a delivery location, per-day and fixed extras, the rental checkout questions, and four chauffeurs with their packages, so the template matches the demo out of the box. ### Fix: bookings longer than 24 hours Bookings with a custom duration longer than a day are now validated against **continuous availability**: the server checks that the whole span sits inside one free window. Before, validation used per-day slot generation and could reject a valid multi-day booking on a 24/7 schedule. No API or SDK changes. [Live demo ↗](https://template-noir.vercel.app) · [GitHub ↗](https://github.com/letsopencals/template-noir) · [Template docs](/docs/open-source/noir) # One confirmation email per order Source: https://opencals.com/docs/changelog/order-confirmation-email Customers get a single Order Confirmation email listing every appointment they booked, instead of one email per appointment. **October 21, 2026** ## One confirmation email per order When a customer books several appointments in one checkout, they now get one **Order Confirmation** email instead of one email per appointment. It lists every appointment on the order with its time, staff member, location and add-ons. Each appointment has its own View, Cancel and Reschedule links and its own calendar file (`.ics`). The email ends with the order number and total. This applies to every order, whether it comes from a storefront or template checkout, a Shopify order or an order created in the dashboard. * **Merchants** with admin notifications on get one "Order confirmed" email per order. * **Staff members** still get one email per appointment assigned to them. * **Guests** still get one invitation per appointment. * Reschedule, cancellation, reminder and feedback emails are unchanged and stay per appointment. ### Appointment Confirmation is deprecated The per-appointment **Appointment Confirmation** template is replaced by Order Confirmation. Stores that customised it keep it for orders with a single appointment, and the dashboard shows it with a "Deprecated" badge. Restoring its default switches the store to Order Confirmation. Stores that never customised it don't see it. ### What to change Nothing. The Storefront API and SDK are unchanged. Customise the new template under **Look & feel → Emails → Order Confirmation**. # Tensile — reformer Pilates studio template Source: https://opencals.com/docs/changelog/reformer-template Tensile, a free open-source reformer Pilates and fitness studio website template built on the Storefront API, plus a reformer-studio seed dataset. **October 23, 2026** ## Tensile — open-source reformer Pilates studio template The eighth open-source Opencals template is live, and the first one built for a **class-based fitness studio**. **Tensile** is a reformer Pilates studio in Berlin with three studios, live online classes and eight instructors. The same [Storefront API](/docs/api-reference/introduction) and typed [TypeScript SDK](/docs/guides/storefront-sdk) as the other templates, with a technical, warm design that uses the reformer spring colours as its intensity scale. * **A multi-studio weekly timetable** — every class names its instructor and shows the beds left in the room as bed pips, with filters you can share as a URL * **One variant per class × studio × instructor** — each with its own schedule, one location, one staff member, and `maxAttendees` set to the beds in the room * **Full classes** — the API drops a slot once it's full, so the template learns each series' weekly pattern, shows a missing week as Full, and links to the next class of the same type with space * **Class sheet → checkout** — a room plan, extras, a price preview with the best discount, then on to checkout * **Privates** — 1:1 and duet sessions sharing one product pool (a private room) per studio; a duet is one booking for two, carried as a custom attribute * Dated workshops, live online classes with a Join button, and add-ons (grip socks, towel hire, recovery shake) * Waiver and pregnancy checkout questions; an automatic intro offer, an automatic weekday off-peak discount and a `TENSILE10` code, where the best single discount wins * Passwordless accounts: move or cancel up to 12 hours before, feedback, and a level path * `ExerciseGym` structured data with a `SportsActivityLocation` per studio, Open Graph, `robots.txt` and `sitemap.xml` configured * Stack: Next.js 15, TypeScript, Tailwind v4, Framer Motion, `@opencals/storefront-sdk` v0.3.18 * MIT licensed — clone, rebrand, deploy. One-click Vercel deploy. ### Reformer-studio seed dataset New Dev Stores can choose the **Reformer Pilates Studio** dataset (category Pilates & fitness, `reformer_studio`). It seeds the three studios and the online room, eight instructors, the weekly timetable capped at the beds in each room, privates, three workshops, add-ons, checkout questions, the three discounts and sample bookings with some classes already full, so the template matches the demo out of the box. [Live demo ↗](https://template-reformer.vercel.app) · [GitHub ↗](https://github.com/letsopencals/template-reformer) · [Template docs](/docs/open-source/reformer) # Customer reschedules keep the booking length Source: https://opencals.com/docs/changelog/reschedule-same-length PUT /customer/appointments/:id/reschedule now rejects a new slot of a different length and always keeps the appointment's own product. **October 19, 2026** ## Reschedules keep the booking length A customer reschedule moves an appointment to a new time. It now also has to keep the length of the booking: * The new slot must cover the same number of billed units as the current one. For a custom-duration product priced per hour, a 2-hour booking can move to any other free 2-hour slot, but not to 3 hours. A different length returns `400` ("The new time must be the same length as the current booking …"). * The appointment's product can't change. A `slot.productId` that isn't the appointment's own product is ignored, and the slot is checked against the appointment's product. A different length changes the price, and only the merchant can settle the difference. Merchants change the length, the product or the appointments of an order from the dashboard, which re-prices the order. Units are counted the same way as at booking, so a stay moved across a daylight-saving change still counts as the same number of nights. ### What to change Nothing, if your reschedule UI already keeps the booking length. The open-source templates and the Opencals storefront already do. If you let customers pick a new end time, fix the length to the current booking's and pass it as `duration` when you load availability: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { Products } from '@opencals/storefront-sdk'; const seconds = (new Date(appointment.to).getTime() - new Date(appointment.from).getTime()) / 1000; const { data: slots } = await Products.getCurrentAvailabilities({ path: { productId: appointment.productId }, query: { date, duration: String(seconds), excludeAppointmentId: appointment.id }, }); ``` # Storefront API — v1 Source: https://opencals.com/docs/changelog/storefront-api The Storefront API is publicly available — the full customer-facing booking flow over REST. **June 5, 2026** ## Storefront API — v1 The Storefront API is now publicly available. It covers the full customer-facing booking flow: | Domain | Key endpoints | | - | - | | **Products** | List services, collections, variants | | **Staff members** | List staff, per-staff availability | | **Locations** | Multi-location support | | **Appointments** | Real-time slot availability | | **Cart** | Create and manage a booking cart | | **Checkout** | Initiate and confirm checkout | | **Payments** | Stripe-backed deposits and full payments | | **Customer self-service** | View, reschedule, and cancel bookings | | **Webhooks** | Signed event delivery *(coming soon)* | Base URL: `https://api.opencals.com` · Authentication: `Authorization: Bearer sfk_…` The API is versioned via the `X-Api-Version` header. See the [full endpoint catalog](/docs/api-reference/introduction). # Storefront SDK Source: https://opencals.com/docs/changelog/storefront-sdk Version history for @opencals/storefront-sdk — the official TypeScript client for the Storefront API. See which release each feature first shipped in. `@opencals/storefront-sdk` is the official TypeScript client for the Storefront API — generated from the OpenAPI spec, fully typed, with Zod runtime validation and formatting helpers for prices, durations, and timezones. MIT licensed. ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} npm install @opencals/storefront-sdk ``` [npm ↗](https://www.npmjs.com/package/@opencals/storefront-sdk) · [SDK guide](/docs/guides/storefront-sdk) > [!NOTE] > > Each feature ships in a specific SDK version. To use a feature, install that > version or higher — for example, [add-ons](/docs/changelog/add-ons) require > **v0.3.0+** and [discounts](/docs/changelog/discounts) require **v0.3.2+**. Older > versions don't include those methods or types. ## Version history **v0.3.20 · November 2026** **Booking confirmation.** A booking can now wait before it's confirmed: for the customer to pay, or for the merchant to approve it. A waiting booking stays `status: 'pending'` and says why in **`pendingReason`** (`'awaiting_payment'` or `'awaiting_approval'`, `null` once confirmed). A cancelled one may carry **`cancelReason`** (`unpaid`, `not_approved`, `declined`, `order_cancelled`), also nullable. See [Booking confirmation](/docs/changelog/booking-confirmation). **Order deadlines.** Orders gain `paymentDueAt`, `approvalDueAt`, `cancelledAt` and `cancelReason`, and `paymentStatus` can be `'voided'`: the order was cancelled before anything was paid. **Pay by invoice.** A new `stripe_invoice` payment provider works like `bank_transfer`: checkout places the order without taking money and issues a Stripe-hosted invoice. **`paymentInstructions` on checkout submit.** Pay-later orders return `{ provider, hostedInvoiceUrl?, dueAt?, bankDetails? }`. Show the invoice link or bank details and the due time on your thank-you page. **Checkout error codes.** Checkout answers **409** with `CART_ALREADY_CHECKED_OUT`, `CART_EXPIRED` or `CHECKOUT_IN_PROGRESS`, and `submit` answers **402** with `PAYMENT_NOT_AUTHORIZED` when the card payment isn't authorised. Read the reason from `OpencalsApiError.code`. **Breaking: `order.logs` removed.** Order logs are merchant-only and the Storefront API no longer returns them. The `OrderDetailLog`, `CheckoutOrderLog` and `OrderLogLevel` types are gone. Drop any read of `order.logs`. `appointmentsSettings.markAsScheduled` on checkout submit is still accepted but no longer decides confirmation; read `pendingReason` on the returned appointments instead. **v0.3.19 · October 2026** **Forward the buyer's IP.** A new `buyerIp` option on `setupOpencals` takes a function that returns the IP of the visitor a request is made for. The SDK sends it as `X-Opencals-Buyer-Ip`, and with a private storefront key (`spk_`) the API then counts rate limits and sign-up, login and email protection per visitor instead of per server. Next.js apps can use the ready-made `nextBuyerIp` from the new `@opencals/storefront-sdk/next` entry point. See [Forward the buyer's IP](/docs/guides/storefront-sdk#forward-the-buyer-s-ip). **One key setting, two kinds of key.** `apiKey` / `OPENCALS_API_KEY` takes either a private storefront key (`spk_`, for server code) or a public one (`sfk_`, for browser code). The SDK warns when a private key is passed in a browser, where anyone could read it. See [API keys](/docs/authentication#api-keys). **`OpencalsApiError.code`** carries the API's machine-readable reason when there is one, for example `CODE_EXPIRED` for a rejected discount code. No breaking changes. **v0.3.17 · September 27, 2026** **Staff contact details removed.** The Storefront API no longer returns staff `email`, `userId` or `refreshToken`, and staff detail no longer includes the linked `user`. Storefront keys ship in browsers, so these were readable by anyone. The fields are gone from every `*StaffMember` type, and the `StaffMemberDetailUser` type is removed. If you used `email` for avatar initials, use `firstName` / `lastName` instead. **Appointment `externalOrderId` / `externalOrderName` deprecated.** These fields predate orders. Read the platform order from `appointment.order` instead (`order.externalId`, `order.externalName`). * Both fields stay in appointment responses and are now filled from the linked order, so they're correct again for new bookings. They're marked `@deprecated` in the types. * `AppointmentService.findByExternalOrderName` is deprecated. It now only returns appointments from the store making the request, and it returns 404 instead of 400 when nothing matches. **v0.3.11 · August 1, 2026** **Custom attributes on appointments.** Ships support for the new [custom attributes](/docs/changelog/custom-attributes) feature. * `CreateAppointment` accepts an optional `customAttributes` map (string keys → string values) to attach arbitrary data at booking time * Appointment responses now echo `customAttributes` **v0.3.2 · June 21, 2026** **Discounts & passwordless auth.** Ships support for the new [discounts](/docs/changelog/discounts) feature and magic-link sign-in. * `CartService.applyDiscountCode()` and `CartService.removeDiscountCode()` * New discount types: `AppliedDiscount`, `ApplyCode`, `CartItemAppliedDiscount`, `OrderLineItemDiscount`, `OrderLineItemDiscountWritable` * Passwordless / magic-link auth: `AuthService.requestLoginCode()`, `AuthService.verifyLoginCode()`, `AuthService.resolveLink()`, with `RequestLoginCode`, `VerifyLoginCode`, `ResolveLinkResponse` types **v0.3.1 · June 14, 2026** * Fixed the `AppointmentAddOn` type, which was missing fields due to a backend OpenAPI schema name collision (the DTO was renamed to `CreateAppointmentAddOnDto`) **v0.3.0 · June 14, 2026** **Add-ons support.** First version with the [Add-Ons](/docs/changelog/add-ons) feature. * `AddonService`, with `CartAddOnItem`, `AppointmentAddOn`, and `OrderAddOnLineItem` types * `StoreService.getStorePublicSettings()` for storefront currency and public store settings **v0.2.0 · June 5, 2026** **Service classes.** Released alongside the public [Storefront API v1](/docs/changelog/storefront-api). * Grouped SDK methods into `*Service` classes by tag (e.g. `ProductService`, `AuthService`, `CartService`) * Stripped the controller prefix from operation IDs (e.g. `ProductService.list()` instead of `productList()`) * Fixed `Auth` operations missing from the spec (tag collision with the admin controller) * Rewrote the README with updated examples and a service table **v0.1.0 → v0.1.2 · 2025** Initial releases of the auto-generated TypeScript client. * **v0.1.0** — auto-generated client, Zod validation schemas, `setupOpencals()` one-line init, API-key/error/logging interceptors, and helpers (`formatPrice`, `formatDuration`, timezone conversion). Full support for products, cart, checkout, customer auth, appointments, orders, and feedback. * **v0.1.1** — renamed `external_domain` → `externalDomain` on `StorePublicSettings`. * **v0.1.2** — renamed `client_secret` → `clientSecret` on `CheckoutStartResponse`. # VOLT — padel & squash template Source: https://opencals.com/docs/changelog/volt-template VOLT, a free open-source multi-club padel and squash booking website template built on the Storefront API — Next.js 15, a live hall map and court grid per club, crew-and-kit checkout, match-ticket confirmations, coach-led training, passwordless accounts. **October 23, 2026** ## VOLT goes multi-club: a live hall map, a crew-and-kit checkout and match tickets VOLT now models a **network of clubs**: four locations (Madrid, Barcelona, Valencia, Málaga), each with its own padel doubles, padel singles and squash courts. The **VOLT Padel & Squash** dataset seeds the whole network. * **Club-first booking, full screen.** `/book` starts from one club: the linked one, the one the browser remembers, or "Near me" from the club coordinates. New visitors pick from photo cards with each club's soonest free court. * **Hall map.** Every court from above, doubles wide and singles narrow, lit for one start time (free, free within the hour, free later, taken). Drag a time bar over the free-courts pulse; "Book 19:30" takes the best free court. * **Grid view.** Courts × half hours, now per club, with the same duration popover. * **One request per club.** A server route reads each court's merged availability once (no per-day or per-cell calls), caches it for 60 seconds and invalidates it on booking, cancel or reschedule; the browser computes the map, grid and "free from" locally. * **Game flow checkout.** Numbered steps with a sticky match card: court (any or exact) → crew (names, email invites as appointment guests, price per player) → kit (add-ons) → details → payment. Trainings use the same flow with level, club, coach, day and places. * **Match-ticket confirmation.** The court from above with a spot per player, a countdown, calendar file, directions, "Same time next week?". * **My games.** Stats, the next game as a ticket, past games with "Book again", crew invites, change time and cancel. * `/preview/[screen]` renders every confirmation and account state from fixtures. [Template docs](/docs/open-source/volt) · [GitHub ↗](https://github.com/letsopencals/template-volt) **September 20, 2026** ## VOLT — open-source padel & squash club booking template The fourth open-source Opencals template is live, and the first one built around **staffless resources** instead of staff-led appointments. **VOLT** is a padel & squash club booking website: the same [Storefront API](/docs/api-reference/introduction) and typed [TypeScript SDK](/docs/guides/storefront-sdk) as [Haar](/docs/changelog/haar-template), [Frisor](/docs/changelog/frisor-template) and [Clear Care](/docs/changelog/clarity-template), with a dark technical design and a different booking shape. Two booking surfaces over one store: an in-page court grid for rentals, and a classic coach-led flow for lessons and group classes. Every screen is built with the public API. * **Multi-court booking grid** — every court and every open slot for a day in one view, with a padel/squash toggle * **Custom durations** — 30-minute steps to two hours, composed from consecutive free slots and priced live * **Staffless resources** — courts use the `Self` rule with `maxAttendees: 1`, so each court is an independent, exclusively-booked unit * **Coach-led training** — filter by sport, level and format; "Any coach — next available" leads the picker; group classes show live "N left" capacity * Add-ons and custom checkout questions, Stripe payments with deposit support * Passwordless customer accounts — 6-digit email login with password fallback, auto-login after checkout, one-time email links via `/link/[token]` * `SportsActivityLocation` structured data, Open Graph, `robots.txt` and `sitemap.xml` configured * Stack: Next.js 15, TypeScript, Tailwind v4, Framer Motion, `@opencals/storefront-sdk` v0.3.14 * MIT licensed — clone, rebrand, deploy. One-click Vercel deploy. If you are booking courts, bays, lanes, studios or rooms rather than people, VOLT is the closest starting point of the four. [Live demo ↗](https://template-volt.vercel.app) · [GitHub ↗](https://github.com/letsopencals/template-volt) · [Template docs](/docs/open-source/volt) # Build a booking page Source: https://opencals.com/docs/guides/build-a-booking-page Step-by-step tutorial: use the Opencals Storefront API with Next.js and the TypeScript SDK to list services, pick a time slot, manage a cart, and complete checkout. This tutorial walks through building a custom booking page on the Opencals Storefront API. We'll use Next.js and the typed [@opencals/storefront-sdk](https://www.npmjs.com/package/@opencals/storefront-sdk), but every step maps 1:1 to plain REST calls — the flow works from any language. The complete booking flow is eight API calls: 1. List services — `GET /storefront/products` 2. Pick a staff member — `GET /storefront/staff-members` 3. Fetch available time slots — `GET /storefront/products/{productId}/current-availabilities` 4. Create an appointment — `POST /storefront/appointments` 5. Add it to a cart — `POST /storefront/cart` and `POST /storefront/cart/items` 6. (Optional) Show and attach add-ons — `GET /storefront/products/{productId}/add-ons` and `POST /storefront/cart/add-ons` 7. (Optional) Apply a promo code — `POST /storefront/cart/discount-code` and `DELETE /storefront/cart/discount-code` 8. Check out — `POST /storefront/cart/checkout/start` and `POST /storefront/cart/checkout/submit` ## Setup Install the SDK in a Next.js project and initialize it once, for example in a small module imported by your server code: ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} npm install @opencals/storefront-sdk ``` ```ts lib/opencals.ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { setupOpencals } from "@opencals/storefront-sdk"; setupOpencals({ apiKey: process.env.OPENCALS_API_KEY, // sfk_… from Settings → API Keys }); ``` > [!WARNING] > > The API key must stay server-side, so the calls below belong in server components, route handlers, or server actions — not client components. **1. List services** `ProductService.list()` wraps `GET /storefront/products` and returns a paginated list of active services: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import "@/lib/opencals"; import { ProductService } from "@opencals/storefront-sdk"; const { data } = await ProductService.list({ query: { take: 50 } }); // data.data → Product[], data.meta → pagination info for (const product of data!.data) { console.log(product.title, product.price, product.duration); } ``` A few product fields drive your UI: | Field | What it means for your booking page | | - | - | | `duration` | Service length in seconds | | `price` | Price (0 = free); `minPrice`/`maxPrice` for variable pricing | | `maxAttendees` | Greater than 1 → show an attendee count selector | | `isCustomDuration` | `true` → show a date-range picker instead of single slots | | `staffMembers` | If populated, let the customer pick a staff member | | `locations` | If populated, let the customer pick a location | **2. Let the customer pick a staff member** If customers choose who they book with, `StaffMemberService.list()` wraps `GET /storefront/staff-members`: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { StaffMemberService } from "@opencals/storefront-sdk"; const { data: staff } = await StaffMemberService.list(); ``` The selected staff member's `id` filters availability in the next step. The same pattern works for locations via `LocationService.list()` (`GET /storefront/locations`) on multi-location stores. **3. Fetch available time slots** `ProductService.getCurrentAvailabilities()` wraps `GET /storefront/products/{productId}/current-availabilities`. It takes a required `date` (`YYYY-MM-DD`) plus optional `staffMemberId`, `locationId`, and `timezone` filters: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { ProductService } from "@opencals/storefront-sdk"; const { data: slots } = await ProductService.getCurrentAvailabilities({ path: { productId: product.id }, query: { date: "2026-06-15", staffMemberId: selectedStaff?.id, timezone: "America/New_York", }, }); ``` Render the returned slots as your time picker. > [!NOTE] > > For custom-duration products (`isCustomDuration: true`, e.g. rentals or venue hire), use `GET /storefront/products/{productId}/current-availability-ranges` and show a date-range picker instead. There's also `GET /storefront/products/{productId}/nearest-availability` for "next available slot" badges on service cards. **4. Create the appointment** When the customer picks a slot, create an appointment with `POST /storefront/appointments`. The required `slot` object carries the product and the UTC date/time range; `staffMemberId` and `locationId` are optional: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { AppointmentService } from "@opencals/storefront-sdk"; const { data: appointment } = await AppointmentService.create({ body: { slot: { productId: product.id, fromDate: "2026-06-15", fromTime: "14:00:00", toDate: "2026-06-15", toTime: "15:00:00", staffMemberId: selectedStaff?.id ?? null, locationId: null, }, numberOfAttendees: 1, }, }); ``` > [!WARNING] > > All slot date/times are **UTC** — convert from the customer's timezone before sending. **5. Cart** Carts hold appointments between slot selection and payment, and they expire after the store's hold window (15 minutes by default) so abandoned selections release their slots. Cart endpoints identify the cart with the `X-Cart-Id` header: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { CartService } from "@opencals/storefront-sdk"; // Create a cart (or fetch the existing one if you already have an ID) const { data: cart } = await CartService.createOrGet({ headers: { "X-Cart-Id": existingCartId ?? "" }, }); // Add the appointment to it const { data: updatedCart } = await CartService.addItem({ body: { appointmentId: appointment!.id }, headers: { "X-Cart-Id": cart!.id }, }); ``` Persist `cart.id` (for example in a cookie) so the customer keeps their cart across pages. If checkout takes a while, `POST /storefront/cart/extend` moves the expiration to at least five minutes from now. Extending never shortens a longer window, and starting checkout does the same with the full hold window. **6. Show and attach add-ons (optional)** If the service has add-ons (extras like equipment rentals, upgrades, or accessories), fetch them and let the customer choose before proceeding to payment. ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { AddOnService, CartService } from "@opencals/storefront-sdk"; // Fetch add-ons available for the booked service const { data: addOns } = await AddOnService.listForProduct({ path: { productId: product.id }, }); // addOns.data → AddOn[] with title, description, price, durationMultiplied, maxQuantity ``` When the customer selects an add-on, attach it to the cart item: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} await CartService.addAddOn({ body: { cartItemId: updatedCart!.items[0].id, addOnId: selectedAddOn.id, quantity: 1, }, headers: { "X-Cart-Id": cart!.id }, }); ``` Add-on pricing fields: | Field | What it means | | - | - | | `price` | Unit price. Multiply by quantity for the line total. | | `durationMultiplied` | If `true`, quantity is auto-set to the service duration units (e.g., 3 days = quantity 3). Don't ask the customer for quantity. | | `maxQuantity` | If non-null, cap your quantity input at this value. | > [!NOTE] > > Skip this step if `addOns.data` is empty — not every service has add-ons configured. **7. Apply a promo code (optional)** If the store offers discount codes, let customers enter a promo code before checkout. `CartService.applyDiscountCode()` wraps `POST /storefront/cart/discount-code`: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { CartService } from "@opencals/storefront-sdk"; try { const { data: updatedCart } = await CartService.applyDiscountCode({ body: { code: "SUMMER15" }, headers: { "X-Cart-Id": cart!.id }, }); // updatedCart now includes applied discounts } catch (error) { // Handle typed errors: CODE_NOT_FOUND | CODE_EXPIRED | CODE_DISABLED | CODE_LIMIT_REACHED | CODE_CUSTOMER_INELIGIBLE | CODE_NO_MATCHING_ITEMS // Render inline below the input (Shopify-style red) } ``` Remove a code with `DELETE /storefront/cart/discount-code`: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} await CartService.removeDiscountCode({ headers: { "X-Cart-Id": cart!.id }, }); ``` ### Reading applied discounts Every cart-returning endpoint now includes `appliedDiscounts[]` and per-line-item `discounts[]` fields. Show a "You saved \$X" summary by subtracting the cart's `total` from the sum of original line prices: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} const originalTotal = updatedCart!.items.reduce( (sum, item) => sum + item.originalPrice * item.quantity, 0 ); const saved = originalTotal - updatedCart!.total; ``` **8. Checkout** Checkout is a three-call sequence against the same `X-Cart-Id`. **Start** validates the cart and initializes payment with your chosen provider (list configured providers with `GET /storefront/payment/providers`): ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { CheckoutService } from "@opencals/storefront-sdk"; const { data: checkout } = await CheckoutService.start({ body: { provider: "stripe" }, headers: { "X-Cart-Id": cart!.id }, }); // Stripe: checkout.clientSecret → confirm with Stripe Payment Element // Redirect providers: checkout.redirectUrl → send the customer there ``` **Save the customer** so the order and appointments have contact details (guests don't need an account): ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} await CheckoutService.saveCustomer({ body: { customer: { email: "jane@example.com", firstName: "Jane", lastName: "Doe", }, }, headers: { "X-Cart-Id": cart!.id }, }); ``` If the store has custom checkout questions, fetch them with `GET /storefront/cart/checkout/questions/{language}` and save answers via `POST /storefront/cart/checkout/save-answers`. **Submit** captures the payment and creates the order: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} const { data: result } = await CheckoutService.submit({ body: { stripePaymentIntentId: paymentIntentId }, // if confirmed client-side with Stripe headers: { "X-Cart-Id": cart!.id }, }); // result.order → the order that was placed // result.auth → tokens when this checkout created the customer or the request is signed in as them // result.paymentInstructions → how to pay when nothing was charged at checkout (invoice link, bank details) ``` The response includes the created `order` and, for new customers, an `auth` token pair you can use to sign them in automatically — see [Authentication](/docs/authentication). If the email belongs to an existing customer and the request isn't signed in as them, the booking is still added to that customer's account, but `auth` is omitted and their saved profile (name, phone, marketing consent) isn't changed. The billing and delivery addresses entered are added to the customer's saved addresses once the order is placed; `save-customer` and `checkout/start` don't write them. The customer sees the booking after signing in (for example with a login code). Always treat `auth` as optional. > [!NOTE] > > For pay-at-venue stores, start checkout with `provider: "cash"` and submit directly with no payment confirmation step. #### Pay later: invoices and bank transfer `bank_transfer` and `stripe_invoice` work like `cash`: start checkout with the provider and submit without a payment step. The customer pays afterwards. `stripe_invoice` is only listed when the store has Stripe connected, and its display name for customers is "Pay by invoice". For these orders the submit response has an optional `paymentInstructions` object. Show it on your confirmation page: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} const instructions = result.paymentInstructions; if (instructions?.hostedInvoiceUrl) { // stripe_invoice: link to the Stripe-hosted invoice page ("Pay invoice") } if (instructions?.bankDetails) { // bank_transfer: accountName, bankName, iban, swift (any of them may be null) } if (instructions?.dueAt) { // ISO date-time. If nothing is paid by then, the store cancels the booking or reviews it. } ``` | Field | Type | Notes | | - | - | - | | `provider` | string | The payment method the order was placed with, for example `stripe_invoice` or `bank_transfer`. | | `hostedInvoiceUrl` | string \| null | Stripe-hosted invoice page. Only for `stripe_invoice`. | | `dueAt` | string \| null | When payment is due. Null when the store has no payment deadline. | | `bankDetails` | object \| null | `accountName`, `bankName`, `iban`, `swift`. Only for `bank_transfer`. | The field is missing for orders paid at checkout, so treat it as optional. The customer also gets the invoice link or bank details by email. #### Booking status after checkout The store decides when a booking is confirmed. Many stores confirm every booking straight away; others only confirm bookings that meet their conditions (for example, paid in time or booked far enough ahead) and review the rest. Until a booking is confirmed, the order's appointments have `status: "pending"`, which means **awaiting confirmation**, and `pendingReason` says why: | `pendingReason` | Meaning | | - | - | | `awaiting_payment` | The booking is confirmed once the order is paid, for example a bank transfer, cash or Stripe invoice that isn't paid yet. | | `awaiting_approval` | The merchant still has to confirm the booking. A paid booking can still be awaiting approval. | The order's `paymentDueAt` says when an unpaid booking stops waiting for payment: it is then cancelled or handed to the merchant to review, depending on the store. Cash orders never have one. `approvalDueAt` says when a booking still awaiting approval is cancelled. Without these deadlines, a pending booking just stays pending. A pending appointment becomes `scheduled` when it's confirmed, or `canceled` when the merchant declines it, a deadline passes or the order is cancelled. The appointment's `cancelReason` is then `unpaid`, `not_approved`, `declined` or `order_cancelled` (the whole order was cancelled, for example on Shopify). The order gets `cancelledAt` and its own `cancelReason`: `unpaid`, `not_approved`, `declined`, `external` or `customer`. Don't show a pending booking as confirmed: say "Awaiting payment" or "Awaiting confirmation" instead. #### Checkout conflicts (409) `start` and `submit` answer **409** with an error `code` when the cart can't be checked out: | `code` | Meaning | What to do | | - | - | - | | `CART_EXPIRED` | A held time is gone. `start` and `submit` first revive an expired cart, re-holding every slot that is still free, so this only happens when someone else took a slot. | Start a new cart and ask the customer to pick another time. | | `CART_ALREADY_CHECKED_OUT` | `start` only: the cart is already an order. The body has its `orderId`. | Show that order's confirmation. | | `CHECKOUT_IN_PROGRESS` | Another `start` or `submit` of the same cart (a double click, a second tab) is still running. | Keep the cart, tell the customer the booking is being processed, and retry `submit` shortly. It returns the order once it exists. | #### Unauthorised card payment (402) `submit` answers **402** with `code: PAYMENT_NOT_AUTHORIZED` and the provider's `paymentStatus` (for example `requires_payment_method` after a decline, or `requires_action` when 3-D Secure wasn't completed). No order is placed and the cart is unchanged: show the card error, let the customer confirm the payment again or use another card, then call `submit` again. ## After the booking With a customer token you can power a full self-service portal: * `GET /storefront/appointments` — list the customer's appointments * `PUT /storefront/appointments/{appointmentId}/reschedule` — move a booking * `PUT /storefront/appointments/{appointmentId}/cancel` — cancel it * `GET /storefront/orders` — order history with payments and refunds ## Skip the boilerplate If you'd rather start from working code, Opencals publishes free open-source Next.js booking templates built on this exact flow — browse them at [open-source/templates](https://opencals.com/docs/open-source/templates) or clone the [Haar salon template](https://github.com/letsopencals/template-haar). For the full endpoint catalog, head to the [API reference](/docs/api-reference/introduction). # Customer email links (magic links) Source: https://opencals.com/docs/guides/customer-email-links Set up passwordless email links for customer actions: view/reschedule/cancel appointments, leave feedback, verify email, and reset passwords. No additional code — just configure one setting and implement one route. Customer email links let your customers interact with their bookings directly from email. When Opencals sends an appointment confirmation, feedback request, or password reset, the link in the email takes them directly to the right page — signed in automatically. This guide is for merchants building custom frontends with the Opencals Storefront SDK. If you use the multi-tenant Opencals storefront (salon.opencals.com), no setup is needed. ## Overview All customer email links follow the same pattern: * Every link is `{storefrontBaseUrl}/link/{token}` * Your app implements one route: `GET /link/{token}` * The route calls `Auth.resolveLink(token)` to get the customer's action and redirect target * You sign the customer in (if tokens are provided) and redirect them ## Setup ### Step 1: Set the `storefrontBaseUrl` Setting In the Opencals dashboard, go to **Settings → API → Storefront Base URL** and enter your app's base URL: ``` https://mybooking.example.com ``` This tells Opencals where to send customer email links. If you don't set it, Opencals will fall back to the store's domain, and links may not reach your custom frontend. ### Step 2: Implement the `/link/{token}` Route Your app must handle `GET /link/{token}`. Here's an example with Next.js: ```ts app/link/[token]/page.tsx theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { redirect } from "next/navigation"; import { setupOpencals, AuthService } from "@opencals/storefront-sdk"; // Ensure SDK is initialized (your server config should call setupOpencals once at startup) setupOpencals(); export default async function MagicLinkPage({ params }: { params: { token: string } }) { try { // Resolve the token: validates it, signs the customer in, and returns redirect info const { data: response } = await AuthService.resolveLink({ query: { token: params.token } }); if (!response) { return
Invalid or expired link
; } const { redirectPath, accessToken, refreshToken, requiresAction } = response; // If tokens are provided, save them for future requests if (accessToken && refreshToken) { // Option 1: Store in an httpOnly cookie (recommended) // You can set this via a server action or route handler // Option 2: Redirect to a handler that stores tokens and redirects // This avoids passing tokens in the URL } // Redirect the customer to their action redirect(redirectPath || "/account"); } catch (error) { return
This link has expired or is invalid
; } } ``` For production, store the tokens securely (httpOnly cookies) and redirect via a handler: ```ts app/api/auth/link/route.ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { cookies } from "next/headers"; import { setupOpencals, AuthService } from "@opencals/storefront-sdk"; setupOpencals(); export async function GET(req: Request) { const { searchParams } = new URL(req.url); const token = searchParams.get("token"); if (!token) { return new Response("Missing token", { status: 400 }); } try { const { data: response } = await AuthService.resolveLink({ query: { token } }); if (response?.accessToken) { const cookieStore = await cookies(); cookieStore.set("accessToken", response.accessToken, { httpOnly: true, secure: true, sameSite: "lax", maxAge: 3600, // 1 hour }); if (response.refreshToken) { cookieStore.set("refreshToken", response.refreshToken, { httpOnly: true, secure: true, sameSite: "lax", maxAge: 604800, // 7 days }); } } return Response.redirect(response?.redirectPath || "/account"); } catch (error) { console.error("Link resolution failed:", error); return new Response("Invalid or expired link", { status: 400 }); } } ``` ## Purpose → Redirect Table This table shows what each link type does and where the customer is redirected: | Purpose | Customer Receives | Redirect Path | Tokens Provided? | | - | - | - | - | | `view-appointment` | Link from confirmation email | `/account/appointments/{id}/view` | Yes (auto sign-in) | | `cancel-appointment` | Link to cancel or reschedule | `/account/appointments/{id}/view?action=cancel` | Yes (auto sign-in) | | `reschedule-appointment` | Link to reschedule | `/account/appointments/{id}/view?action=reschedule` | Yes (auto sign-in) | | `leave-feedback` | Link to leave a review | `/account/appointments/{id}/view?action=feedback` | Yes (auto sign-in) | | `verify-email` | Link to confirm email address | `/account` | Yes (auto sign-in) | | `reset-password` | Link to reset forgotten password | `/auth/reset-password?token={token}` | No (tokens passed separately) | ## Special Case: Password Reset Password reset links do **not** return customer tokens. Instead, the token is passed as a query parameter so your app can verify it when the customer submits a new password. ### Example: Password Reset Handler ```ts app/auth/reset-password/page.tsx theme={"theme":{"light":"github-light","dark":"github-dark-default"}} "use client"; import { useState } from "react"; import { useSearchParams } from "next/navigation"; import { AuthService } from "@opencals/storefront-sdk"; export default function ResetPasswordPage() { const searchParams = useSearchParams(); const token = searchParams.get("token"); const [password, setPassword] = useState(""); const [error, setError] = useState(null); const [loading, setLoading] = useState(false); if (!token) { return
Invalid reset link
; } const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setError(null); try { // Call the API with the token from the URL await AuthService.resetPassword({ body: { token, newPassword: password } }); // Password reset successful — redirect to sign-in window.location.href = "/auth/sign-in?success=Password%20reset%20successful"; } catch (err: any) { setError(err.message || "Failed to reset password"); } finally { setLoading(false); } }; return (
setPassword(e.target.value)} placeholder="New password" required /> {error &&
{error}
}
); } ``` ## Passwordless Email Login (Optional) In addition to email links, you can offer passwordless login with 6-digit codes: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} // 1. Customer requests a code await AuthService.requestLoginCode({ body: { email: "customer@example.com" } }); // Email is sent with 6-digit code // 2. Customer enters the code const { data: tokens } = await AuthService.verifyLoginCode({ body: { email: "customer@example.com", code: "123456" } }); // 3. Tokens are returned — sign them in ``` The code expires in 5 minutes and allows 5 failed attempts before a new code must be requested. ## SDK Methods The following SDK methods are used for email links and passwordless auth: | Method | Purpose | | - | - | | `AuthService.resolveLink({ query: { token } })` | Validate and resolve a magic link token | | `AuthService.resetPassword({ body: { token, newPassword } })` | Reset password with token | | `AuthService.requestLoginCode({ body: { email } })` | Send 6-digit code to email | | `AuthService.verifyLoginCode({ body: { email, code } })` | Verify code and get tokens | See the [API reference](/docs/api-reference/introduction) for full request and response schemas. ## Security Checklist * Store API keys in environment variables — never in client code. * Call `resolveLink` on the server, not the client. * Store customer tokens in **httpOnly cookies** (not localStorage) when possible. * Redirect after storing tokens to avoid exposing them in the URL. * For password reset, store the token as a query parameter only (it does not grant authentication). * Tokens expire according to their purpose (1 hour for verify-email/reset-password, 7 days for leave-feedback, 24 hours default). ## Troubleshooting **"Invalid or expired link"** * The token may have been used already (one-time use only). * The token may have expired (check the purpose expiry in the earlier table). * The store context may not match the API key's store. **Customer not signed in after clicking the link** * Verify tokens were stored (httpOnly cookies, session, etc.). * Check that `AuthService.resolveLink` returned `accessToken` and `refreshToken`. * For `reset-password` links, no sign-in occurs — the customer must reset their password and sign in manually. **Password reset token not working** * The token is included in the URL query string only, not in the API call. * Pass it to `AuthService.resetPassword({ body: { token, newPassword } })` exactly as received. # Storefront SDK Source: https://opencals.com/docs/guides/storefront-sdk Install and use @opencals/storefront-sdk — the type-safe TypeScript client for the Opencals booking API, generated from the OpenAPI spec with Zod schemas and helpers included. [@opencals/storefront-sdk](https://www.npmjs.com/package/@opencals/storefront-sdk) is the official type-safe TypeScript client for the Storefront API. It's generated from the same OpenAPI specification as the [API reference](/docs/api-reference/introduction), so every request and response is fully typed, and it ships with Zod schemas for runtime validation plus formatting helpers for prices, durations, and timezones. MIT licensed. ## Installation ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} npm install @opencals/storefront-sdk ``` ## Setup Call `setupOpencals()` once at app startup — a root layout, an API client singleton, or a module you import from your server code: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { setupOpencals } from "@opencals/storefront-sdk"; setupOpencals({ apiKey: "spk_…", // or set the OPENCALS_API_KEY env var baseUrl: "https://…", // optional, defaults to https://api.opencals.com logging: true, // optional request/response logging errorHandler: true, // throw OpencalsApiError on failures (default) customerToken: "eyJ…", // optional customer JWT for authenticated requests buyerIp: nextBuyerIp, // optional, server-side: the visitor's IP (see below) }); ``` With the `OPENCALS_API_KEY` environment variable set, `setupOpencals()` needs no arguments. ### Which API key There is one key setting; the kind of key depends on where the SDK runs: * **On a server** (Next.js server components, route handlers, server actions, serverless functions): a **private storefront key** (`spk_`). It stays secret and can forward the buyer's IP. * **In the browser** (embedded widgets, client-side apps): a **public storefront key** (`sfk_`) with allowed origins set to your domains. Don't put a private key in browser code: anyone could read and reuse it. The SDK warns if you pass one there. See [API keys](/docs/authentication#api-keys) for details. ### Forward the buyer's IP On a server, every SDK request comes from your server's IP, so all your visitors share one rate-limit budget and abuse protection can't tell them apart. Pass `buyerIp`, a function that returns the IP of the visitor a request is for, and the SDK sends it as `X-Opencals-Buyer-Ip`. With a private key the API then counts per visitor. **Next.js** apps use the ready-made resolver from `@opencals/storefront-sdk/next`: ```ts lib/opencals.ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { setupOpencals } from "@opencals/storefront-sdk"; import { nextBuyerIp } from "@opencals/storefront-sdk/next"; setupOpencals({ apiKey: process.env.OPENCALS_API_KEY, // spk_… buyerIp: nextBuyerIp, }); ``` `nextBuyerIp` reads `x-real-ip`, else the first `x-forwarded-for` entry (Vercel sets both on every request and overwrites what the browser sends). It forwards only on mutations (sign-in, cart, checkout), because reading request headers while rendering a GET would make cached pages dynamic. Outside a request it returns nothing. All the [open-source templates](/docs/open-source/templates) use it. **Other frameworks or proxies:** pass your own function. It gets `{ method, url }` and returns the visitor's IP from the header your host sets (for example `cloudfront-viewer-address` on CloudFront), never from the request body: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} setupOpencals({ apiKey: process.env.OPENCALS_API_KEY, buyerIp: ({ method }) => (method === "GET" ? undefined : getVisitorIp()), }); ``` * The function runs for every request; return nothing to skip one. * A per-call `headers: { "X-Opencals-Buyer-Ip": ip }` takes precedence, and a function that throws never fails the request. * With a public key (`sfk_`) the header is ignored. Available from SDK 0.3.19. ## Services The SDK mirrors the API's tags as static service classes: | Service | Methods | | - | - | | `ProductService` | `list`, `get`, `getBySlug`, `getByExternalId`, `getCurrentAvailabilities`, `getCurrentAvailabilitiesMerged`, `getNearestAvailability` | | `AuthService` | `signIn`, `signUp`, `oauth`, `refresh`, `requestPasswordReset`, `resetPassword`, `requestEmailVerification`, `verifyEmail` | | `CartService` | `get`, `createOrGet`, `addItem`, `removeItem`, `extendExpiration`, `applyCode`, `removeCode` | | `CheckoutService` | `start`, `submit`, `saveCustomer`, `saveAnswers`, `getCartQuestions` | | `AppointmentService` | `list`, `find`, `create`, `cancel`, `reschedule`, `feedback`, `getBookingPreferences` | | `OrderService` | `list`, `find` | | `SelfService` | `getProfile`, `updateProfile`, `changePassword` | | `LocationService` | `list`, `get`, `getBySlug` | | `StaffMemberService` | `list`, `getBySlug` | | `PaymentService` | `getAvailableProviders`, `getSettings` | | `StoreService` | `getStorePublicSettings` | | `ProductCollectionService` | `list`, `getBySlug` | | `ImageService` | `get` | | `CheckoutQuestionService` | `listTranslations` | | `FeedbackQuestionService` | `listTranslations` | Every method takes a single options object with typed `path`, `query`, `body`, and `headers` fields matching the underlying endpoint: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { ProductService } from "@opencals/storefront-sdk"; // GET /storefront/products/slug/{slug} const { data: product } = await ProductService.getBySlug({ path: { slug: "haircut" }, }); // GET /storefront/products/{productId}/current-availabilities const { data: slots } = await ProductService.getCurrentAvailabilities({ path: { productId: product!.id }, query: { date: "2026-06-15", timezone: "America/New_York" }, }); ``` Cart and checkout calls pass the cart ID through the typed `headers` field: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { CartService } from "@opencals/storefront-sdk"; const { data: cart } = await CartService.createOrGet({ headers: { "X-Cart-Id": cartId ?? "" }, }); await CartService.addItem({ body: { appointmentId }, headers: { "X-Cart-Id": cart!.id }, }); ``` ## Customer-authenticated requests For endpoints that act on behalf of a signed-in customer, either pass `customerToken` to `setupOpencals()` or set the header per call: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { AppointmentService } from "@opencals/storefront-sdk"; const { data: appointments } = await AppointmentService.list({ headers: { Authorization: `Bearer ${accessToken}` }, }); ``` See [Authentication](/docs/authentication) for how to obtain and refresh customer tokens. ## Error handling With the default error handler enabled, failed requests throw a typed `OpencalsApiError`: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { OpencalsApiError, ProductService } from "@opencals/storefront-sdk"; try { await ProductService.get({ path: { productId: "missing" } }); } catch (error) { if (error instanceof OpencalsApiError) { console.error(error.status, error.message); } } ``` `error.code` carries the API's machine-readable reason when there is one, for example `CODE_EXPIRED` or `CODE_NOT_FOUND` when a discount code is rejected (SDK 0.3.19+). `error.toFieldErrors()` flattens validation errors into `{ field: message }` for forms. ## Zod validation Response types come with auto-generated Zod schemas, useful when data crosses a trust boundary (for example, after passing through your own API routes): ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { zProductListResponse } from "@opencals/storefront-sdk"; const result = zProductListResponse.safeParse(apiResponse); ``` ## Helpers The SDK includes small utilities you'd otherwise rewrite in every booking UI: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { formatPrice, formatDuration, toLocalFromUtc, toUtcFromLocal, mergeTimeIntervals, } from "@opencals/storefront-sdk"; formatPrice(4500, "USD"); // "$45.00" formatDuration(3600); // "1h" toLocalFromUtc("2026-06-15T14:00:00Z", "America/New_York"); ``` `toLocalFromUtc` / `toUtcFromLocal` handle the UTC conversion the API expects for appointment slots, and `mergeTimeIntervals` is handy when rendering availability ranges. ## Examples The [Build a booking page](/docs/guides/build-a-booking-page) tutorial walks through a full implementation, and the open-source [booking templates](https://opencals.com/docs/open-source/templates) are complete Next.js apps you can fork. # Webhooks Source: https://opencals.com/docs/guides/webhooks The planned Opencals webhook event catalog for booking automations — and how to keep a headless booking site in sync today with polling and revalidation. > [!WARNING] > > **Webhooks are not yet available.** This page documents the planned design so you can prepare your integration architecture. Event names and payload shapes may change before release. Until webhooks ship, booking events (created, rescheduled, cancelled, completed, feedback shared) are available today through the [Opencals Zapier integration](https://opencals.com/guides/how-to-automate-bookings-with-zapier), and the [polling and revalidation patterns](#keeping-data-fresh-today) below cover custom code. Webhooks will let Opencals notify your application the moment something happens in your store — a booking is created, an order is paid, a customer cancels — so you can automate without polling. ## Planned events The first release focuses on the six events that power the most common merchant automations: | Event | Fires when | Common use cases | | - | - | - | | `appointment.created` | A booking is confirmed (a booking waiting for payment or approval fires once it's confirmed) | CRM sync, welcome and confirmation flows | | `order.paid` | Payment is captured for an order | Fulfillment, accounting entries | | `appointment.canceled` | A booking is canceled | Waitlist backfill, freeing resources | | `appointment.rescheduled` | A booking is moved to a new slot | Calendar updates, staff notifications | | `appointment.completed` | A booking's end time passes | Review requests, follow-up sequences | | `order.refunded` | A refund is issued on an order | Accounting corrections, inventory release | ## How delivery will work A webhook is an HTTP `POST` from Opencals to an endpoint you host. Each delivery: * is sent as JSON to the URL you register, * identifies its event type so one endpoint can handle many events, * is **signed**, so you can verify the request really came from Opencals, * expects a `2xx` response. Non-2xx responses are treated as failures and retried with backoff, so make your handler idempotent — the same event may be delivered more than once. Respond quickly (acknowledge first, process asynchronously) to avoid timeouts on slow handlers. ### Verifying signatures Deliveries will follow the standard HMAC pattern: a signature header computed over the **raw request body** with your endpoint's secret. The verification you'd write today won't change: ```ts theme={"theme":{"light":"github-light","dark":"github-dark-default"}} import { createHmac, timingSafeEqual } from "node:crypto"; export function verifyWebhookSignature( rawBody: string, signatureHeader: string, secret: string, ): boolean { const expected = createHmac("sha256", secret).update(rawBody).digest("hex"); const a = Buffer.from(expected); const b = Buffer.from(signatureHeader); return a.length === b.length && timingSafeEqual(a, b); } ``` > [!NOTE] > > Verify against the raw, unparsed request body — re-serialized JSON can reorder keys and break the comparison. In Next.js route handlers, use `await request.text()` before parsing. ## Keeping data fresh today Until webhooks ship, these patterns keep an integration accurate: * **Use Zapier for booking events.** The [Opencals Zapier app](https://opencals.com/guides/how-to-automate-bookings-with-zapier) fires when an appointment is created (that is, confirmed: immediately with automatic confirmation, otherwise after payment or approval), rescheduled, cancelled or completed, or when a customer shares feedback. A Zapier "Webhooks by Zapier" action can forward any of these to your own endpoint. * **Poll customer-scoped endpoints on your own schedule.** `GET /storefront/appointments` and `GET /storefront/orders` return current state, so a periodic sync job covers CRM, accounting, and follow-up automations. Respect the [rate limits](/docs/quickstart#rate-limits) — a sync every few minutes is well within them. * **Time-based revalidation for catalog data.** Products, staff, and locations change rarely — Next.js ISR (`revalidate`) or a short CDN cache of a few minutes is usually enough for a headless booking site. * **Always fetch availability live.** Time slots change with every booking, so call the availability endpoints at request time rather than caching them. The booking flow is also self-correcting: `POST /storefront/cart/checkout/start` re-validates every cart item and reports invalid ones before any payment is taken. ## Related * [Build a booking page](/docs/guides/build-a-booking-page) — where cached catalog data and live availability fit in the flow. * [API reference](/docs/api-reference/introduction) — every endpoint the planned events map to. # Introduction Source: https://opencals.com/docs/introduction The Opencals Storefront API is booking infrastructure for builders — a REST API for services, real-time availability, carts, checkout, and payments, so you can build a fully custom booking experience on any stack. Opencals is a **standalone-first booking platform**: the dashboard runs your scheduling, staff, services, and payments, and the **Storefront API** exposes all of it over REST so you can build the customer-facing side yourself — your own booking page, your own stack, your own design. Think of it as booking infrastructure for builders. Opencals handles the scheduling engine, payments, and conflict prevention — you keep full control of the front end. ## What you can build * A custom booking page on your existing website, in any framework * A headless booking site generated statically and revalidated on demand * A customer self-service portal — appointments, rescheduling, cancellations, order history * Anything else that needs services, time slots, and checkout as an API If you can configure it in the dashboard, you can read it over the API. ## Start here > [card] [Quickstart](/docs/quickstart) > > Get an API key and make your first request in a few minutes. > [card] [Build a booking page](/docs/guides/build-a-booking-page) > > The full flow — services, availability, cart, and checkout — with Next.js and the TypeScript SDK. > [card] [API reference](/docs/api-reference/introduction) > > Every endpoint, parameter, and response shape, with an interactive playground. > [card] [Storefront SDK](/docs/guides/storefront-sdk) > > The typed TypeScript client, generated from the same OpenAPI spec as these docs. ## Skip the boilerplate If you'd rather start from working code, Opencals publishes free open-source booking templates built on this exact API — browse them at [opencals.com/docs/open-source/templates](https://opencals.com/docs/open-source/templates). # Alba Dental — dental group template Source: https://opencals.com/docs/open-source/alba Free, open-source dental practice website template. Next.js 15, five London studios plus video consultations, 26 clinicians, a Smile Check questionnaire on a 32-tooth chart, a chair-time booking planner with the hygienist straight after, a flippable appointment card, a recall ring in the patient account, and Alba Kids, a cut-paper children's site, built on the Opencals Storefront API. A complete dental group website you can clone and deploy today. Alba Dental is built for **multi-location clinics with many clinicians**: five studios, each with its own hours and team, dentists, hygienists and specialists booked by name or "first available", and a children's site of its own. Start here for a dental practice, an orthodontist, a physio or any clinic group. It runs on the same [Storefront API](/docs/api-reference/introduction) and typed [TypeScript SDK](/docs/guides/storefront-sdk) as [Haar](/docs/open-source/haar), [Frisor](/docs/open-source/frisor), [Clear Care](/docs/open-source/clarity), [VOLT](/docs/open-source/volt), [NOIR Drive](/docs/open-source/noir), [Fluently](/docs/open-source/fluently), [Bali Villa Rentals](/docs/open-source/bali-villas) and [Tensile](/docs/open-source/reformer). It's set in London (GBP, `Europe/London`) with studios in Marylebone, Shoreditch, Notting Hill, Canary Wharf and Clapham, video consultations, and 26 clinicians. The design is light and precise: porcelain and enamel, deep lagoon teal, mint light and brass hairlines, with dental-chart annotations throughout. > [card] [Live demo](https://template-alba.vercel.app) > > template-alba.vercel.app > [card] [Source code](https://github.com/letsopencals/template-alba) > > letsopencals/template-alba (MIT) > [card] [Deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-alba\&env=OPENCALS_API_KEY,AUTH_SECRET\&envDescription=API%20key%20from%20your%20Opencals%20dashboard%20and%20a%20random%20secret%20for%20auth\&project-name=alba-dental\&repository-name=template-alba) > > One-click deploy > [card] [Build it with AI](/docs/ai-agents/build-booking-site-skill) > > build-booking-site skill ![Alba Dental website template on a laptop and the Alba Kids picture book on a phone, on a limestone desk in a dental studio](https://raw.githubusercontent.com/letsopencals/template-alba/main/docs/cover.png) Alba Dental — the site on desktop, Alba Kids on mobile ![Alba Dental template live board listing five London studios with their status and next free times](https://raw.githubusercontent.com/letsopencals/template-alba/main/docs/today-board.png) Today at Alba — every studio's status and next free check-up and hygiene time ## Smile Check A short questionnaire on a real 32-tooth chart (FDI numbering). Patients tap the teeth on their mind, say what's going on and set a **comfort dial** from calm to anxious. Alba suggests the visit and the studio with the soonest time, then opens the booking with everything filled in. The comfort level reaches the dentist as a pre-visit answer. ![Alba Dental template Smile Check with three front teeth selected, a concern and a comfort dial](https://raw.githubusercontent.com/letsopencals/template-alba/main/docs/smile-check.png) Smile Check — the tooth chart, the chart note and the comfort dial ## The chair planner One screen. The visit is drawn to scale on a **chair-time track**: each treatment is a block as long as its minutes, add-ons hang off it, and after a check-up the **hygienist straight after** snaps on as a second block (a second appointment in the cart, same chair). The studio is picked on the Alba Line with each station's next free time, the clinician from portrait strips or "First available", then a day and a time. The track is the summary. ![Alba Dental template booking page with a check-up block and a hygiene block on a minute ruler](https://raw.githubusercontent.com/letsopencals/template-alba/main/docs/chair-planner.png) The chair planner — a check-up and the hygienist straight after on the chair-time track ![Alba Dental template confirmation shown as a dental appointment card, with a six-month recall planner below](https://raw.githubusercontent.com/letsopencals/template-alba/main/docs/thank-you.png) The appointment card — date, time, clinician and patient, with what to bring on the back ## Alba Kids A separate children's site at `/kids` with its own type, colours and navigation: a picture book in cut paper and risograph inks, drawn in SVG and CSS. Every children's service from the store is a stop on a board-game road through Tooth Town. There's a two-minute brushing game (**Sugar Bug Scrub**), the kids team as a scrapbook, a questionnaire for parents written as a story (**Tooth Quest**), and a printable certificate of bravery after a child's visit. ![Alba Kids children's dental page drawn as a cut-paper picture book with a tooth character in a cape](https://raw.githubusercontent.com/letsopencals/template-alba/main/docs/kids-cover.png) Alba Kids — Pip and the Tooth Town adventure ![Alba Kids board-game road with paper buildings for each children's dental service](https://raw.githubusercontent.com/letsopencals/template-alba/main/docs/kids-road.png) The road through Tooth Town — every kids service as a stop, with price, length and ages ## The clinic model This is the part worth copying even if you never ship Alba itself. It uses existing Opencals features only. | Piece | How it's modelled | | - | - | | A studio | A location with its own opening hours; video consultations are an `ONLINE` location | | A department (hygiene, cosmetic, children's dentistry) | A collection, mapped to its presentation in `lib/site-config.ts` | | A treatment and its options | A product group with variants (hygiene clean / deep clean / AirFlow; kids check-up by age band) | | Who can do it, and where | Staff on the product; a treatment is offered at the studios where its clinicians work, so children's services only appear where there's a kids room | | First available | Every clinician's free windows for the whole booking window, read once per studio and treatment and cached for 60 s; the board, day strip and times are derived from it | | The hygienist straight after | A second appointment in the cart, starting when the first ends | | Happy air, fluoride varnish, AirFlow polish, X-rays | Add-ons | | Who the visit is for, comfort level, a child's nickname | Checkout questions matched by `internalName`, answered per visit, so a family cart keeps each patient apart | | `NEWSMILE`, early-bird hygiene | A code for 20% off a new patient exam, and an automatic 15% off hygiene visits starting before 9:00 on weekdays | | Change or cancel | Customer reschedule and cancel up to 24 hours before | ## What's inside ![Alba Dental template account page with a recall ring, an appointment card, a visit history and a children's stamp passport](https://raw.githubusercontent.com/letsopencals/template-alba/main/docs/account.png) My Smile — the recall ring, the next appointment card, history and the kids stamp passport ![Alba Dental template on four phone screens](https://raw.githubusercontent.com/letsopencals/template-alba/main/docs/mobile.png) Mobile — home, the chair planner, the appointment card and Alba Kids | Feature | Notes | | - | - | | Home | Porcelain tooth hero, the live studio board, a numbered treatment price index, Smile Check, the Alba Line of studios, the team, patient notes, Alba Kids and FAQ | | Smile Check | Tooth chart, concerns, comfort dial, a suggested visit and the soonest studio | | Chair planner | Treatment, studio, clinician or first available, day and time, extras, the patient; the hygienist straight after as a second block | | Treatments, studios, dentists | A price list in writing, studio pages with hours and the next free chair, 26 clinicians filtered by studio, speciality and language | | Checkout | A single patient record: details, Stripe or pay at the studio, a promo code | | Confirmation | A flippable appointment card, add to calendar, and a six-month recall reminder | | Accounts | Passwordless 6-digit code or magic link; recall ring, history, family switch, reschedule and cancel up to 24 hours before | | Alba Kids | Tooth Town picture book, Sugar Bug Scrub, Tooth Quest, certificate of bravery, stamp passport | | Motion | Light sweeps, aperture openings, split-flap times and View Transitions; every effect respects reduced motion | | SEO | Per-page metadata, Open Graph, `Dentist` structured data, `robots.txt`, `sitemap.xml` | | Stack | Next.js 15, TypeScript, Tailwind v4, `@opencals/storefront-sdk` v0.3.19 | ## Get started **1. Clone and install** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} git clone https://github.com/letsopencals/template-alba.git cd template-alba npm install ``` **2. Add your API key** Create a Dev Store in the [Opencals dashboard](https://opencals.com) with the country set to the **United Kingdom** (for GBP) and choose the **Alba Dental** dataset (`dental_clinic`). It seeds the five studios and video, 26 clinicians, 25 treatments, add-ons, the pre-visit questions, the two discounts and sample bookings. Then grab a private storefront key (`spk_`, see [API keys](/docs/authentication#api-keys)) and set `OPENCALS_API_KEY` and `AUTH_SECRET` in `.env.local`. **3. Run it** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} npm run dev ``` Your studios, clinicians and treatments render immediately. **4. Deploy** Push to your own repo and [deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-alba\&env=OPENCALS_API_KEY,AUTH_SECRET\&envDescription=API%20key%20from%20your%20Opencals%20dashboard%20and%20a%20random%20secret%20for%20auth\&project-name=alba-dental\&repository-name=template-alba), or host anywhere Next.js runs. > [!NOTE] > > Pages are server-rendered, so their API calls carry no browser `Origin`. > Leave **allowed origins** empty on the key you give this template, or those > calls are rejected. > [!NOTE] > > Set **Storefront Base URL** in your dashboard (Settings → API) to your > deployed domain. Every customer link (view, reschedule, cancel, leave > feedback) is built as `{storefrontBaseUrl}/link/{token}`. ## Make it yours MIT-licensed: rebrand it, restructure it, or use it for client work. Clinic knowledge lives in `lib/site-config.ts` (studio copy and photography, the department mapping, clinician profiles, Smile Check concerns, comfort levels, recall intervals) and `lib/kids/kids-config.ts` for Alba Kids. Every colour and font is a Tailwind v4 `@theme` token in `app/globals.css`: ```css theme={"theme":{"light":"github-light","dark":"github-dark-default"}} @theme { --color-porcelain: #f3f1eb; /* page */ --color-ink: #0d1d1f; /* text */ --color-lagoon: #0d3b3e; /* the one action colour */ --color-mint: #bfeedd; /* light, availability */ --color-brass: #a9844a; /* hairlines, stamps */ } ``` # Bali Villa Rentals — villa booking template Source: https://opencals.com/docs/open-source/bali-villas Free, open-source villa and holiday-rental website template. Next.js 15, nightly stays with fixed check-in and check-out, a calendar on live availability, per-stay extras, guest details, Stripe checkout and passwordless accounts, built on the Opencals Storefront API. A complete villa-rental website you can clone and deploy today. Bali Villa Rentals is the first template built around **nightly stays**: each villa is booked by the night, from a check-in date to a check-out date, with a fixed **check-in at 15:00 and check-out at 11:00**. Start here if you rent villas, cabins, guest houses or rooms by the night. It runs on the same [Storefront API](/docs/api-reference/introduction) and typed [TypeScript SDK](/docs/guides/storefront-sdk) as [Haar](/docs/open-source/haar), [Frisor](/docs/open-source/frisor), [Clear Care](/docs/open-source/clarity), [VOLT](/docs/open-source/volt), [NOIR Drive](/docs/open-source/noir) and [Fluently](/docs/open-source/fluently). The demo brand is **Lumbung Sidemen**, ten villas in the rice fields of Sidemen, East Bali (USD, `Asia/Makassar`). The design is warm and quiet: limestone paper, jungle green and a single terracotta accent, with every nightly rate shown. > [card] [Live demo](https://template-bali-villas.vercel.app) > > template-bali-villas.vercel.app > [card] [Source code](https://github.com/letsopencals/template-bali-villas) > > letsopencals/template-bali-villas (MIT) > [card] [Deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-bali-villas\&env=OPENCALS_API_KEY,AUTH_SECRET\&envDescription=API%20key%20from%20your%20Opencals%20dashboard%20and%20a%20random%20secret%20for%20auth\&project-name=bali-villas\&repository-name=template-bali-villas) > > One-click deploy > [card] [Build it with AI](/docs/ai-agents/build-booking-site-skill) > > rentals-multi-day reference ![Bali Villa Rentals website template on a laptop and a phone on a villa terrace above the rice fields](https://raw.githubusercontent.com/letsopencals/template-bali-villas/main/docs/cover.png) Bali Villa Rentals — the storefront on desktop and mobile, demo brand Lumbung Sidemen ![Bali Villa Rentals template homepage hero, an aerial view of rice terraces with nightly price pins over the villas and a date and guest search](https://raw.githubusercontent.com/letsopencals/template-bali-villas/main/docs/homepage-hero.png) Homepage hero — a flyover of the valley with a price pin on every villa ## Nightly stays Guests pick a villa, then a check-in and a check-out date on a calendar that reads the villa's live availability. Booked nights are struck through, and the calendar stops the check-out date at the next booking. Guests (adults, children, infants), arrival time, flight number and the occasion are collected in the same flow. Extras such as an airport transfer or a floating breakfast are added once per stay. The total is always **nights × nightly rate + extras**, the same maths the engine charges. ![Bali Villa Rentals template reserve page with check-in and check-out dates, guest counts, arrival time, extras and a stay summary](https://raw.githubusercontent.com/letsopencals/template-bali-villas/main/docs/reserve.png) Reserve — stay dates, guests and arrival details, extras and a running total ## The stay model This is the part worth copying even if you never ship this template. It uses existing Opencals features only. | Piece | How it's modelled | | - | - | | A villa | One staffless product in its own product pool, `duration: 86400` (one night), `allowCustomDuration: true`, `maxDuration` (21 nights in the demo), `maxAttendees: 1` | | Check-in and check-out | `fixedTimes: true`, `fixedStartTime: "15:00:00"`, `fixedEndTime: "11:00:00"`. The API rejects a customer booking that doesn't start and end at these times | | Availability across midnight | A continuous 24/7 schedule | | Date picker | `getCurrentAvailabilitiesMerged` **without** `duration`; the client checks that the stay fits inside one range | | The slot | Check-in date 15:00 → check-out date 11:00 in the schedule timezone, sent in UTC | | Turnover day | A check-out day can be the next guest's check-in day (out at 11:00, in at 15:00) | | Guests, arrival time, flight number, occasion | Appointment [custom attributes](/docs/changelog/custom-attributes) | | Minimum nights | Per-villa content in the template (`lib/villa-content.ts`), checked in the calendar | | Extras | Add-ons charged once per stay | | Cancellation | `allowCustomerCancel` with `cancelGap` of 14 days; customers can also move their dates | A stay at Lumbung Sidemen, check-in 14 Nov and check-out 17 Nov, becomes `{ fromDate: '2026-11-14', fromTime: '07:00:00', toDate: '2026-11-17', toTime: '03:00:00' }` (UTC+8): three nights, priced as three units, three × the nightly rate. Give each villa its own product rather than a variant: variants don't block each other, so the same villa could be booked twice. ## What's inside ![Bali Villa Rentals template villas page listing villas with nightly rates and collection filters](https://raw.githubusercontent.com/letsopencals/template-bali-villas/main/docs/villas.png) Villas — all ten houses, with collection filters and a search by dates and guests ![Bali Villa Rentals template villa page for Joglo Agung with a photo gallery and a reservation card](https://raw.githubusercontent.com/letsopencals/template-bali-villas/main/docs/villa-page.png) Villa page — gallery, rooms and amenities next to the booking calendar ![Bali Villa Rentals template illustrated site map of the resort with each villa marked on the rice terraces](https://raw.githubusercontent.com/letsopencals/template-bali-villas/main/docs/site-map.png) Site map — find each house on the terraces ![Bali Villa Rentals template My trips page showing the next stay at Pondok Bambu with check-in and check-out dates and night count](https://raw.githubusercontent.com/letsopencals/template-bali-villas/main/docs/account.png) My trips — the next stay with its dates, nights and arrival details ![Bali Villa Rentals template trip page with stay details, change dates and cancel buttons, payment summary and directions](https://raw.githubusercontent.com/letsopencals/template-bali-villas/main/docs/trip.png) Trip page — check-in from 15:00, check-out by 11:00, guests, extras, payment, and buttons to change dates or cancel ![Bali Villa Rentals template villa page on a mobile screen](https://raw.githubusercontent.com/letsopencals/template-bali-villas/main/docs/mobile.png) Mobile — the villa page at phone size | Feature | Notes | | - | - | | Home | Video hero with villa pins and a date and guest search, the valley, a day at the resort, experiences, testimonials and FAQ | | Villas | All ten villas with collection filters (rice barns, pool villas, family houses, signature), a search by dates and guests, and a map | | Villa pages | Gallery, room tour, sleeping arrangements, amenities, house rules, reviews and a cancellation timeline next to the booking calendar | | Reserve | Stay dates, guests and arrival details, per-stay extras, checkout questions, promo code, a hold countdown and Stripe payment | | Trip-aware accounts | Check-in → check-out dates in the resort timezone, night count and guest details; customers can change dates (same number of nights) or cancel within policy | | Passwordless accounts | 6-digit email login, one-time email links via `/link/[token]` | | Editorial pages | Experiences, journal, about and getting there | | Motion | Lenis smooth scrolling, a gate curtain on first visit, reveals and parallax; every effect has a reduced-motion fallback | | SEO | Per-page metadata, Open Graph, `LodgingBusiness`, `VacationRental` and `FAQPage` structured data, `robots.txt`, `sitemap.xml` | | Stack | Next.js 15, TypeScript, Tailwind v4, Framer Motion, `@opencals/storefront-sdk` v0.3.17 | ## Get started **1. Clone and install** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} git clone https://github.com/letsopencals/template-bali-villas.git cd template-bali-villas npm install ``` **2. Add your API key** Create a store in the [Opencals dashboard](https://opencals.com) and choose the **Bali Villa Rentals** dataset preset (category Villa resort, `villa_resort`). It seeds the ten villas on a 24/7 schedule with fixed check-in and check-out, collections, extras, checkout questions and sample stays. Then grab a private storefront key (`spk_`, see [API keys](/docs/authentication#api-keys)) and set `OPENCALS_API_KEY` and `AUTH_SECRET` in `.env.local`. **3. Run it** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} npm run dev ``` Your villas, rates and availability render immediately. **4. Deploy** Push to your own repo and [deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-bali-villas\&env=OPENCALS_API_KEY,AUTH_SECRET\&envDescription=API%20key%20from%20your%20Opencals%20dashboard%20and%20a%20random%20secret%20for%20auth\&project-name=bali-villas\&repository-name=template-bali-villas), or host anywhere Next.js runs. > [!NOTE] > > Pages are server-rendered, so their API calls carry no browser `Origin`. > Leave **allowed origins** empty on the key you give this template, or those > calls are rejected. > [!NOTE] > > Set **Storefront Base URL** in your dashboard (Settings → API) to your > deployed domain. Every customer link (view, reschedule, cancel, leave > feedback) is built as `{storefrontBaseUrl}/link/{token}`, so if it still > points at localhost those emailed links go nowhere. ## Make it yours MIT-licensed: rebrand it, restructure it, or use it for client work. Business settings live in `lib/site-config.ts`: name, currency and timezone, check-in and check-out times, the longest stay, the cancellation window, arrival times, occasions and contact details. Per-villa rooms, story, amenities and minimum nights are in `lib/villa-content.ts`. Every colour and font is a Tailwind v4 `@theme` token in `app/globals.css`: ```css theme={"theme":{"light":"github-light","dark":"github-dark-default"}} @theme { --color-paper: #F4EEE4; /* limestone page background */ --color-jungle: #1F3A2E; /* dark sections and footer */ --color-terracotta: #B4502E; /* the only accent */ } ``` Building a different stay or rental site with an AI agent? The [build-booking-site skill](/docs/ai-agents/build-booking-site-skill) has a `rentals-multi-day` reference with the full pattern, including nightly stays. # Clear Care — clinic booking template Source: https://opencals.com/docs/open-source/clarity Free, open-source medical clinic booking website template. Next.js 15, a guided Care Finder, a single-page booking composer with pre-visit notes and photo uploads, video visits, Stripe checkout and a family care record — built on the Opencals Storefront API. A complete medical clinic booking website you can clone and deploy today. Clear Care is the clinic counterpart to [Haar](/docs/open-source/haar) and [Frisor](/docs/open-source/frisor): the same [Storefront API](/docs/api-reference/introduction) and typed [TypeScript SDK](/docs/guides/storefront-sdk) underneath, with a calm "Warm Practice" design: cream, honey oak, dusty steel-blue, brass and sage, set in Fraunces and Figtree. Patients start from what's going on rather than a department name, and every screen (Care Finder, departments, clinicians, video visits, the booking composer, checkout, the visit pass and the My Care portal) is built with the public API. > [card] [Live demo](https://template-clarity.vercel.app) > > template-clarity.vercel.app > [card] [Source code](https://github.com/letsopencals/template-clarity) > > letsopencals/template-clarity (MIT) > [card] [Deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-clarity) > > One-click deploy ![Clear Care medical clinic booking website template — storefront and booking flow](https://raw.githubusercontent.com/letsopencals/template-clarity/main/docs/cover.png) Clear Care — the storefront and booking flow, on desktop and mobile ![Clear Care template Care Finder recommending a visit with next free times and the emergency notice](https://raw.githubusercontent.com/letsopencals/template-clarity/main/docs/care-finder.png) The Care Finder — a recommended visit with its next free times ![Clear Care template booking composer with a day ribbon, time slots showing free clinicians and a live appointment card](https://raw.githubusercontent.com/letsopencals/template-clarity/main/docs/booking-page.png) The booking composer — day ribbon, slots and the live appointment card ![Clear Care template pre-visit notes with reason for visit, insurance provider and photo upload](https://raw.githubusercontent.com/letsopencals/template-clarity/main/docs/booking-notes.png) Pre-visit notes on lined paper, with photo upload ![Clear Care template My Care portal with the next visit, a prep checklist and the care team](https://raw.githubusercontent.com/letsopencals/template-clarity/main/docs/account.png) My Care — the next visit, prep checklist and care team ## What's inside | Feature | Notes | | - | - | | Care Finder | `/care` asks who the visit is for, what's going on and in clinic or by video, then recommends visits with the next free times. Needs and keywords live in `lib/site-config.ts`. Not a diagnosis tool; the emergency notice is on every booking surface | | Rooms of care | Product Collections endpoints — General Medicine, Cardiology, Dermatology, Pediatrics, Physiotherapy, Dental, Nutrition, Mental Health, Labs & Vaccinations, each with what it treats, its visits, clinicians and FAQs | | Clinicians | Staff Members endpoints — a directory and a profile per clinician with their bookable visits | | Video visits | The store's online location — chosen per visit in the booking flow, with a local camera/mic check on `/video-visits` | | Booking composer | One page: who the visit is for (Me / My child / Someone else), clinic or video, clinician or "first available", day and slots, add-ons, then pre-visit notes. A live appointment card is stamped "Held for you" on Reserve | | Pre-visit notes | Checkout questions mapped by `internalName` in `lib/intake.ts`, answered per visit (so a family cart keeps each patient's notes), with patient name/DOB when it's not for you and real photo uploads via presigned URLs | | Multi-location | Locations endpoints — three clinics out of the box, clinicians filtered by clinic | | Checkout | Cart + Checkout + Payment endpoints — two steps (contact, then payment), themed Stripe Elements or pay at the clinic, promo codes, a cart hold with Extend | | Visit pass | What to bring, add to calendar, and video join details on the thank-you page | | My Care | Self-Service endpoints — next visit with a prep checklist and join-video window, recalls due, care team, family filter, visit timeline and records with notes, photos and invoices, rate your care, reschedule/cancel within the store's policy, billing and communication preferences | | Passwordless sign-in | 6-digit email code first, password second, one-time email links via `/link/[token]` | | Stack | Next.js 15, TypeScript, Tailwind v4, framer-motion, Lenis, `@opencals/storefront-sdk` ^0.3.17 | ## Get started **1. Clone and install** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} git clone https://github.com/letsopencals/template-clarity.git cd template-clarity npm install ``` **2. Add your API key** Create a store in the [Opencals dashboard](https://opencals.com) — choose the **Medical / Clear Care Medical** dataset preset to seed the clinic's departments, services, clinicians and pre-visit questions — then grab a private storefront key (`spk_`, see [API keys](/docs/authentication#api-keys)) and set it in `.env.local`. Stores seeded before the "Visit for" and patient questions were added still work, but book every visit for "Myself" until you reseed. **3. Run it** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} npm run dev ``` Your clinic's real departments, clinicians, and availability render immediately. **4. Deploy** Push to your own repo and [deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-clarity), or host anywhere Next.js runs. ## Make it yours MIT-licensed: rebrand it, restructure it, or use it as a starting point for client work. Clinic copy and knowledge (Care Finder needs, department content, prep lists, recalls, clinician bios) live in `lib/site-config.ts`, intake mapping in `lib/intake.ts`, and every colour and font is a Tailwind v4 `@theme` token, with the full design contract in `DESIGN.md`. Agencies can run one codebase against multiple stores — each deployment points at a different API key. To go deeper than theming, follow the [booking page tutorial](/docs/guides/build-a-booking-page) to see the API calls behind each screen. # Fluently — language school template Source: https://opencals.com/docs/open-source/fluently Free, open-source language school website template. Next.js 15, group classes with level variants and live seats left, private lessons, a free trial, teachers, campuses plus an online classroom with a Join button, Stripe checkout and passwordless accounts, built on the Opencals Storefront API. A complete language-school website you can clone and deploy today. Fluently is built for **schools and courses**: group classes with levels, private 1:1 lessons, a free trial, teachers, campuses and a live **online classroom**. Start here for a language, music, coding, art or tutoring school. It runs on the same [Storefront API](/docs/api-reference/introduction) and typed [TypeScript SDK](/docs/guides/storefront-sdk) as [Haar](/docs/open-source/haar), [Frisor](/docs/open-source/frisor), [Clear Care](/docs/open-source/clarity), [VOLT](/docs/open-source/volt) and [NOIR Drive](/docs/open-source/noir). It's set in New York (USD, `America/New_York`) with two campuses and an online classroom, teaching Spanish, French, German, Italian, Japanese and Mandarin. The design is friendly and colorful: chunky sticker buttons, speech-bubble chips and 3D mascots next to real photos. > [card] [Live demo](https://template-fluently.vercel.app) > > template-fluently.vercel.app > [card] [Source code](https://github.com/letsopencals/template-fluently) > > letsopencals/template-fluently (MIT) > [card] [Deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-fluently\&env=OPENCALS_API_KEY,AUTH_SECRET\&envDescription=API%20key%20from%20your%20Opencals%20dashboard%20and%20a%20random%20secret%20for%20auth\&project-name=fluently\&repository-name=template-fluently) > > One-click deploy > [card] [Build it with AI](/docs/ai-agents/build-booking-site-skill) > > classes-and-lessons reference ![Fluently language school website template on a laptop and two phones in a classroom](https://raw.githubusercontent.com/letsopencals/template-fluently/main/docs/cover.png) Fluently — the storefront on desktop and mobile ![Fluently template homepage hero reading Speak a new language by summer, with a waving mascot and greetings in six languages](https://raw.githubusercontent.com/letsopencals/template-fluently/main/docs/homepage-hero.png) Homepage hero — friendly and colorful, with a free trial up front ## The school model This is the part worth copying even if you never ship Fluently itself. It uses existing Opencals features only, and the template reads everything from the data, so nothing about languages is hard-coded. | Piece | How it's modelled | | - | - | | A subject (a language) | A collection. A separate `start-here` collection holds the trial and conversation club | | A group class | A product with `maxAttendees > 1`, assigned to its teachers | | Levels (A1, A2, B1) | Variants of the group class, each with its own slug and price | | A private lesson | A 1-seat product whose variants are lengths (45 / 60 min) | | The free trial | A 1-seat product priced `0`, booked without a card | | Online vs campus | Derived from the class's location types: all `ONLINE` means an online group | | Teachers | Staff members; their languages and campuses come from their class and location assignments | | Seats left | `maxAttendees - attendees` on each availability slot | | The online classroom | The `ONLINE` location's `link`, returned on the booked appointment's location | | Colors | Each product's dashboard color picks its swatch | ## What's inside ![Fluently template class booking flow with campus choice, level variants, a date strip and a time slot showing seats left](https://raw.githubusercontent.com/letsopencals/template-fluently/main/docs/booking-page.png) Class booking — campus or online, level, date and time, with live seats left ![Fluently template weekly timetable with a day strip, language filters and a bookable class showing seats left](https://raw.githubusercontent.com/letsopencals/template-fluently/main/docs/timetable.png) Timetable — group classes for the week ahead, filterable by language | Feature | Notes | | - | - | | Home | Mascot hero with real teacher portraits, stats counted from your data, language tiles, a format switcher, a level-finder quiz, testimonials and FAQ | | This week timetable | Next seven days of group sessions across every class, with seats left, language filters and one-click booking (one cached availability call per level) | | Classes | Catalog filtered by language, format and level, with shareable URLs | | Language and teacher pages | Per-language classes, private lessons and teachers; teacher profiles with "Book with " | | Booking | Online or campus, level or length, teacher, extras, placement questions, details, payment. Deep links: `/booking/?date=&staff=&location=` | | Online lessons | A Join lesson button on online bookings, live from 15 minutes before the start | | Cart & Stripe checkout | Cart + Checkout + Payment endpoints, with the no-payment path for the free trial | | Passwordless accounts | 6-digit email login (password fallback), one-time email links via `/link/[token]` | | SEO | Per-page metadata, Open Graph, `LanguageSchool` and `FAQPage` structured data, `robots.txt`, `sitemap.xml` | | Stack | Next.js 15, TypeScript, Tailwind v4, Framer Motion, `@opencals/storefront-sdk` v0.3.14 | ## Get started **1. Clone and install** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} git clone https://github.com/letsopencals/template-fluently.git cd template-fluently npm install ``` **2. Add your API key** Create a store in the [Opencals dashboard](https://opencals.com) and choose the **Fluently** dataset preset (`language_school`). It seeds the six languages, campus and online group classes with level variants, private lessons, the free trial, teachers, both campuses, the online classroom with its link, extras and placement questions. Then grab a private storefront key (`spk_`, see [API keys](/docs/authentication#api-keys)) and set `OPENCALS_API_KEY`, `AUTH_SECRET` and `NEXT_PUBLIC_SITE_URL` in `.env.local`. **3. Run it** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} npm run dev ``` Your classes, teachers and timetable render immediately. **4. Deploy** Push to your own repo and [deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-fluently\&env=OPENCALS_API_KEY,AUTH_SECRET\&envDescription=API%20key%20from%20your%20Opencals%20dashboard%20and%20a%20random%20secret%20for%20auth\&project-name=fluently\&repository-name=template-fluently), or host anywhere Next.js runs. > [!NOTE] > > Pages are server-rendered, so their API calls carry no browser `Origin`. > Leave **allowed origins** empty on the key you give this template, or those > calls are rejected. > [!NOTE] > > Set **Storefront Base URL** in your dashboard (Settings → API) to your > deployed domain. Every customer link (view, reschedule, cancel, leave > feedback) is built as `{storefrontBaseUrl}/link/{token}`, so if it still > points at localhost those emailed links go nowhere. ## Make it yours MIT-licensed: rebrand it, restructure it, or use it for client work. All copy lives in `lib/site-config.ts`: hero, format descriptions, the level quiz, how it works, testimonials, FAQ and values. Every colour and font is a Tailwind v4 `@theme` token in `app/globals.css`: ```css theme={"theme":{"light":"github-light","dark":"github-dark-default"}} @theme { --color-bg: #FBF8F3; /* warm paper */ --color-ink: #16131F; /* ink + outlines */ --color-primary: #7C5CFF; /* grape */ --color-sun: #FFC93C; /* sunflower accent */ } ``` Building a different school site with an AI agent? The [build-booking-site skill](/docs/ai-agents/build-booking-site-skill) has a `classes-and-lessons` reference with the full pattern. # Frisør — barbershop booking template Source: https://opencals.com/docs/open-source/frisor Free, open-source barbershop and apothecary booking website template. Three shops, thirteen barbers, a three-step booking flow and retail products sold with the booking. Next.js 15 on the Opencals Storefront API. A complete barbershop booking website you can clone and deploy today. **Frisør** is a premium Berlin barbershop with three shops, thirteen barbers and an apothecary shelf: warm paper, bottle green and brass, big photography, Libre Caslon and Manrope. The booking flow is deliberately classic and fast, and the shop's retail products are sold as part of the booking and picked up at the chair. Every screen is built on the public [Storefront API](/docs/api-reference/introduction) and the typed [TypeScript SDK](/docs/guides/storefront-sdk). > [card] [Live demo](https://template-frisor-sage.vercel.app) > > template-frisor-sage.vercel.app > [card] [Source code](https://github.com/letsopencals/template-frisor) > > letsopencals/template-frisor (MIT) > [card] [Deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-frisor) > > One-click deploy ![Frisør barbershop booking website template on a laptop and a phone](https://raw.githubusercontent.com/letsopencals/template-frisor/main/docs/cover.png) Frisør: choose your barber and a time, on a laptop and a phone ## The booking flow Three short steps, with **Your chair** (shop, service, barber, time, extras, the running total and the Continue button) always in view: a sticky panel on desktop, a bar at the bottom on phones. 1. **Shop and service.** The shops as tabs, then that shop's menu. Options such as Standard, Skin Fade or Scissor Cut open inline; choosing one moves on. 2. **Barber and time.** Barber portraits with "Any barber" first, then the date strip directly above the day's free times, grouped by morning, afternoon and evening. 3. **The Shelf.** Products that pair with the service, in-chair extras, and a "Skip the shelf" button. Anything added is packed and waiting at the station. ![Frisør template booking flow: shelf products, extras and the Your chair summary](https://raw.githubusercontent.com/letsopencals/template-frisor/main/docs/booking-extras.png) The Shelf step: products that pair with the service, with the running total Availability is one cached server request per service and shop across the whole booking window; the day strip and the times are derived in the browser. ## What's inside | Feature | Notes | | - | - | | Service menu with variants | Products, variants and Product Collections: Classic Cut (Standard, Skin Fade, Scissor Cut), Hot Towel Shave, Cut + Beard, Beard Trim, Grey Blend, Kids Cut | | Three shops, thirteen barbers | Locations and Staff Members; "any barber" books the first free one | | Retail with the booking | Add-ons with the slug prefix `shelf-` are retail products picked up at the chair, offered in booking, at checkout, on service and barber pages and on `/shelf` | | Automatic shelf discount | The `SHELF15` code (15% off add-ons only) goes on when the first shelf product is added; `FIRSTCHAIR` is 10% off a first visit | | Checkout | Contact details with sign-in by emailed code, payment (Stripe or pay at the shop), the order as a receipt with editable shelf products and a last-call row | | Confirmation | An apothecary-style appointment label beside the facts, add to calendar, directions, manage booking, restock suggestions and "book the next one" | | Customer account | Next visit, past visits with Book again, move or cancel within the notice period, orders and receipts, profile and message preferences | | Stack | Next.js 15, TypeScript, Tailwind v4, `@opencals/storefront-sdk` | ## Get started **1. Create a Dev Store** In the [Opencals dashboard](https://opencals.com), create a Dev Store in Germany (EUR) with the **Frisør** dataset (`frisor`). It seeds the shops, barbers, services, twelve shelf products and the discount codes. **2. Clone and install** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} git clone https://github.com/letsopencals/template-frisor.git cd template-frisor npm install ``` **3. Add your API key** Create a private storefront key (`spk_`, see [API keys](/docs/authentication#api-keys)) and set `OPENCALS_API_KEY` and `AUTH_SECRET` in `.env.local`. **4. Run it** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} npm run dev ``` `/preview/thank-you` and `/preview/account` show the post-booking screens with sample data from your store. **5. Deploy** Push to your own repo and [deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-frisor), or host anywhere Next.js runs. ## Make it yours The template is MIT-licensed. Copy, shop notes, barber bios and the shelf pairings live in `lib/site-config.ts`; everything bookable comes from your store. Colours and type are tokens in `app/globals.css`, and `DESIGN.md` explains the design system and the usability rules the booking flow follows. To go deeper, follow the [booking page tutorial](/docs/guides/build-a-booking-page) to see the API calls behind each screen. # Gable — coworking template Source: https://opencals.com/docs/open-source/gable Free, open-source coworking website template. Next.js 15, six houses in Dublin, Cork and Galway, flex desks booked by the seat, studio desks, meeting rooms, phone booths, studios, event spaces and day offices, a day sheet that puts a desk, a room and a booth on one checkout with extras suggested in the gaps, built on the Opencals Storefront API. A complete coworking website you can clone and deploy today. Gable is built for **a network of workspaces that rent rooms and desks by the half hour**: six houses, each with an open floor sold by the seat, its own desks, meeting rooms, phone booths and, at some houses, a studio, an event space or a day office. Start here for coworking, meeting-room hire, podcast or photo studios, or any venue that rents rooms at several sites. It runs on the same [Storefront API](/docs/api-reference/introduction) and typed [TypeScript SDK](/docs/guides/storefront-sdk) as [Haar](/docs/open-source/haar), [Frisor](/docs/open-source/frisor), [Clear Care](/docs/open-source/clarity), [VOLT](/docs/open-source/volt), [NOIR Drive](/docs/open-source/noir), [Fluently](/docs/open-source/fluently), [Bali Villa Rentals](/docs/open-source/bali-villas), [Tensile](/docs/open-source/reformer) and [Alba Dental](/docs/open-source/alba). It's set in Ireland (EUR, `Europe/Dublin`) with houses at Grand Canal Dock, Smithfield, Portobello and Dún Laoghaire in Dublin, Shandon in Cork and the Spanish Arch in Galway: 77 bookable spaces and 16 extras. The design is an architect's drawing set: every section is a numbered sheet, summaries are title blocks, booking lengths are dimension lines and booked time is hatched, in cobalt with a marigold highlighter. > [card] [Live demo](https://template-gable.vercel.app) > > template-gable.vercel.app > [card] [Source code](https://github.com/letsopencals/template-gable) > > letsopencals/template-gable (MIT) > [card] [Deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-gable\&env=OPENCALS_API_KEY,AUTH_SECRET\&envDescription=API%20key%20from%20your%20Opencals%20dashboard%20and%20a%20random%20secret%20for%20auth\&project-name=gable\&repository-name=template-gable) > > One-click deploy > [card] [Build it with AI](/docs/ai-agents/build-booking-site-skill) > > build-booking-site skill ![Gable coworking website template on a laptop and a phone: the day planner with a meeting room and a flex desk on the day sheet, and the booking confirmation](https://raw.githubusercontent.com/letsopencals/template-gable/main/docs/cover.png) Gable — the planner with a day sheet on desktop, the day sheet drawer on mobile ![Gable template live board listing six houses with free seats on the open floor and free rooms](https://raw.githubusercontent.com/letsopencals/template-gable/main/docs/free-now.png) Free right now — seats left on every open floor and the rooms you could walk into in the next hour ## The planner A search, not a wizard. Pick a house, a day, how long (dimension-line chips: 30 minutes to a full day for rooms, a half or full day for desks), a start time and how many people. The results are the spaces that fit, each with its photo, seats, kit, the price for that span, a day bar with the booked time hatched, and "Free at 10:00", "Next free 14:30" or "23 seats free". Choose one, pick a time and its extras, and add it to the day. Everything is in the URL, so a search from the homepage or a space page lands exactly there. ![Gable template planner with a date strip, length chips, start times and meeting rooms with hatched day bars](https://raw.githubusercontent.com/letsopencals/template-gable/main/docs/planner-rooms.png) The planner — meeting rooms at Dock House for six people ## The day sheet The cart is a timeline of the day: every booking is a block between 08:00 and 20:00, with its extras, discounts, the hold timer, the total and **Check out** always in view. A desk, a room for the 11 o'clock and a booth for the call after go through **one checkout**. Under **Fits in your day** it suggests what the day is missing: a desk around your meetings, a booth in the gap between two meetings, lunch or coffee for the people in the room, a bigger room that's free at the same time, or parking. ![Gable template planner for desks beside a day sheet with a meeting room and a flex desk](https://raw.githubusercontent.com/letsopencals/template-gable/main/docs/planner-desks.png) The day sheet — a room and a flex desk, the first-day discount, and a parking suggestion ![Gable template confirmation drawn as an architectural section of the building with the booked spaces highlighted](https://raw.githubusercontent.com/letsopencals/template-gable/main/docs/thank-you.png) The confirmation — a day sheet printout with a section through the house and the route from the front door ## The workspace model This is the part worth copying even if you never ship Gable itself. It uses existing Opencals features only. | Piece | How it's modelled | | - | - | | A house | A location with its address, coordinates and opening hours | | A meeting room, booth, studio desk, studio, event space or day office | One product variant at exactly one house, no staff and no pool, so each is its own resource | | The open floor | One product per house with `maxAttendees` = its seats; a team books several seats with `numberOfAttendees` | | Seats in a room | `allowGuests` with `maxGuests` = seats − 1; the booker invites the attendees, who get the calendar invite | | A kind of space | A collection (`flex-desks`, `meeting-rooms`, `phone-booths`…), mapped to its presentation in `lib/site-config.ts` | | Length and price | `allowCustomDuration`: 30-minute base for rooms and booths, 4 hours for desks and events; priced per base block | | Level and kit | `Level:` and `Kit:` lines at the end of the product description | | Availability | Every space's free ranges for the whole booking window, read once per house and cached for 60 s; seats left come from the ranges' `attendees` / `maxAttendees` | | Coffee, lunch, a video-call camera, parking | Add-ons scoped to products and houses; per person with `maxQuantity`, per hour with `durationMultiplied` | | A first day, `GABLETEAM`, Friday afternoons | 20% off flex desks on a first order, 15% off rooms with a code, 25% off rooms starting on Friday afternoons | | Company, meeting name, dietary needs | Checkout questions | ## What's inside ![Gable template space page with seats, kit tags, a photo and a booking panel with a day bar and start times](https://raw.githubusercontent.com/letsopencals/template-gable/main/docs/space.png) A space — Liffey's data sheet and the booking panel ![Gable template account page with a seven-day week board showing desk and room bookings](https://raw.githubusercontent.com/letsopencals/template-gable/main/docs/account.png) Week plan — the account opens on the week, with every booking drawn to scale | Feature | Notes | | - | - | | Home | Hero video, a query bar into the planner, Free right now, the houses, the kinds of space, extras, teams and FAQ | | Houses | A hand-drawn location plan of Ireland, a page per house with a live board, spaces by kind, hours and getting there | | Spaces | The catalogue filtered by kind, house, seats and kit; a page per space with its data sheet, plan locator and booking panel | | Planner | House, day, length, start and people; results that fit with price and state; extras per space | | Day sheet | A multi-item cart as a day timeline, hold timer, discounts, and suggestions in the gaps | | Checkout | Details, checkout questions, a discount code, invitees for rooms, Stripe or pay at the house | | Confirmation | A printable day sheet with a section through the house, add to calendar and invite people | | Accounts | Passwordless 6-digit code; Week plan, change time, stay longer, invite, cancel, receipts | | Pricing and extras | From-prices per kind, a "price a whole day" builder, and the extras catalogue | | SEO | Per-page metadata, Open Graph, `CoworkingSpace` structured data per house, `FAQPage`, `robots.txt`, `sitemap.xml` | | Stack | Next.js 15, TypeScript, Tailwind v4, `@opencals/storefront-sdk` v0.3.19 | ## Get started **1. Clone and install** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} git clone https://github.com/letsopencals/template-gable.git cd template-gable npm install ``` **2. Add your API key** Create a Dev Store in the [Opencals dashboard](https://opencals.com) with the country set to **Ireland** (for EUR) and choose the **Gable** dataset (`coworking`). It seeds the six houses, 77 spaces, 16 extras, the checkout questions, three discounts and sample bookings. Then grab a private storefront key (`spk_`, see [API keys](/docs/authentication#api-keys)) and set `OPENCALS_API_KEY` and `AUTH_SECRET` in `.env.local`. **3. Run it** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} npm run dev ``` Your houses, spaces and extras render immediately. **4. Deploy** Push to your own repo and [deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-gable\&env=OPENCALS_API_KEY,AUTH_SECRET\&envDescription=API%20key%20from%20your%20Opencals%20dashboard%20and%20a%20random%20secret%20for%20auth\&project-name=gable\&repository-name=template-gable), or host anywhere Next.js runs. > [!NOTE] > > Pages are server-rendered, so their API calls carry no browser `Origin`. > Leave **allowed origins** empty on the key you give this template, or those > calls are rejected. > [!NOTE] > > Set **Storefront Base URL** in your dashboard (Settings → API) to your > deployed domain. Every customer link (view, reschedule, cancel, leave > feedback) is built as `{storefrontBaseUrl}/link/{token}`. ## Make it yours MIT-licensed: rebrand it, restructure it, or use it for client work. Workspace copy lives in `lib/site-config.ts` (the collection → kind mapping, house photography and arrival notes, extras groups, teams, FAQ). Every colour and font is a Tailwind v4 `@theme` token in `app/globals.css`, and `DESIGN.md` describes the drawing-set system: ```css theme={"theme":{"light":"github-light","dark":"github-dark-default"}} @theme { --color-paper: #f6f6f2; /* page */ --color-ink: #121633; /* text and frames */ --color-cobalt: #2a44d4; /* the brand: actions, drawings */ --color-marigold: #f4b63f; /* the highlighter: the one thing you chose */ } ``` # Haar — salon booking template Source: https://opencals.com/docs/open-source/haar Free, open-source beauty salon booking website template. Next.js 15, Stripe checkout, staff and multi-location booking, customer accounts — built on the Opencals Storefront API. A complete salon booking website you can clone and deploy today. Haar is the reference implementation of the [Storefront API](/docs/api-reference/introduction): every screen — services, staff picker, time slots, cart, checkout, customer account — is built with the public API and the [TypeScript SDK](/docs/guides/storefront-sdk). > [card] [Live demo](https://template-haar.vercel.app) > > template-haar.vercel.app > [card] [Source code](https://github.com/letsopencals/template-haar) > > letsopencals/template-haar (MIT) > [card] [Deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-haar) > > One-click deploy ![Haar salon booking website template — storefront and booking flow](https://raw.githubusercontent.com/letsopencals/template-haar/main/docs/cover.png) Haar — the storefront and booking flow, on tablet and mobile ![Haar template booking composer with day ribbon, time slots and live appointment card](https://raw.githubusercontent.com/letsopencals/template-haar/main/docs/booking-page.png) The consultation-card booking composer ![Haar template checkout with customer details, payment options and appointment cards](https://raw.githubusercontent.com/letsopencals/template-haar/main/docs/checkout-page.png) Checkout — card, pay at the salon or bank transfer ## What's inside | Feature | Notes | | - | - | | Service catalog | Driven by the Products + Product Collections endpoints | | Staff & multi-location booking | Staff Members + Locations endpoints | | Real-time availability | Appointments endpoints | | Cart & Stripe checkout | Cart + Checkout + Payment endpoints, deposits supported | | Customer accounts | Self-Service endpoints — bookings, reschedules, cancellations | | Stack | Next.js 15, TypeScript, Tailwind, `@opencals/storefront-sdk` | ## Get started **1. Clone and install** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} git clone https://github.com/letsopencals/template-haar.git cd template-haar npm install ``` **2. Add your API key** Create a store in the [Opencals dashboard](https://opencals.com), grab a private storefront key (`spk_`, see [API keys](/docs/authentication#api-keys)), and set it in `.env.local`. **3. Run it** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} npm run dev ``` Your salon's real services, staff, and availability render immediately. **4. Deploy** Push to your own repo and [deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-haar), or host anywhere Next.js runs. ## Make it yours The template is MIT-licensed: rebrand it, restructure it, or use it as a starting point for client work. Agencies can run one codebase against multiple stores — each deployment just points at a different API key. To go deeper than theming, follow the [booking page tutorial](/docs/guides/build-a-booking-page) to understand the API calls behind each screen. # NOIR Drive — luxury car rental template Source: https://opencals.com/docs/open-source/noir Free, open-source luxury car rental website template. Next.js 15, multi-day booking by the day, delivery or garage collection, per-day extras, chauffeur packages, Stripe checkout and passwordless accounts, built on the Opencals Storefront API. A complete luxury car-rental website you can clone and deploy today. NOIR Drive is the first template built around **multi-day bookings**: each car is booked **by the day**, from a pick-up date to a return date, and blocked for the whole span. Start here if you rent cars, boats, equipment or villas by the day. It runs on the same [Storefront API](/docs/api-reference/introduction) and typed [TypeScript SDK](/docs/guides/storefront-sdk) as [Haar](/docs/open-source/haar), [Frisor](/docs/open-source/frisor), [Clear Care](/docs/open-source/clarity) and [VOLT](/docs/open-source/volt). It's set in Dubai (AED, `Asia/Dubai`) with an all-black fleet of twelve cars. Two booking surfaces sit over one store: a **multi-day rental flow** for the fleet, and a classic **chauffeur flow** with real drivers. > [card] [Live demo](https://template-noir.vercel.app) > > template-noir.vercel.app > [card] [Source code](https://github.com/letsopencals/template-noir) > > letsopencals/template-noir (MIT) > [card] [Deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-noir\&env=OPENCALS_API_KEY,AUTH_SECRET\&envDescription=API%20key%20from%20your%20Opencals%20dashboard%20and%20a%20random%20secret%20for%20auth\&project-name=noir-drive\&repository-name=template-noir) > > One-click deploy ![NOIR Drive luxury car rental website template shown on a laptop in front of a black fleet in Dubai](https://raw.githubusercontent.com/letsopencals/template-noir/main/docs/cover.png) NOIR Drive — the storefront on desktop, set in Dubai ![NOIR Drive template homepage hero reading Drive the night over a showroom of black cars](https://raw.githubusercontent.com/letsopencals/template-noir/main/docs/homepage-hero.png) Homepage hero — cinematic, all-black, with Book a car up front ## Multi-day booking Customers pick a car, choose pick-up and return dates on a range calendar that reads the car's live availability, then choose *Deliver to my address* or *Collect at the garage* and a handover window. Per-day extras (excess waiver, additional driver) are priced × days, and fixed extras (child seat, prepaid fuel) once. Driving licence and ID uploads and a deposit-and-terms checkbox are regular checkout questions. The total is always **days × daily rate + extras**, the same maths the engine charges. ![NOIR Drive template booking flow with a two-month range calendar, handover windows, delivery or garage choice and a rental summary](https://raw.githubusercontent.com/letsopencals/template-noir/main/docs/book-a-car.png) Book a car — range calendar on live availability, handover windows and a running total ## The rental model This is the part worth copying even if you never ship NOIR Drive itself. It uses existing Opencals features only. | Piece | How it's modelled | | - | - | | A car | One staffless product in its own product pool (so a booking blocks it at both locations), `duration: 86400`, `allowCustomDuration: true`, `maxDuration`, `maxAttendees: 1` | | Availability across midnight | A continuous 24/7 schedule. Bookings longer than 24 hours are validated against continuous availability | | Date picker | `getCurrentAvailabilitiesMerged` **without** `duration`; the client checks that pick-up → return fits inside one range | | The slot | Pick-up date 00:00 → return date 00:00 in the store timezone, sent in UTC | | Handover window, flight number, collection address | Appointment [custom attributes](/docs/changelog/custom-attributes) | | Delivery or collection | A `PHYSICAL` garage location and a `DELIVERY` location; the customer's address is captured at checkout | | Per-day extras | Add-ons with `durationMultiplied` | | Security deposit | Shown per car and accepted with a required checkbox question; taken at handover, never charged online | Dubai pick-up 10 Nov → return 13 Nov becomes `{ fromDate: '2026-11-09', fromTime: '20:00:00', toDate: '2026-11-12', toTime: '20:00:00' }`: three days, three units, three × the daily rate. Give each car its own product rather than a variant: variants don't block each other, so the same car could be booked twice. ## What's inside ![NOIR Drive template car page for a Rolls-Royce Cullinan priced per day](https://raw.githubusercontent.com/letsopencals/template-noir/main/docs/car-page.png) Car page — specs and the daily rate, with a jump to the availability calendar ![NOIR Drive template rates table listing daily rate, deposit and kilometres per day for each car](https://raw.githubusercontent.com/letsopencals/template-noir/main/docs/rates.png) Rates — one price per day, with deposit and km allowance for every car ![NOIR Drive template chauffeur page offering airport transfers, hourly and full-day packages](https://raw.githubusercontent.com/letsopencals/template-noir/main/docs/chauffeur.png) Chauffeur — packages booked through the classic staff flow | Feature | Notes | | - | - | | Fleet and car pages | Category filters from collections, "available for your dates", a two-month availability calendar with booked days struck through | | Rates | A full rates table (daily rate, deposit, km per day) | | Multi-day booking | Range calendar, delivery or garage, handover windows, per-day and fixed extras, checkout questions | | Chauffeur | Packages booked through the classic staff flow, with a preferred-car request | | Cart & Stripe checkout | Cart + Checkout + Payment endpoints | | Rental-aware accounts | Pick-up → return dates in the store timezone, day count, handover details; customers can change dates (same length) or cancel within policy | | Passwordless accounts | 6-digit email login (password fallback), one-time email links via `/link/[token]` | | Motion | Lenis smooth scrolling, text and image reveals, parallax, count-up specs; every effect has a reduced-motion fallback | | SEO | Per-page metadata, Open Graph, `AutoRental` and `Product` structured data, `robots.txt`, `sitemap.xml` | | Stack | Next.js 15, TypeScript, Tailwind v4, Framer Motion, `@opencals/storefront-sdk` v0.3.14 | ## Get started **1. Clone and install** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} git clone https://github.com/letsopencals/template-noir.git cd template-noir npm install ``` **2. Add your API key** Create a store in the [Opencals dashboard](https://opencals.com) and choose the **NOIR Drive** dataset preset (category Car rental). It seeds the fleet on a 24/7 schedule, the garage and delivery locations, extras, checkout questions, chauffeurs and packages. Then grab a private storefront key (`spk_`, see [API keys](/docs/authentication#api-keys)) and set `OPENCALS_API_KEY` and `AUTH_SECRET` in `.env`. **3. Run it** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} npm run dev ``` Your cars, rates and availability render immediately. **4. Deploy** Push to your own repo and [deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-noir\&env=OPENCALS_API_KEY,AUTH_SECRET\&envDescription=API%20key%20from%20your%20Opencals%20dashboard%20and%20a%20random%20secret%20for%20auth\&project-name=noir-drive\&repository-name=template-noir), or host anywhere Next.js runs. > [!NOTE] > > Set **Storefront Base URL** in your dashboard (Settings → API) to your > deployed domain. Every customer link (view, reschedule, cancel, leave > feedback) is built as `{storefrontBaseUrl}/link/{token}`, so if it still > points at localhost those emailed links go nowhere. ## Make it yours MIT-licensed: rebrand it, restructure it, or use it for client work. All business copy lives in `lib/site-config.ts`: name, currency and timezone, per-car specs and deposits, handover windows, delivery zones, FAQs and contact details. Every colour and font is a Tailwind v4 `@theme` token in `app/globals.css`: ```css theme={"theme":{"light":"github-light","dark":"github-dark-default"}} @theme { --color-bg: #050505; /* page black */ --color-ink: #F4F1EA; /* warm ivory text */ --color-primary: #C8A96B; /* champagne accent */ } ``` Building a different rental site with an AI agent? The [build-booking-site skill](/docs/ai-agents/build-booking-site-skill) has a `rentals-multi-day` reference with the full pattern. # Tensile — reformer Pilates studio template Source: https://opencals.com/docs/open-source/reformer Free, open-source reformer Pilates and fitness studio website template. Next.js 15, a multi-studio weekly timetable with the instructor and beds left on every class, Full classes with the next class that has space, 1:1 and duet privates, dated workshops, live online classes with a Join button, Stripe checkout and passwordless accounts, built on the Opencals Storefront API. A complete reformer Pilates studio website you can clone and deploy today. Tensile is built for **class-based fitness studios**: a weekly timetable across several studios, where every class names its instructor and shows the **beds left** in the room, plus private sessions, workshops and live online classes. Start here for a Pilates, yoga, barre, spin or boutique fitness studio. It runs on the same [Storefront API](/docs/api-reference/introduction) and typed [TypeScript SDK](/docs/guides/storefront-sdk) as [Haar](/docs/open-source/haar), [Frisor](/docs/open-source/frisor), [Clear Care](/docs/open-source/clarity), [VOLT](/docs/open-source/volt), [NOIR Drive](/docs/open-source/noir), [Fluently](/docs/open-source/fluently) and [Bali Villa Rentals](/docs/open-source/bali-villas). It's set in Berlin (EUR, `Europe/Berlin`) with three studios (Mitte, Kreuzberg, Prenzlauer Berg), live online classes and eight instructors. The design is technical but warm: pale concrete, ink and steel, with the real reformer spring colours (green, yellow, blue, red) as the intensity scale across the site. > [card] [Live demo](https://template-reformer.vercel.app) > > template-reformer.vercel.app > [card] [Source code](https://github.com/letsopencals/template-reformer) > > letsopencals/template-reformer (MIT) > [card] [Deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-reformer\&env=OPENCALS_API_KEY,AUTH_SECRET\&envDescription=API%20key%20from%20your%20Opencals%20dashboard%20and%20a%20random%20secret%20for%20auth\&project-name=tensile\&repository-name=template-reformer) > > One-click deploy > [card] [Build it with AI](/docs/ai-agents/build-booking-site-skill) > > classes-and-lessons reference ![Tensile reformer Pilates website template on a laptop and a phone in a pale concrete reformer studio](https://raw.githubusercontent.com/letsopencals/template-reformer/main/docs/cover.png) Tensile — the storefront on desktop and mobile ![Tensile template homepage hero with a reformer studio film, the three Berlin studios and a first-class call to action](https://raw.githubusercontent.com/letsopencals/template-reformer/main/docs/homepage-hero.png) Homepage hero — the studio, the week's classes and a first-class offer up front ## The timetable One week across every studio and the online room. Each class shows its instructor, its spring colour and a row of **bed pips** for the beds left. Filter by studio, class, level, instructor or time of day, and share the filtered URL. A class that's sold out reads **Full**, with a "next with space" link to the next class of the same type that still has a bed. ![Tensile template weekly timetable with studio and class filters, bed pips on each class and a Full class pointing to the next class with space](https://raw.githubusercontent.com/letsopencals/template-reformer/main/docs/timetable.png) Timetable — the week across three studios and online, with beds left and Full classes ![Tensile template class sheet with an SVG room plan of reformer beds, add-ons, a price preview and a book button](https://raw.githubusercontent.com/letsopencals/template-reformer/main/docs/class-sheet.png) Class sheet — the room plan, extras, the price with any discount, and the policy, then on to checkout ## The studio model This is the part worth copying even if you never ship Tensile itself. It uses existing Opencals features only. | Piece | How it's modelled | | - | - | | A class type (Reformer Flow, Foundations) | A product | | One weekly class series | A **variant** per class × studio × instructor (`flow-mitte-lena`), with its own schedule (one window per weekly start), its studio as the only location and its instructor as the only staff member | | Capacity | `maxAttendees` = the beds in the room. Beds left = `maxAttendees - attendees` on each slot | | Full classes | The API drops a slot once it's full. Classes repeat weekly, so the template learns each series' weekly pattern and shows a missing week as **Full** | | Rooms and bed plans | Template content (`lib/site-config.ts`); rooms aren't API entities | | Privates (1:1 and duet) | One seat each, sharing one product pool per studio (one private room). A duet is one booking for two, carried as the custom attribute `people = "2"` | | Workshops | Dated products in a `workshops` collection. A full workshop simply disappears | | Online classes | An `ONLINE` location whose `link` is the class URL, returned on the booked appointment | | Grip socks, towel hire, recovery shake | Add-ons | | Waiver and pregnancy questions | Checkout questions, the waiver a required checkbox | | Intro offer, off-peak, `TENSILE10` | An automatic 30% first-order discount, an automatic 20% discount on weekday classes starting 10:00–16:00, and a code. They don't stack: the best one wins | | Move or cancel | `allowCustomerCancel` and reschedule with a 12-hour `cancelGap` | ## What's inside ![Tensile template privates page with 1:1 and duet sessions at each studio and their next available times](https://raw.githubusercontent.com/letsopencals/template-reformer/main/docs/privates.png) Privates — 1:1 and duet sessions per studio on live times ![Tensile template account page listing booked classes with move and cancel buttons, a Join button for an online class and a level path](https://raw.githubusercontent.com/letsopencals/template-reformer/main/docs/account.png) Your week — upcoming classes with move, cancel and Join, plus the level path ![Tensile template timetable on a mobile screen with a day strip and bed pips](https://raw.githubusercontent.com/letsopencals/template-reformer/main/docs/mobile.png) Mobile — the timetable at phone size | Feature | Notes | | - | - | | Home | Film hero, a live board of today's classes, the spring system, class types, the level path, studios, instructors, the intro offer and FAQ | | Timetable | A week across every studio and online, filters with shareable URLs, bed pips, Full classes with "next with space", deep links to a class sheet | | Class sheet | Room plan, extras, price preview with the best discount, policy, then a hand-over to checkout | | Classes, studios, instructors | Class pages with what to bring and the springs used, studio pages with rooms and directions, instructor profiles with their upcoming classes | | Privates and workshops | 1:1 and duet sessions per studio; dated Saturday workshops | | Checkout | Customer details, the waiver and pregnancy questions, a discount code, Stripe or pay at the studio, and a check-in pass | | Accounts | Passwordless 6-digit email login and one-time email links via `/link/[token]`; your week, move or cancel up to 12 hours before, Join for online classes, feedback, and a level path | | Motion | Lenis smooth scrolling, a page transition, line-mask reveals and tension cables; every effect has a reduced-motion fallback | | SEO | Per-page metadata, Open Graph, `ExerciseGym` structured data with a `SportsActivityLocation` per studio, `robots.txt`, `sitemap.xml` | | Stack | Next.js 15, TypeScript, Tailwind v4, Framer Motion, `@opencals/storefront-sdk` v0.3.18 | ## Get started **1. Clone and install** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} git clone https://github.com/letsopencals/template-reformer.git cd template-reformer npm install ``` **2. Add your API key** Create a store in the [Opencals dashboard](https://opencals.com) and choose the **Reformer Pilates Studio** dataset preset (category Pilates & fitness, `reformer_studio`). It seeds the three studios and the online room, eight instructors, the weekly timetable, privates, workshops, add-ons, checkout questions with the waiver, the three discounts and sample bookings, some of them Full. Then grab a private storefront key (`spk_`, see [API keys](/docs/authentication#api-keys)) and set `OPENCALS_API_KEY` and `AUTH_SECRET` in `.env.local`. **3. Run it** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} npm run dev ``` Your classes, instructors and timetable render immediately. **4. Deploy** Push to your own repo and [deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-reformer\&env=OPENCALS_API_KEY,AUTH_SECRET\&envDescription=API%20key%20from%20your%20Opencals%20dashboard%20and%20a%20random%20secret%20for%20auth\&project-name=tensile\&repository-name=template-reformer), or host anywhere Next.js runs. > [!NOTE] > > Pages are server-rendered, so their API calls carry no browser `Origin`. > Leave **allowed origins** empty on the key you give this template, or those > calls are rejected. > [!NOTE] > > Set **Storefront Base URL** in your dashboard (Settings → API) to your > deployed domain. Every customer link (view, reschedule, cancel, leave > feedback) is built as `{storefrontBaseUrl}/link/{token}`, so if it still > points at localhost those emailed links go nowhere. ## Make it yours MIT-licensed: rebrand it, restructure it, or use it for client work. Studio knowledge lives in `lib/site-config.ts`: studios with their rooms and bed plans, instructor bios, class meta (spring, level, what to bring), the level path, policies, the off-peak window and add-on copy. Every colour and font is a Tailwind v4 `@theme` token in `app/globals.css`: ```css theme={"theme":{"light":"github-light","dark":"github-dark-default"}} @theme { --color-plaster: #edebe6; /* page */ --color-ink: #121212; /* text and primary buttons */ --color-spring-blue: #2f5bd3; /* strong */ --color-spring-red: #d9412b; /* heavy, and urgency */ } ``` Building a different class-based studio with an AI agent? The [build-booking-site skill](/docs/ai-agents/build-booking-site-skill) has a `classes-and-lessons` reference with the full pattern, including Full classes. # Open-source templates Source: https://opencals.com/docs/open-source/templates Free, open-source booking website templates built on the Opencals Storefront API. Clone, customize, and deploy a production booking site in minutes. Every template is a complete, production-grade booking website built on the [Storefront API](/docs/api-reference/introduction) and the typed [TypeScript SDK](/docs/guides/storefront-sdk). MIT-licensed — clone it, rebrand it, ship it for yourself or your clients. ## How it works **1. Clone a template** Each template is a standalone Next.js repository on [GitHub](https://github.com/letsopencals). **2. Connect your store** Create a store in the [Opencals dashboard](https://opencals.com) and set your private storefront key (`spk_`) in the env vars. See [Authentication](/docs/authentication). **3. Deploy** One-click deploy to Vercel, or anywhere Next.js runs. Bookings, checkout, and payments work out of the box. ## Templates > [card] [Haar — salon booking template](/docs/open-source/haar) > > A free beauty-salon booking website: services, staff and multi-location > booking, customer accounts, and Stripe checkout. Next.js 15 + TypeScript. > > **[Live demo ↗](https://template-haar.vercel.app)** · **[GitHub ↗](https://github.com/letsopencals/template-haar)** > [card] [Frisør — barbershop booking template](/docs/open-source/frisor) > > A free barbershop and apothecary booking website: three Berlin shops, > thirteen barbers, a three-step booking flow with the total always in view, > and retail products sold with the booking and picked up at the chair. > Paper, bottle green and brass. Next.js 15 + TypeScript. > > **[Live demo ↗](https://template-frisor-sage.vercel.app)** · **[GitHub ↗](https://github.com/letsopencals/template-frisor)** > [card] [Clear Care — clinic booking template](/docs/open-source/clarity) > > A free medical-clinic booking website: a Care Finder that starts from what's > going on, a single-page booking composer with pre-visit notes and photo > uploads, clinic or video visits across three clinics, Stripe checkout, and a > family care record in My Care. Calm, warm design — Next.js 15 + TypeScript. > > **[Live demo ↗](https://template-clarity.vercel.app)** · **[GitHub ↗](https://github.com/letsopencals/template-clarity)** > [card] [VOLT — padel & squash club template](/docs/open-source/volt) > > A free booking website for a padel & squash club network: pick your club > (or the nearest one), then book a court on a live hall map or a courts × time > grid, with singles and doubles courts and 60–120 minute games. Coach-led > training with group capacity, a step-by-step checkout with your crew and kit, > match-ticket confirmations, and player accounts with stats and rebooking. Built > on staffless resources, with one cached availability read per club. Dark > technical design — Next.js 15 + TypeScript. > > **[Live demo ↗](https://template-volt.vercel.app)** · **[GitHub ↗](https://github.com/letsopencals/template-volt)** > [card] [NOIR Drive — luxury car rental template](/docs/open-source/noir) > > A free luxury car-rental website: a fleet booked by the day with a range > calendar on live availability, delivery or garage collection, per-day extras, > licence and ID uploads at checkout, chauffeur packages with real drivers, > rental-aware customer accounts, and Stripe checkout. The first template built > on multi-day bookings. Black cinematic design — Next.js 15 + TypeScript. > > **[Live demo ↗](https://template-noir.vercel.app)** · **[GitHub ↗](https://github.com/letsopencals/template-noir)** > [card] [Fluently — language school template](/docs/open-source/fluently) > > A free language-school website: group classes with level variants and live > seats left, private lessons, a free trial, a week-ahead timetable, teacher > profiles, campuses plus an online classroom with a Join button, passwordless > student accounts, and Stripe checkout. The first template built for schools > and courses. Colorful, playful design — Next.js 15 + TypeScript. > > **[Live demo ↗](https://template-fluently.vercel.app)** · **[GitHub ↗](https://github.com/letsopencals/template-fluently)** > [card] [Bali Villa Rentals — villa booking template](/docs/open-source/bali-villas) > > A free villa-rental website: ten villas booked by the night with fixed > check-in and check-out, a calendar on live availability, guest and arrival > details, per-stay extras, trip-aware customer accounts with date changes and > cancellation, passwordless login, and Stripe checkout. The first template > built for nightly stays. Warm, quiet design — Next.js 15 + TypeScript. > > **[Live demo ↗](https://template-bali-villas.vercel.app)** · **[GitHub ↗](https://github.com/letsopencals/template-bali-villas)** > [card] [Tensile — reformer Pilates studio template](/docs/open-source/reformer) > > A free reformer Pilates studio website: a weekly timetable across three > studios and online with the instructor and beds left on every class, Full > classes that point to the next class with space, 1:1 and duet privates, > workshops, add-ons and waiver questions at checkout, passwordless accounts > with move, cancel and Join, and Stripe checkout. The first template built for > a class-based fitness studio. Technical, warm design — Next.js 15 + > TypeScript. > > **[Live demo ↗](https://template-reformer.vercel.app)** · **[GitHub ↗](https://github.com/letsopencals/template-reformer)** > [card] [Alba Dental — dental group template](/docs/open-source/alba) > > A free dental practice website for a group of clinics: five London studios > plus video consultations, 26 clinicians booked by name or first available, a > Smile Check questionnaire on a 32-tooth chart, a chair-time booking planner > with the hygienist straight after, a flippable appointment card with a > six-month recall, a patient account with a recall ring and family visits, and > Alba Kids, a cut-paper children's site with a brushing game. Light, precise > design — Next.js 15 + TypeScript. > > **[Live demo ↗](https://template-alba.vercel.app)** · **[GitHub ↗](https://github.com/letsopencals/template-alba)** > [card] [Gable — coworking template](/docs/open-source/gable) > > A free coworking website for a network of workspaces: six houses in Dublin, > Cork and Galway with flex desks booked by the seat, studio desks, meeting > rooms, phone booths, studios, event spaces and day offices, a search-style > planner, a day sheet that puts a desk, a room and a booth on one checkout with > extras suggested in the gaps, a printable confirmation with the route from the > front door, and a Week plan account. Drawing-set design — Next.js 15 + > TypeScript. > > **[Live demo ↗](https://template-gable.vercel.app)** · **[GitHub ↗](https://github.com/letsopencals/template-gable)** > [!NOTE] > > Booking courts, bays, lanes or rooms rather than people? Start from > [VOLT](/docs/open-source/volt), built on staffless resources. Renting by the day > (cars, boats, equipment)? Start from > [NOIR Drive](/docs/open-source/noir). Renting villas, cabins or rooms by the > night? Start from [Bali Villa Rentals](/docs/open-source/bali-villas). Running a school or courses? Start from > [Fluently](/docs/open-source/fluently). Running a Pilates, yoga or fitness studio > with a class timetable? Start from [Tensile](/docs/open-source/reformer). Running a > dental practice or a clinic group with many clinicians? Start from > [Alba Dental](/docs/open-source/alba). Renting desks, meeting rooms and studios by > the half hour at several sites? Start from [Gable](/docs/open-source/gable). More are > on the way: spa and tattoo studio are next. > Want one prioritized? [Tell us](https://opencals.com/contact). ## Quick start ```bash Clone Haar theme={"theme":{"light":"github-light","dark":"github-dark-default"}} git clone https://github.com/letsopencals/template-haar.git cd template-haar npm install ``` ```bash Install the SDK only theme={"theme":{"light":"github-light","dark":"github-dark-default"}} npm install @opencals/storefront-sdk ``` Build something custom instead? Start from the [booking page tutorial](/docs/guides/build-a-booking-page). # VOLT — padel & squash club template Source: https://opencals.com/docs/open-source/volt Free, open-source multi-club padel and squash booking website template. Next.js 15, a live hall map and court grid per club, crew-and-kit checkout, match-ticket confirmations, coach-led training and passwordless accounts, built on the Opencals Storefront API. A complete padel & squash club booking website you can clone and deploy today. VOLT is the first template built around **staffless resources** rather than staff-led appointments: courts are independent, exclusively-booked units, so this is the one to start from if you are booking courts, bays, lanes, studios or rooms rather than people. It runs on the same [Storefront API](/docs/api-reference/introduction) and typed [TypeScript SDK](/docs/guides/storefront-sdk) as [Haar](/docs/open-source/haar), [Frisor](/docs/open-source/frisor) and [Clear Care](/docs/open-source/clarity). VOLT models a **network of clubs**: each club is a store location with its own courts (padel doubles, padel singles, squash), and players book from one club at a time, on a live **hall map** of its courts or a **courts × time grid**. Coach-led lessons and group classes run per club too, and both go through the same crew-and-kit checkout. > [card] [Live demo](https://template-volt.vercel.app) > > template-volt.vercel.app > [card] [Source code](https://github.com/letsopencals/template-volt) > > letsopencals/template-volt (MIT) > [card] [Deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-volt\&env=OPENCALS_API_KEY,AUTH_SECRET\&envDescription=API%20key%20from%20your%20Opencals%20dashboard%20and%20a%20random%20secret%20for%20auth\&project-name=volt\&repository-name=template-volt) > > One-click deploy ![VOLT padel and squash club booking website template — storefront and booking flow](https://raw.githubusercontent.com/letsopencals/template-volt/main/docs/cover.png) VOLT — the storefront and booking flow, on desktop and mobile ![VOLT template homepage hero with a floodlit padel court, its four clubs and a live court map link](https://raw.githubusercontent.com/letsopencals/template-volt/main/docs/homepage-hero.png) Homepage hero — full-bleed and sport-first ## Club-first court booking Players don't look for a court in four cities at once, so `/book` starts from **one club**: the one in the link, the one this browser remembers, or the nearest one ("Near me" uses each location's coordinates). New visitors pick from photo cards that show each club's soonest free court. The club's page is full screen, with two views over the same live data: * **Hall map.** Every court from above, doubles wide and singles narrow, lit for one start time: free, free within the hour, free later, or taken for the day. Drag the time bar (its bars count free courts per half hour) or tap a quick time. "Book 19:30" takes the best free court and falls back to the next if it goes; tapping a court lists its own free starts. * **Grid.** Courts down the rows, half hours across, a now-line, and a duration popover pricing 30 / 60 / 90 / 120 minutes from the cell you tap. Pick a day (14 days, sold-out days struck through), a sport (only the club's sports appear) and a game length. Every choice is in the URL, so a link can open a club, a day or a time. ![VOLT template hall map: a club's padel courts from above, free courts lit in orange for the chosen start time](https://raw.githubusercontent.com/letsopencals/template-volt/main/docs/book-a-court.png) Book a court — every court and open slot on one grid, with a live-priced duration popover ### One request per club A court is its own resource, so availability is per court. Instead of asking for every court on every day from the browser, a server route (`/api/clubs/[locationId]/availability`) reads each court's **merged free ranges for the whole booking window once** (`getCurrentAvailabilitiesMerged` with no date), caches each court for 60 seconds, and drops the cache after a booking, cancel or reschedule. The browser computes the hall map, the grid, the pulse and every "free from" from those spans, so switching day, length, sport or view makes no API calls. ## Crew, kit and the match ticket Checkout is one flow for courts and training: numbered steps that fold up as you go, beside a sticky match card with the running total and hold timer. Courts go **court → crew → kit → details → payment**: name up to three players (an email invites them as appointment guests, and the card shows each player's share), add rackets or balls from the store's add-ons, then pay by card or at the club. After checkout, `/thank-you` shows the **match ticket**: the court from above with a spot per player (doubles, singles or squash), day, time, length, booking reference, kit and a countdown, plus a calendar file, directions, "Before you play", "Getting there" and **"Same time next week?"**. The account keeps every game at every club: stats, the next game as a ticket, past games with "Book again", crew invites, change time and cancel. ## Coach-led training Lessons and classes, per club. Filter the catalog by club, sport, level (Starter → Advanced) and format (1-on-1 or group), then book through the same flow: level, club, coach (or **"Any coach"**), day and start. Group classes show live **"N left"** capacity and let you book more than one place. ![VOLT template training booking flow with coach selection, date strip and time slots showing spots left](https://raw.githubusercontent.com/letsopencals/template-volt/main/docs/training-booking.png) Training booking — level, coach, date and time, with live remaining capacity ## Two resource models, one store This is the part worth copying even if you never ship VOLT itself. | Model | Rule | Capacity | Reads as | | - | - | - | - | | Courts (rentals) | `Self` — staffless resource, one club each | `maxAttendees: 1` | "Padel · Court 3 · 1h 30m" | | Trainings (lessons) | `Staff` — assigned to a coach and clubs | `maxAttendees: 1` or more | "Padel Group Class · Intermediate · Coach Marta" | A singles court is marked in its variant title (`Court 7 · Singles`), and sports come from collections (`padel-courts`, `squash-courts`), so adding a sport or a club is a data change. Orders and appointment detail read naturally either way, so nothing downstream has to decode a court that was faked as a staff member. ## What's inside | Feature | Notes | | - | - | | Multi-club, club-first | Locations endpoints — clubs with coordinates for "Near me"; the chosen club is remembered | | Hall map + grid | Merged availability per court, read once per club and cached; map, grid and pulse computed in the browser | | Custom durations | 30-minute steps to two hours, priced live | | Sports from collections | Product Collections endpoints — a third sport is a data change, not a code change | | Crew-and-kit checkout | Appointment guests for crew emails, custom attributes for names, add-ons for kit | | Match tickets | Confirmation and account tickets with countdown, calendar file and directions | | Coach-led training | Staff Members endpoints — filter by club, sport, level and format; "Any coach" first | | Group capacity | Live "N left" counts from `maxAttendees` | | Add-ons at checkout | Racket and ball rental out of the box | | Custom questions | Checkout questions configured in the dashboard, saved to the appointment | | Cart & Stripe checkout | Cart + Checkout + Payment endpoints, deposits supported | | Passwordless accounts | Self-Service endpoints — 6-digit email login (password fallback), auto-login after checkout, one-time email links via `/link/[token]` | | Video-ready hero | Upgrades to a looping video when `public/videos/hero.mp4` exists, still image otherwise | | SEO | Per-page metadata, Open Graph, `SportsActivityLocation` structured data, `robots.txt`, `sitemap.xml` | | Stack | Next.js 15, TypeScript, Tailwind v4, Framer Motion, `@opencals/storefront-sdk` | ## Get started **1. Clone and install** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} git clone https://github.com/letsopencals/template-volt.git cd template-volt npm install ``` **2. Add your API key** Create a store in the [Opencals dashboard](https://opencals.com) — choose the **VOLT Padel & Squash** dataset preset to seed four clubs with their courts, coaches, training classes and add-ons — then grab a private storefront key (`spk_`, see [API keys](/docs/authentication#api-keys)) and set `OPENCALS_API_KEY` and `AUTH_SECRET` in `.env`. **3. Run it** ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} npm run dev ``` Your real courts, coaches and availability render immediately. **4. Deploy** Push to your own repo and [deploy to Vercel](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fletsopencals%2Ftemplate-volt\&env=OPENCALS_API_KEY,AUTH_SECRET\&envDescription=API%20key%20from%20your%20Opencals%20dashboard%20and%20a%20random%20secret%20for%20auth\&project-name=volt\&repository-name=template-volt), or host anywhere Next.js runs. > [!NOTE] > > Set **Storefront Base URL** in your dashboard (Settings → API) to your > deployed domain. Every customer link — view, reschedule, cancel, leave > feedback — is built as `{storefrontBaseUrl}/link/{token}`, so if it still > points at localhost those emailed links go nowhere. ## Make it yours MIT-licensed: rebrand it, restructure it, or use it as a starting point for client work. All copy lives in `lib/site-config.ts`: brand name, sports and their colours, club photos, taglines, hours and phones (matched to your locations by slug or city), hero, coaches, gallery, stats, testimonials and FAQs. Clubs, courts, prices and availability always come from your store. Every colour and font is a Tailwind v4 `@theme` token in `app/globals.css`, so components keep working when you change values: ```css theme={"theme":{"light":"github-light","dark":"github-dark-default"}} @theme { --color-bg: #0A0A0A; /* near-black page background */ --color-primary: #FF4A1C; /* electric-orange accent */ --font-display: 'JetBrains Mono', ui-monospace, monospace; } ``` Keep the accent aligned with your store's storefront primary colour so booking emails match the site. Agencies can run one codebase against multiple stores — each deployment points at a different API key. To go deeper than theming, follow the [booking page tutorial](/docs/guides/build-a-booking-page) to see the API calls behind each screen. # Quickstart Source: https://opencals.com/docs/quickstart What the Opencals Storefront API is, how to get an API key, and how to make your first request. The Opencals Storefront API is a REST booking API for developers. It exposes everything a booking website needs — services, real-time availability, staff members, locations, carts, checkout, and payments — so you can build a fully custom booking experience on any stack while Opencals handles scheduling logic, conflict prevention, and order management. Everything you configure in the Opencals dashboard is available over the API. ## Base URL All Storefront API endpoints live under a single base URL: ```text theme={"theme":{"light":"github-light","dark":"github-dark-default"}} https://api.opencals.com ``` Endpoint paths are prefixed with `/storefront` — for example `GET /storefront/products` lists your bookable services. Responses are JSON with camelCase property names. ## Make your first request **1. Get an API key** 1. Sign up at [opencals.com](https://opencals.com) and set up your store — services, staff members, locations, and schedules. 2. In the dashboard, go to **Users → your user → API Keys** and create a key. Calling the API from a server? Create a **private storefront key** (`spk_`). For browser code, create a **public storefront key** (`sfk_`). 3. Each key is scoped to your store. See [API keys](/docs/authentication#api-keys) for the difference. > [!WARNING] > > Keep a private key server-side (for example in an environment variable), never in browser code. **2. List your services** List your store's active services with a single call: ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} curl "https://api.opencals.com/storefront/products" \ -H "X-Api-Key: sfk_your_key_here" ``` **3. Read the response** The response is a paginated collection: ```json theme={"theme":{"light":"github-light","dark":"github-dark-default"}} { "data": [ { "id": "9c6f7c2e-…", "title": "Haircut", "duration": 3600, "price": 4500, "maxAttendees": 1 } ], "meta": { "page": 1, "take": 50, "itemCount": 12, "pageCount": 1, "hasPreviousPage": false, "hasNextPage": false } } ``` You can also try every endpoint directly in the [interactive API reference](/docs/api-reference/introduction). ## Pagination List endpoints accept `page` (1-indexed) and `take` (items per page, maximum 100) query parameters and return a `meta` object with `page`, `take`, `itemCount`, `pageCount`, `hasPreviousPage`, and `hasNextPage`. ```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}} curl "https://api.opencals.com/storefront/products" \ -H "X-Api-Key: sfk_your_key_here" \ --url-query "page=2" \ --url-query "take=20" ``` ## Rate limits Limits are per API key and visitor IP, never a total for your store, so a busy site isn't capped. The visitor IP is the buyer IP your server forwards with a private key ([`X-Opencals-Buyer-Ip`](/docs/authentication#forward-the-buyer-s-ip)); otherwise it's the IP the request comes from, which for a server-side site is your server's, shared by all your visitors. | Category | Limit | | - | - | | General | 50 requests / second, 300 / 10 seconds, 1,200 / minute | | Sign-up | 3 per buyer IP / 10 minutes (30 per IP when the buyer IP isn't forwarded) | | Emails: verification, password reset, login code | 3 per email address and 10 per buyer IP / 10 minutes (30 per IP when not forwarded) | | Sign-in, login-code check | 10 per email address and 30 per buyer IP / 10 minutes (60 per IP when not forwarded) | | Verify email, reset password, magic links, OAuth | 30 per buyer IP / 10 minutes (60 per IP when not forwarded) | When you exceed a limit the API responds with `429 Too Many Requests`. Back off and retry; the windows are short. ## Timezones > [!NOTE] > > All date and time values in requests and responses are in **UTC**. Availability endpoints accept a `timezone` query parameter (for example `America/New_York`) to return slots in the user's local timezone. Convert user-selected times back to UTC before creating appointments. ## Next steps > [card] [Authentication](/docs/authentication) > > API keys, customer tokens, and error responses. > [card] [Build a booking page](/docs/guides/build-a-booking-page) > > The full flow from listing services to a confirmed booking. > [card] [Storefront SDK](/docs/guides/storefront-sdk) > > The typed TypeScript client for this API. > [card] [API reference](/docs/api-reference/introduction) > > Every endpoint, parameter, and response shape.