{
  "openapi": "3.1.0",
  "info": {
    "title": "BeniBrain Public Integration API",
    "version": "2026-11-23",
    "description": "The public and authenticated-customer surface of the BeniBrain API: storefront catalogue and checkout, service booking, and outbound webhook management. This document is generated from the same source of truth used for BeniBrain's internal client codegen (lib/api-spec/openapi.yaml), filtered to the operations that are safe and supported for external integration. Internal, owner-authenticated, and platform-only endpoints are intentionally excluded."
  },
  "servers": [
    {
      "url": "https://benibrain.com/api",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "storePublic",
      "description": "Storefront catalogue, checkout, orders, reviews and loyalty (no auth beyond a business's public apiKey)"
    },
    {
      "name": "bookingPublic",
      "description": "Public service booking pages: services, staff, availability and bookings (apiKey-scoped, no auth)"
    },
    {
      "name": "webhooks",
      "description": "Outbound webhook endpoint management for a business's own integrations (requires an authenticated BeniBrain business session)"
    },
    {
      "name": "websiteIntegration",
      "description": "Connected website registration: tell BeniBrain where your own site hosts product, collection and service pages so customer links (e.g. booking-email recommendations) point there (requires an authenticated BeniBrain business session)"
    }
  ],
  "paths": {
    "/integrations/website": {
      "get": {
        "operationId": "getConnectedWebsite",
        "tags": [
          "websiteIntegration"
        ],
        "summary": "Get the connected website registered for the authenticated business",
        "description": "Returns the website origin and route templates BeniBrain uses to link customers to the\nbusiness's own product, collection and service pages (for example in booking confirmation\nemails). `website` is `null` when no website is connected; customers are then sent to the\nBeniBrain-hosted storefront where a hosted page exists, and links with no destination are omitted.\n",
        "responses": {
          "200": {
            "description": "The connected website, if any",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectedWebsiteResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Only business owners may manage the connected website"
          }
        }
      },
      "put": {
        "operationId": "registerConnectedWebsite",
        "tags": [
          "websiteIntegration"
        ],
        "summary": "Register or replace the connected website's origin and route templates",
        "description": "Route templates are root-relative paths containing `{id}` and/or `{slug}` placeholders,\nalways resolved under `origin`. Use `{id}` for the BeniBrain identifier (available for every\nproduct, collection and service) and `{slug}` where your site keys pages by slug\n(collections have slugs; products and services currently do not, so a `{slug}` template for\nthose kinds produces no link). Omit a route to tell BeniBrain not to link to that kind of page\nat all. Once a website is connected, BeniBrain links only to it — never to the hosted storefront.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectedWebsiteInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Registered website",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectedWebsiteResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation error (`field` names the offending property)"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Only business owners may manage the connected website"
          }
        }
      },
      "delete": {
        "operationId": "disconnectWebsite",
        "tags": [
          "websiteIntegration"
        ],
        "summary": "Disconnect the website; links fall back to the BeniBrain-hosted storefront where one exists",
        "responses": {
          "200": {
            "description": "Disconnected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectedWebsiteResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Only business owners may manage the connected website"
          }
        }
      }
    },
    "/public/booking/address-suggestions": {
      "get": {
        "operationId": "suggestPublicBookingAddresses",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Addresses matching what the customer has typed so far",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "session",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "A random id kept for one address entry"
          }
        ],
        "responses": {
          "200": {
            "description": "Up to five suggestions; empty when suggestions aren't available",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "suggestions"
                  ],
                  "properties": {
                    "credit": {
                      "type": "string",
                      "description": "The lookup service's name to show under the suggestions, as its terms ask"
                    },
                    "suggestions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id",
                          "text"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "text": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/public/booking/available-days": {
      "get": {
        "operationId": "getPublicBookingAvailableDays",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Which days have any bookable time for a service, for a calendar view",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "serviceId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "First day, YYYY-MM-DD in the business timezone"
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 42
            },
            "description": "How many days to check (default 31)"
          },
          {
            "name": "agentId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "selectedChoiceIds",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "style": "form",
            "explode": true
          },
          {
            "name": "lat",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "For a business that travels, the latitude of the customer's address (from /public/booking/locate). Times that don't leave room to drive between jobs are left out."
          },
          {
            "name": "lng",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "equipmentCount",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10
            },
            "description": "For a service priced per machine, how many machines (times allow for all of them)"
          }
        ],
        "responses": {
          "200": {
            "description": "Availability for each day",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingAvailableDays"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Unknown business or service",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/booking/bookings": {
      "post": {
        "operationId": "createPublicBooking",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Create a booking from the public booking page",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicBookingInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Replay of the exact same gift-card-funded booking request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingConfirmation"
                }
              }
            }
          },
          "201": {
            "description": "Created booking",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingConfirmation"
                }
              }
            }
          },
          "409": {
            "description": "Slot no longer available, or the booking policy changed since the customer was quoted (re-fetch the quote and require fresh acceptance before retrying)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/booking/enquiries": {
      "post": {
        "operationId": "createWebsiteEnquiry",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Send an enquiry from the business's website to its Inbox",
        "description": "For a contact form, or a job the business can't book online (for example an address outside the area it covers). The customer is added to the business's Customers (or matched by email), and the message, with any address and phone number, opens a conversation in the Inbox. Leave `website` empty: it is a hidden field for catching bots.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebsiteEnquiryInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The enquiry is in the Inbox",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebsiteEnquiryReceived"
                }
              }
            }
          },
          "400": {
            "description": "A field needs fixing (the message says which)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Unknown business",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/booking/info": {
      "get": {
        "operationId": "getPublicBookingInfo",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Get business info and active services for the public booking page",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Booking page info",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingInfo"
                }
              }
            }
          },
          "404": {
            "description": "Unknown business",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/booking/locate": {
      "get": {
        "operationId": "locatePublicBookingAddress",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Find the customer's address on the map, for a business that travels to its customers",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "address",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "placeId",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "The id of a suggestion the customer picked, in place of looking up the address text"
          },
          {
            "name": "session",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "The same random id sent with the suggestions"
          }
        ],
        "responses": {
          "200": {
            "description": "The address, where it is, and whether the business covers it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingLocation"
                }
              }
            }
          },
          "400": {
            "description": "Address missing, or the business doesn't travel",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Address not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Address lookup unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/booking/manage/{token}": {
      "get": {
        "operationId": "getPublicBookingManageInfo",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Get booking status and cancellation/reschedule policy for the customer manage-booking page",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Manage-booking info",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingManageInfo"
                }
              }
            }
          },
          "404": {
            "description": "Link invalid or expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/booking/manage/{token}/available-days": {
      "get": {
        "operationId": "getPublicBookingManageAvailableDays",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Days with free times for moving this booking",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The next eight weeks",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingAvailableDays"
                }
              }
            }
          },
          "404": {
            "description": "Invalid or expired link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/booking/manage/{token}/cancel": {
      "post": {
        "operationId": "cancelPublicBookingManage",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Cancel a booking from the customer manage-booking page",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicBookingManageCancelInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Cancellation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingManageCancelResult"
                }
              }
            }
          },
          "404": {
            "description": "Link invalid or expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Booking cannot be cancelled",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/booking/manage/{token}/reschedule": {
      "post": {
        "operationId": "reschedulePublicBookingManage",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Reschedule a booking from the customer manage-booking page",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicBookingManageRescheduleInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reschedule result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingManageRescheduleResult"
                }
              }
            }
          },
          "400": {
            "description": "Invalid startsAt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Link invalid or expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Booking cannot be rescheduled or the requested slot is unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/booking/manage/{token}/slots/{date}": {
      "get": {
        "operationId": "getPublicBookingManageSlots",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Free times on a day for moving this booking",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "date",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Free times",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TimeSlot"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Invalid or expired link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/booking/my-bookings": {
      "get": {
        "operationId": "listMyBookings",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Bookings belonging to the signed-in customer (this business only)",
        "description": "Uses the same verified `store_customer_session` cookie as `GET /public/store/my-orders` — no separate booking-specific sign-in. A guest booking made with the same email address appears automatically once that email is verified. Results are capped at 200 bookings.",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "upcoming",
                "past"
              ]
            },
            "description": "Omit to return both, upcoming ascending by start time followed by past descending."
          }
        ],
        "responses": {
          "200": {
            "description": "The customer's bookings for this business",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CustomerBooking"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/booking/my-bookings/{id}/manage-link": {
      "post": {
        "operationId": "createMyBookingManageLink",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Issue a fresh \"Manage booking\" link for one of the signed-in customer's own bookings",
        "description": "`apiKey` is sent in the JSON body rather than the query string, since this operation already has a path parameter and orval codegen cannot combine a path and a query parameter on the same operation. Issuing a new link creates a fresh independent opaque management token. Previously issued valid links are not revoked merely because another link is issued. Any failure (wrong session, booking not owned, or not currently eligible for self-service cancellation/reschedule) returns an opaque 404.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerBookingManageLinkInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A fresh manage-booking link",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerBookingManageLink"
                }
              }
            }
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Booking not found, not owned by this customer, or not currently manageable online",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/booking/my-equipment": {
      "get": {
        "operationId": "listMyEquipment",
        "tags": [
          "bookingPublic"
        ],
        "summary": "The signed-in customer's saved machines, to pick one when booking",
        "description": "Uses the `store_customer_session` cookie. Not signed in returns `signedIn: false` and no machines (not an error). Pick one on a booking with `equipment: [{ \"equipmentId\": \"<id>\" }]`.",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Saved machines, most recently used first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerEquipmentList"
                }
              }
            }
          }
        }
      }
    },
    "/public/booking/my-invoices": {
      "get": {
        "operationId": "listMyInvoices",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Invoices belonging to the signed-in customer (this business only), with view and pay links",
        "description": "Uses the same verified `store_customer_session` cookie as `GET /public/booking/my-bookings`. Only invoices that have been sent are listed (never drafts), newest first, up to 100. `payUrl` is set while an invoice has something left to pay; `viewUrl` opens BeniBrain's invoice page, where the customer can download the PDF and pay.",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The customer's invoices for this business",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerInvoiceList"
                }
              }
            }
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/booking/quote": {
      "post": {
        "operationId": "getPublicBookingQuote",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Get the authoritative resolved price/deposit/duration quote for a service and selected option choices",
        "description": "Reuses exactly the same server-side pricing/duration engine as `/public/booking/slots` and booking creation, so a connected website never re-implements option-price or deposit maths and the values here always agree with what creating the booking will charge and reserve.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicBookingQuoteInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Resolved quote",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingQuote"
                }
              }
            }
          },
          "400": {
            "description": "Invalid or unavailable option selection",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Unknown business or service",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/booking/slots": {
      "get": {
        "operationId": "getPublicBookingSlots",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Get available time slots for a service on a date",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "serviceId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "date",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "YYYY-MM-DD in the business timezone"
          },
          {
            "name": "agentId",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter slots by a specific agent's availability"
          },
          {
            "name": "selectedChoiceIds",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "style": "form",
            "explode": true,
            "description": "Selected active option choice IDs used to calculate duration"
          },
          {
            "name": "lat",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "For a business that travels, the latitude of the customer's address (from /public/booking/locate). Times that don't leave room to drive between jobs are left out."
          },
          {
            "name": "lng",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "equipmentCount",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10
            },
            "description": "For a service priced per machine, how many machines (times allow for all of them)"
          }
        ],
        "responses": {
          "200": {
            "description": "Available slots",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TimeSlot"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/public/booking/staff": {
      "get": {
        "operationId": "getPublicServiceAgents",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Get agents available for a service (for the public staff picker)",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "serviceId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Agents",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/StaffMember"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/public/booking/{apiKey}/bookings/{id}": {
      "get": {
        "operationId": "getPublicBookingStatus",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Get authoritative booking and payment status for a booking success page",
        "parameters": [
          {
            "name": "apiKey",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Public-safe booking status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicBookingStatus"
                }
              }
            }
          },
          "404": {
            "description": "Booking not found for this business"
          }
        }
      }
    },
    "/public/business/contact": {
      "get": {
        "operationId": "getPublicBusinessContact",
        "tags": [
          "bookingPublic"
        ],
        "summary": "How customers can reach the business",
        "description": "Phone, email, address (only for a business customers visit), weekly opening hours, upcoming closed dates and social links, as shown in the Contact panel of the booking page and shop.",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Contact details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "name",
                    "timezone",
                    "acceptsMessages"
                  ],
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "phone": {
                      "type": "string",
                      "nullable": true
                    },
                    "email": {
                      "type": "string",
                      "nullable": true
                    },
                    "website": {
                      "type": "string",
                      "nullable": true
                    },
                    "address": {
                      "type": "string",
                      "nullable": true
                    },
                    "timezone": {
                      "type": "string"
                    },
                    "country": {
                      "type": "string",
                      "enum": [
                        "GB",
                        "US"
                      ],
                      "description": "How times and dates are written for this business's customers"
                    },
                    "hours": {
                      "type": "array",
                      "nullable": true,
                      "items": {
                        "type": "object",
                        "properties": {
                          "day": {
                            "type": "integer"
                          },
                          "name": {
                            "type": "string"
                          },
                          "closed": {
                            "type": "boolean"
                          },
                          "windows": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "open": {
                                  "type": "string"
                                },
                                "close": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "closedDates": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "date": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string",
                            "nullable": true
                          },
                          "from": {
                            "type": "string",
                            "nullable": true
                          },
                          "until": {
                            "type": "string",
                            "nullable": true
                          }
                        }
                      }
                    },
                    "socialLinks": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "acceptsMessages": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Unknown business",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/commerce/attachments": {
      "post": {
        "operationId": "uploadBuyerExtraAttachment",
        "tags": [
          "storePublic"
        ],
        "summary": "Upload a private buyer field attachment",
        "description": "Sends raw file bytes for an active item and file field. The server validates size, type and signature; the returned token is scoped to the item and field and expires after 72 hours if unused.",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "itemKind",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "product",
                "service"
              ]
            }
          },
          {
            "name": "itemId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customizationId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "name",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mime",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "image/jpeg",
                "image/png",
                "image/webp",
                "application/pdf"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary",
                "maxLength": 5242880
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Private attachment accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BuyerExtraUploadResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid item, file field, size or file contents"
          },
          "404": {
            "description": "Item or file field is unavailable"
          },
          "413": {
            "description": "File exceeds the upload limit"
          },
          "429": {
            "description": "Upload limit reached"
          },
          "503": {
            "description": "Private storage is temporarily unavailable"
          }
        }
      }
    },
    "/public/order/{token}": {
      "get": {
        "operationId": "getPublicOrderInfo",
        "tags": [
          "bookingPublic"
        ],
        "summary": "Get order status, items, payment, fulfilment and tracking info for the customer order page",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Public-safe order info",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicOrderInfo"
                }
              }
            }
          },
          "404": {
            "description": "Link invalid or expired",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/store/auth/logout": {
      "post": {
        "operationId": "customerLogout",
        "tags": [
          "storePublic"
        ],
        "summary": "Sign the storefront customer out",
        "responses": {
          "200": {
            "description": "Signed out",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OkResult"
                }
              }
            }
          }
        }
      }
    },
    "/public/store/auth/request-code": {
      "post": {
        "operationId": "requestCustomerSignInCode",
        "tags": [
          "storePublic"
        ],
        "summary": "Email a one-time sign-in code to a storefront customer",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerSignInRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Code sent (always, to avoid account enumeration)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerSignInRequestResult"
                }
              }
            }
          },
          "404": {
            "description": "Store not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/store/auth/session": {
      "get": {
        "operationId": "getCustomerSession",
        "tags": [
          "storePublic"
        ],
        "summary": "Current storefront customer session (email or null)",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Session state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerSessionState"
                }
              }
            }
          }
        }
      }
    },
    "/public/store/auth/verify": {
      "post": {
        "operationId": "verifyCustomerSignInCode",
        "tags": [
          "storePublic"
        ],
        "summary": "Verify a one-time code and start a customer session",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerSignInVerify"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Signed in; session cookie set",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerSession"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or expired code",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/store/checkout": {
      "post": {
        "operationId": "createStoreCheckout",
        "tags": [
          "storePublic"
        ],
        "summary": "Create a checkout for a cart (Stripe Checkout or test-mode order)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StoreCheckoutInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Checkout created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoreCheckoutResponse"
                }
              }
            }
          },
          "409": {
            "description": "Insufficient stock",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/store/info": {
      "get": {
        "operationId": "getPublicStoreInfo",
        "tags": [
          "storePublic"
        ],
        "summary": "Public storefront info (business + products)",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Storefront info",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicStoreInfo"
                }
              }
            }
          },
          "404": {
            "description": "Unknown store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/store/loyalty": {
      "get": {
        "operationId": "getPublicLoyaltyStatus",
        "tags": [
          "storePublic"
        ],
        "summary": "Get loyalty points balance and program settings for the signed-in storefront customer",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Loyalty status for the signed-in customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoyaltyStatus"
                }
              }
            }
          },
          "401": {
            "description": "Storefront customer sign-in required",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Store not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/store/my-gift-cards": {
      "get": {
        "operationId": "listMyGiftCards",
        "tags": [
          "storePublic"
        ],
        "summary": "Gift cards addressed to the verified customer of this business",
        "description": "Private cookie-authenticated recipient history, including purchased and complimentary cards. Balances are integer minor units, read from existing records. No expiry. Email is derived from the verified session, never a query parameter. Selection does not reserve value.",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Private recipient gift-card history, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CustomerGiftCard"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Verified customer session required for this business",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Unknown business",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/store/my-orders": {
      "get": {
        "operationId": "listMyStoreOrders",
        "tags": [
          "storePublic"
        ],
        "summary": "Orders belonging to the signed-in storefront customer",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The customer's orders, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CustomerOrder"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/store/order": {
      "get": {
        "operationId": "getPublicOrder",
        "tags": [
          "storePublic"
        ],
        "summary": "Get an order confirmation summary (public)",
        "description": "Authenticated by the opaque order-access token returned from checkout (`orderToken`) — never the raw order id, which is never a valid customer access credential on its own.",
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Order summary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicOrderSummary"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/store/related": {
      "get": {
        "operationId": "listRelatedProducts",
        "tags": [
          "storePublic"
        ],
        "summary": "Up to 4 related in-stock products for a product",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Related products, best match first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RelatedProduct"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Unknown store or product",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/store/reviews": {
      "get": {
        "operationId": "listPublicProductReviews",
        "tags": [
          "storePublic"
        ],
        "summary": "List approved reviews for a product",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Approved reviews, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PublicProductReview"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Unknown store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "submitProductReview",
        "tags": [
          "storePublic"
        ],
        "summary": "Submit a product review (purchase-verified, rate limited)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProductReviewInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Review submitted for moderation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductReviewSubmitResult"
                }
              }
            }
          },
          "403": {
            "description": "No qualifying purchase found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Already reviewed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/store/share": {
      "get": {
        "operationId": "getStoreSharePage",
        "tags": [
          "storePublic"
        ],
        "summary": "Server-rendered HTML share page with Open Graph tags (for social crawlers; redirects humans to the storefront)",
        "parameters": [
          {
            "name": "apiKey",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "productId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "HTML document carrying meta/OG/Twitter tags and a redirect to the storefront",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "Unknown store",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/public/store/validate-discount": {
      "post": {
        "operationId": "validateDiscountCode",
        "tags": [
          "storePublic"
        ],
        "summary": "Validate a discount code and preview the discount (rate limited)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DiscountValidateInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Validation result (valid=false includes a reason)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DiscountValidateResult"
                }
              }
            }
          },
          "404": {
            "description": "Unknown store",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/public/store/validate-gift-card": {
      "post": {
        "operationId": "validateGiftCard",
        "tags": [
          "storePublic"
        ],
        "summary": "Validate a gift card and return its available balance (rate limited)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GiftCardValidateInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Gift-card validation result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GiftCardValidateResult"
                }
              }
            }
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "tags": [
          "webhooks"
        ],
        "summary": "List webhook endpoints for the authenticated business",
        "responses": {
          "200": {
            "description": "List of webhooks",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WebhookEndpoint"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        }
      },
      "post": {
        "operationId": "createWebhook",
        "tags": [
          "webhooks"
        ],
        "summary": "Register a new webhook endpoint",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Webhook created (secret included only at creation time)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointWithSecret"
                }
              }
            }
          },
          "400": {
            "description": "Validation error"
          }
        }
      }
    },
    "/webhooks/{id}": {
      "patch": {
        "operationId": "updateWebhook",
        "tags": [
          "webhooks"
        ],
        "summary": "Update a webhook endpoint",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated webhook",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpoint"
                }
              }
            }
          },
          "404": {
            "description": "Not found"
          }
        }
      },
      "delete": {
        "operationId": "deleteWebhook",
        "tags": [
          "webhooks"
        ],
        "summary": "Delete a webhook endpoint",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/webhooks/{id}/deliveries": {
      "get": {
        "operationId": "listWebhookDeliveries",
        "tags": [
          "webhooks"
        ],
        "summary": "List recent delivery attempts for a webhook",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Delivery logs",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDeliveryPage"
                }
              }
            }
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/webhooks/{id}/deliveries/{deliveryId}": {
      "get": {
        "operationId": "getWebhookDelivery",
        "tags": [
          "webhooks"
        ],
        "summary": "Get safe delivery diagnostics",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "deliveryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Delivery detail with sensitive headers redacted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDeliveryDetail"
                }
              }
            }
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/webhooks/{id}/rotate-secret": {
      "post": {
        "operationId": "rotateWebhookSecret",
        "tags": [
          "webhooks"
        ],
        "summary": "Rotate an endpoint signing secret",
        "description": "Returns the new secret once. Existing integrations must be updated immediately.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Secret rotated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookRotatedSecret"
                }
              }
            }
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/webhooks/{id}/test": {
      "post": {
        "operationId": "testWebhook",
        "tags": [
          "webhooks"
        ],
        "summary": "Send a test payload to the webhook endpoint",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Test delivered successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "statusCode"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "statusCode": {
                      "type": "number"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found"
          },
          "502": {
            "description": "Delivery failed"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AppointmentPlace": {
        "type": "object",
        "required": [
          "name",
          "address",
          "mapsUrl"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "address": {
            "type": "string",
            "description": "One line, e.g. 12 Mill Lane, Leeds LS1 4AB"
          },
          "mapsUrl": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "BookingRefundStatus": {
        "type": "string",
        "enum": [
          "not_required",
          "queued",
          "pending",
          "unknown",
          "requires_action",
          "succeeded",
          "failed",
          "canceled",
          "attention",
          "historical_unknown"
        ]
      },
      "BookingRefundSummary": {
        "type": "object",
        "required": [
          "status",
          "amountPence",
          "currency",
          "refundedPence",
          "updatedAt"
        ],
        "properties": {
          "status": {
            "$ref": "#/components/schemas/BookingRefundStatus"
          },
          "amountPence": {
            "type": [
              "number",
              "null"
            ],
            "description": "Frozen eligible refund amount in minor units, or null when no amount is established"
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "refundedPence": {
            "type": "number",
            "description": "Provider-verified effective refunded amount in minor units; returned funds reduce this amount"
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "BuyerExtraAttachment": {
        "type": "object",
        "required": [
          "attachmentId",
          "name",
          "mime",
          "size"
        ],
        "properties": {
          "attachmentId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "mime": {
            "type": "string"
          },
          "size": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5242880
          }
        }
      },
      "BuyerExtraChoice": {
        "type": "object",
        "required": [
          "id",
          "label",
          "priceDelta"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "priceDelta": {
            "type": "number",
            "minimum": 0
          }
        }
      },
      "BuyerExtraDefinition": {
        "type": "object",
        "required": [
          "id",
          "name",
          "type",
          "required",
          "priceDelta",
          "choices"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "type": {
            "type": "string",
            "enum": [
              "text",
              "textarea",
              "checkbox",
              "radio",
              "dropdown",
              "multiselect",
              "number",
              "date",
              "file"
            ]
          },
          "required": {
            "type": "boolean"
          },
          "priceDelta": {
            "type": "number",
            "minimum": 0
          },
          "maxLength": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 1,
            "maximum": 5000
          },
          "minSelections": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 20
          },
          "maxSelections": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 1,
            "maximum": 20
          },
          "helpText": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000
          },
          "placeholder": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000
          },
          "rules": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BuyerExtraRules"
              },
              {
                "type": "null"
              }
            ]
          },
          "sortOrder": {
            "type": "number"
          },
          "choices": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/BuyerExtraChoice"
            }
          }
        }
      },
      "BuyerExtraRules": {
        "type": "object",
        "properties": {
          "min": {
            "type": "number"
          },
          "max": {
            "type": "number"
          },
          "maxBytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5242880
          },
          "allowedMimeTypes": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "type": "string",
              "enum": [
                "image/jpeg",
                "image/png",
                "image/webp",
                "application/pdf"
              ]
            }
          }
        }
      },
      "BuyerExtraUploadResponse": {
        "type": "object",
        "required": [
          "fileToken",
          "attachment"
        ],
        "properties": {
          "fileToken": {
            "type": "string",
            "description": "Private submission token valid for this tenant, item and field. Keep out of URLs and public media."
          },
          "attachment": {
            "$ref": "#/components/schemas/BuyerExtraAttachment"
          }
        }
      },
      "CancellationConsequence": {
        "type": "object",
        "required": [
          "hasPayment",
          "refundable",
          "amountPence",
          "currency",
          "withinNoticeWindow",
          "noticeHours",
          "message"
        ],
        "properties": {
          "hasPayment": {
            "type": "boolean",
            "description": "Whether there is any paid, not-yet-released amount at stake"
          },
          "refundable": {
            "type": "boolean",
            "description": "Whether cancelling now would result in a refund"
          },
          "amountPence": {
            "type": [
              "number",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "withinNoticeWindow": {
            "type": "boolean"
          },
          "noticeHours": {
            "type": "number"
          },
          "message": {
            "type": "string",
            "description": "Human-readable sentence stating the exact financial consequence, safe to render verbatim"
          }
        }
      },
      "ConnectedWebsite": {
        "type": "object",
        "required": [
          "origin",
          "productPath",
          "collectionPath",
          "servicePath",
          "orderPath",
          "updatedAt"
        ],
        "properties": {
          "origin": {
            "type": "string"
          },
          "productPath": {
            "type": [
              "string",
              "null"
            ]
          },
          "collectionPath": {
            "type": [
              "string",
              "null"
            ]
          },
          "servicePath": {
            "type": [
              "string",
              "null"
            ]
          },
          "orderPath": {
            "type": [
              "string",
              "null"
            ]
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ConnectedWebsiteInput": {
        "type": "object",
        "required": [
          "origin"
        ],
        "properties": {
          "origin": {
            "type": "string",
            "description": "The website's https origin with no path, e.g. https://www.example.com",
            "example": "https://www.example.com"
          },
          "productPath": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "Root-relative product page template, e.g. /shop/{id}",
            "example": "/shop/{id}"
          },
          "collectionPath": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "Where customers go when BeniBrain links to a product collection. Root-relative, may be a dedicated page (/collections/{slug}) or the business's normal shop with the collection pre-selected via a query parameter (/shop?collection={slug}).",
            "example": "/shop?collection={slug}"
          },
          "servicePath": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "Root-relative service page template, e.g. /services/{id}",
            "example": "/services/{id}"
          },
          "orderPath": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200,
            "description": "Root-relative order-status page template. Must use the opaque {token} placeholder (never {id} or {slug}) — the raw order id is never a customer access credential.",
            "example": "/orders/{token}"
          }
        }
      },
      "ConnectedWebsiteResponse": {
        "type": "object",
        "required": [
          "website",
          "usable"
        ],
        "properties": {
          "website": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ConnectedWebsite"
              },
              {
                "type": "null"
              }
            ]
          },
          "usable": {
            "type": "boolean",
            "description": "Whether the stored registration passes current validation and will be used to build links."
          }
        }
      },
      "CustomerBooking": {
        "type": "object",
        "required": [
          "id",
          "createdAt",
          "startsAt",
          "endsAt",
          "timezone",
          "durationMinutes",
          "status",
          "timeframe",
          "cancellationReason",
          "service",
          "selectedOptions",
          "staff",
          "location",
          "pricing",
          "manage"
        ],
        "properties": {
          "arrivalWindowStart": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "For a business that gives arrival windows, the start of the window the customer was told"
          },
          "arrivalWindowEnd": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "id": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "startsAt": {
            "type": "string"
          },
          "endsAt": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          },
          "durationMinutes": {
            "type": "number"
          },
          "status": {
            "type": "string"
          },
          "timeframe": {
            "type": "string",
            "enum": [
              "upcoming",
              "past"
            ]
          },
          "cancellationReason": {
            "type": [
              "string",
              "null"
            ]
          },
          "service": {
            "$ref": "#/components/schemas/CustomerBookingService"
          },
          "selectedOptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerBookingSelectedOption"
            }
          },
          "staff": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CustomerBookingStaff"
              },
              {
                "type": "null"
              }
            ]
          },
          "location": {
            "type": [
              "string",
              "null"
            ]
          },
          "pricing": {
            "$ref": "#/components/schemas/CustomerBookingPricing"
          },
          "manage": {
            "$ref": "#/components/schemas/CustomerBookingManageAvailability"
          }
        }
      },
      "CustomerBookingManageAvailability": {
        "type": "object",
        "required": [
          "available",
          "reason"
        ],
        "properties": {
          "available": {
            "type": "boolean"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CustomerBookingManageLink": {
        "type": "object",
        "required": [
          "manageUrl",
          "expiresAt"
        ],
        "properties": {
          "manageUrl": {
            "type": "string"
          },
          "expiresAt": {
            "type": "string"
          }
        }
      },
      "CustomerBookingManageLinkInput": {
        "type": "object",
        "required": [
          "apiKey"
        ],
        "properties": {
          "apiKey": {
            "type": "string"
          }
        }
      },
      "CustomerBookingPricing": {
        "type": "object",
        "required": [
          "currency",
          "serviceTotalPence",
          "depositRequiredPence",
          "amountPaidPence",
          "balanceDuePence",
          "paymentStatus"
        ],
        "properties": {
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "serviceTotalPence": {
            "type": [
              "number",
              "null"
            ]
          },
          "depositRequiredPence": {
            "type": [
              "number",
              "null"
            ]
          },
          "amountPaidPence": {
            "type": "number"
          },
          "balanceDuePence": {
            "type": [
              "number",
              "null"
            ]
          },
          "paymentStatus": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CustomerBookingSelectedOption": {
        "type": "object",
        "required": [
          "groupName",
          "choiceName"
        ],
        "properties": {
          "groupName": {
            "type": "string"
          },
          "choiceName": {
            "type": "string"
          }
        }
      },
      "CustomerBookingService": {
        "type": "object",
        "required": [
          "id",
          "name",
          "imageUrl"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "imageUrl": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CustomerBookingStaff": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string"
          }
        }
      },
      "CustomerEquipmentList": {
        "type": "object",
        "required": [
          "signedIn",
          "equipment"
        ],
        "properties": {
          "signedIn": {
            "type": "boolean"
          },
          "email": {
            "type": "string"
          },
          "equipment": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "title"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "title": {
                  "type": "string",
                  "description": "e.g. \"Husqvarna Z254F\""
                },
                "details": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  },
                  "description": "Answers by equipment question id"
                }
              }
            }
          }
        }
      },
      "CustomerGiftCard": {
        "type": "object",
        "required": [
          "id",
          "code",
          "remainingBalancePence",
          "heldBalancePence",
          "currency",
          "status",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "description": "Private bearer redemption code; never log or persist in browser storage."
          },
          "remainingBalancePence": {
            "type": "integer",
            "minimum": 0,
            "description": "Currently available value in the currency's minor unit, after reservations."
          },
          "heldBalancePence": {
            "type": "integer",
            "minimum": 0,
            "description": "Existing pending checkout reservations; displayed separately, not extra spendable value."
          },
          "currency": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "available",
              "reserved",
              "fully_used",
              "deactivated"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CustomerInvoice": {
        "type": "object",
        "required": [
          "id",
          "reference",
          "status",
          "currency",
          "total",
          "amountPaid",
          "balanceDue",
          "viewUrl"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "reference": {
            "type": "string",
            "description": "The invoice number as printed, e.g. INV-0042"
          },
          "status": {
            "type": "string",
            "enum": [
              "sent",
              "overdue",
              "paid",
              "void"
            ]
          },
          "issuedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "dueDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "paidAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "currency": {
            "type": "string"
          },
          "total": {
            "type": "number",
            "description": "In major units (dollars), including tax"
          },
          "amountPaid": {
            "type": "number"
          },
          "balanceDue": {
            "type": "number"
          },
          "viewUrl": {
            "type": "string",
            "description": "BeniBrain's page for this invoice (view, PDF, pay)"
          },
          "payUrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "Card payment page, while something is left to pay"
          }
        }
      },
      "CustomerInvoiceList": {
        "type": "object",
        "required": [
          "invoices"
        ],
        "properties": {
          "invoices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerInvoice"
            }
          }
        }
      },
      "CustomerOrder": {
        "type": "object",
        "required": [
          "id",
          "status",
          "customerName",
          "customerEmail",
          "totalAmount",
          "currency",
          "isTestMode",
          "items",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "customerName": {
            "type": "string"
          },
          "customerEmail": {
            "type": "string"
          },
          "totalAmount": {
            "type": "number"
          },
          "currency": {
            "type": "string"
          },
          "refundedAmount": {
            "description": "Successfully refunded amount in major currency units.",
            "type": "number"
          },
          "hasPendingRefund": {
            "description": "True when at least one refund is still pending.",
            "type": "boolean"
          },
          "isTestMode": {
            "type": "boolean"
          },
          "taxAmount": {
            "type": [
              "number",
              "null"
            ]
          },
          "tipAmount": {
            "type": [
              "number",
              "null"
            ]
          },
          "feeAmount": {
            "type": [
              "number",
              "null"
            ]
          },
          "netAmount": {
            "type": [
              "number",
              "null"
            ]
          },
          "discountCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "discountAmount": {
            "type": [
              "number",
              "null"
            ]
          },
          "shippingAmount": {
            "type": [
              "number",
              "null"
            ]
          },
          "giftCardAmount": {
            "type": [
              "number",
              "null"
            ]
          },
          "shippingAddress": {
            "$ref": "#/components/schemas/ShippingAddress",
            "nullable": true
          },
          "fulfilmentMethod": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "delivery",
              "collection",
              "no_physical",
              null
            ]
          },
          "collectionLocation": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "addressLine1": {
                "type": "string"
              },
              "addressLine2": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "city": {
                "type": "string"
              },
              "postcode": {
                "type": "string"
              },
              "instructions": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "trackingCarrier": {
            "type": [
              "string",
              "null"
            ]
          },
          "trackingNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "trackingUpdatedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "trackingUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "fulfilmentStatus": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "unfulfilled",
              "processing",
              "dispatched",
              "delivered",
              "ready_for_collection",
              "collected",
              "not_required",
              null
            ]
          },
          "dispatchedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "deliveredAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "readyForCollectionAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "collectedAt": {
            "type": [
              "string",
              "null"
            ]
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerOrderItem"
            }
          },
          "createdAt": {
            "type": "string"
          }
        }
      },
      "CustomerOrderCustomization": {
        "description": "Customer-safe accepted buyer field. File fields contain only a neutral display value; a new purchase requires a new upload.",
        "type": "object",
        "required": [
          "customizationId",
          "name",
          "type",
          "value",
          "priceDelta"
        ],
        "properties": {
          "customizationId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "value": {
            "type": [
              "string",
              "boolean"
            ]
          },
          "priceDelta": {
            "type": "number"
          },
          "choiceId": {
            "type": "string"
          },
          "choiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CustomerOrderItem": {
        "type": "object",
        "required": [
          "id",
          "productName",
          "unitPrice",
          "quantity"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "productId": {
            "type": [
              "string",
              "null"
            ]
          },
          "productName": {
            "type": "string"
          },
          "unitPrice": {
            "type": "number"
          },
          "quantity": {
            "type": "number"
          },
          "variantId": {
            "type": [
              "string",
              "null"
            ]
          },
          "variantLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "customizations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerOrderCustomization"
            }
          },
          "customizationPriceDelta": {
            "type": "number"
          },
          "refundedQuantity": {
            "type": "number"
          },
          "isPreorder": {
            "type": "boolean"
          }
        }
      },
      "CustomerSession": {
        "type": "object",
        "required": [
          "email"
        ],
        "properties": {
          "email": {
            "type": "string"
          }
        }
      },
      "CustomerSessionState": {
        "type": "object",
        "required": [
          "email"
        ],
        "properties": {
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CustomerSignInRequest": {
        "type": "object",
        "required": [
          "apiKey",
          "email"
        ],
        "properties": {
          "apiKey": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "maxLength": 320
          }
        }
      },
      "CustomerSignInRequestResult": {
        "type": "object",
        "required": [
          "sent"
        ],
        "properties": {
          "sent": {
            "type": "boolean"
          }
        }
      },
      "CustomerSignInVerify": {
        "type": "object",
        "required": [
          "apiKey",
          "email",
          "code"
        ],
        "properties": {
          "apiKey": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "maxLength": 320
          },
          "code": {
            "type": "string",
            "minLength": 6,
            "maxLength": 6
          }
        }
      },
      "DiscountValidateInput": {
        "type": "object",
        "required": [
          "apiKey",
          "code"
        ],
        "properties": {
          "apiKey": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "minLength": 1,
            "maxLength": 64
          },
          "subtotal": {
            "type": "number",
            "minimum": 0,
            "description": "Current cart subtotal, used to compute the discount preview"
          },
          "customerEmail": {
            "type": "string",
            "maxLength": 320,
            "description": "Used to check the per-customer redemption limit"
          }
        }
      },
      "DiscountValidateResult": {
        "type": "object",
        "required": [
          "valid"
        ],
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the code cannot be applied (when valid is false)"
          },
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Normalised (upper-cased) code"
          },
          "type": {
            "type": [
              "string",
              "null"
            ],
            "description": "percent or fixed"
          },
          "value": {
            "type": [
              "number",
              "null"
            ]
          },
          "minOrderValue": {
            "type": [
              "number",
              "null"
            ]
          },
          "discountAmount": {
            "type": [
              "number",
              "null"
            ],
            "description": "Discount that would apply to the provided subtotal"
          }
        }
      },
      "EquipmentField": {
        "type": "object",
        "required": [
          "id",
          "label",
          "kind",
          "required"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "kind": {
            "type": "string",
            "enum": [
              "text",
              "choice",
              "photo"
            ]
          },
          "required": {
            "type": "boolean"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "EquipmentForm": {
        "type": "object",
        "description": "The questions a repair business asks about a customer's machine, vehicle or appliance",
        "required": [
          "noun",
          "fields"
        ],
        "properties": {
          "template": {
            "type": "string"
          },
          "noun": {
            "type": "string",
            "description": "What the business calls the things it works on, like machine or vehicle"
          },
          "fields": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EquipmentField"
            }
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "description": "Stable machine-readable error code"
          },
          "currentVersion": {
            "type": "number",
            "description": "Current aggregate revision when the request was rejected as stale"
          },
          "reference": {
            "type": "string",
            "description": "Safe diagnostic reference for support correlation"
          },
          "field": {
            "type": "string",
            "description": "The form field the error is about, when there is one"
          }
        }
      },
      "GiftCardPurchase": {
        "type": "object",
        "required": [
          "amount",
          "recipientEmail"
        ],
        "properties": {
          "amount": {
            "type": "number",
            "minimum": 0.01
          },
          "recipientEmail": {
            "type": "string",
            "maxLength": 320
          }
        }
      },
      "GiftCardValidateInput": {
        "type": "object",
        "required": [
          "apiKey",
          "code"
        ],
        "properties": {
          "apiKey": {
            "type": "string"
          },
          "code": {
            "type": "string",
            "maxLength": 32
          }
        }
      },
      "GiftCardValidateResult": {
        "type": "object",
        "required": [
          "valid"
        ],
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "balance": {
            "type": [
              "number",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "LoyaltyStatus": {
        "type": "object",
        "required": [
          "email",
          "balance",
          "loyaltyEnabled"
        ],
        "properties": {
          "email": {
            "type": "string"
          },
          "balance": {
            "type": "number",
            "description": "Current points balance for this customer"
          },
          "loyaltyEnabled": {
            "type": "boolean"
          },
          "pointsPerCurrencyUnit": {
            "type": [
              "number",
              "null"
            ],
            "description": "Points earned per whole currency unit spent"
          },
          "pointsPerRedemptionUnit": {
            "type": [
              "number",
              "null"
            ],
            "description": "Points required to redeem one currency unit off"
          },
          "minRedemptionPoints": {
            "type": [
              "number",
              "null"
            ],
            "description": "Minimum balance needed before the customer can redeem"
          },
          "maxRedeemablePoints": {
            "type": "number",
            "description": "Maximum points the customer can redeem on their next order"
          }
        }
      },
      "OkResult": {
        "type": "object",
        "required": [
          "ok"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          }
        }
      },
      "OrderItem": {
        "type": "object",
        "required": [
          "id",
          "productName",
          "unitPrice",
          "quantity",
          "customizations",
          "customizationPriceDelta"
        ],
        "properties": {
          "inventoryRecordId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Purchased stock record retained for safe cancellation and refund restocking."
          },
          "id": {
            "type": "string"
          },
          "productId": {
            "type": [
              "string",
              "null"
            ]
          },
          "productName": {
            "type": "string"
          },
          "unitPrice": {
            "type": "number"
          },
          "quantity": {
            "type": "number"
          },
          "variantId": {
            "type": [
              "string",
              "null"
            ]
          },
          "variantLabel": {
            "type": [
              "string",
              "null"
            ],
            "description": "Snapshot of the purchased variant's option values, e.g. \"Large / Red\""
          },
          "customizations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderItemCustomization"
            },
            "description": "Immutable accepted customer-entered values and their per-unit price deltas"
          },
          "customizationPriceDelta": {
            "type": "number",
            "description": "Total per-unit price added by accepted customisations"
          },
          "refundedQuantity": {
            "type": "number",
            "description": "Units of this line already refunded"
          },
          "isPreorder": {
            "type": "boolean",
            "description": "Whether this line was sold as a pre-order (stock was insufficient at purchase time)"
          }
        }
      },
      "OrderItemCustomization": {
        "type": "object",
        "required": [
          "customizationId",
          "name",
          "type",
          "value",
          "priceDelta"
        ],
        "properties": {
          "choiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "attachment": {
            "$ref": "#/components/schemas/BuyerExtraAttachment"
          },
          "customizationId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "text",
              "textarea",
              "checkbox",
              "radio",
              "dropdown",
              "multiselect",
              "number",
              "date",
              "file"
            ]
          },
          "value": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "boolean"
              }
            ]
          },
          "choiceId": {
            "type": "string"
          },
          "priceDelta": {
            "type": "number"
          }
        }
      },
      "PostalAddress": {
        "type": "object",
        "required": [
          "line1",
          "city",
          "postcode",
          "countryCode",
          "country"
        ],
        "properties": {
          "line1": {
            "type": "string"
          },
          "line2": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "region": {
            "type": "string"
          },
          "postcode": {
            "type": "string"
          },
          "countryCode": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "enum": [
              "manual",
              "suggestion"
            ]
          },
          "provider": {
            "type": "string",
            "enum": [
              "ideal-postcodes",
              "geoapify",
              "google"
            ]
          },
          "providerId": {
            "type": "string"
          }
        }
      },
      "ProductBadge": {
        "type": "object",
        "required": [
          "type",
          "label"
        ],
        "description": "A preset type carries a fixed, server-owned label; \"custom\" carries a merchant-written label (max 40 chars).",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "new",
              "limited",
              "limited_time",
              "bestseller",
              "exclusive",
              "sale",
              "custom"
            ]
          },
          "label": {
            "type": "string",
            "maxLength": 40
          }
        }
      },
      "ProductCustomization": {
        "type": "object",
        "required": [
          "id",
          "name",
          "type",
          "required",
          "priceDelta",
          "choices",
          "sortOrder"
        ],
        "properties": {
          "helpText": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000
          },
          "placeholder": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 2000
          },
          "rules": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BuyerExtraRules"
              },
              {
                "type": "null"
              }
            ]
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "text",
              "textarea",
              "checkbox",
              "radio",
              "dropdown",
              "multiselect",
              "number",
              "date",
              "file"
            ]
          },
          "required": {
            "type": "boolean"
          },
          "priceDelta": {
            "type": "number",
            "description": "Charged once per item when an answer is supplied; an empty optional answer adds no charge."
          },
          "maxLength": {
            "type": [
              "number",
              "null"
            ],
            "description": "Character limit for text and textarea fields"
          },
          "minSelections": {
            "type": [
              "number",
              "null"
            ],
            "description": "Minimum choices required for a multiselect field"
          },
          "maxSelections": {
            "type": [
              "number",
              "null"
            ],
            "description": "Maximum choices allowed for a multiselect field"
          },
          "choices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductCustomizationChoice"
            }
          },
          "sortOrder": {
            "type": "number"
          }
        }
      },
      "ProductCustomizationChoice": {
        "type": "object",
        "required": [
          "id",
          "label",
          "priceDelta",
          "sortOrder"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "priceDelta": {
            "type": "number"
          },
          "sortOrder": {
            "type": "number"
          }
        }
      },
      "ProductOption": {
        "type": "object",
        "required": [
          "id",
          "name",
          "values",
          "sortOrder"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "libraryOptionId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Reusable option definition used as the source, when applicable"
          },
          "name": {
            "type": "string"
          },
          "values": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Ordered allowed values, e.g. [\"Small\", \"Medium\", \"Large\"]"
          },
          "sortOrder": {
            "type": "number"
          }
        }
      },
      "ProductReviewInput": {
        "type": "object",
        "required": [
          "apiKey",
          "productId",
          "orderId",
          "customerEmail",
          "customerName",
          "rating"
        ],
        "properties": {
          "apiKey": {
            "type": "string"
          },
          "productId": {
            "type": "string"
          },
          "orderId": {
            "type": "string",
            "description": "Proof of purchase — the order ID from the buyer's confirmation page/email"
          },
          "customerEmail": {
            "type": "string",
            "maxLength": 320,
            "description": "Must match the email used on that order"
          },
          "customerName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "rating": {
            "type": "number",
            "minimum": 1,
            "maximum": 5,
            "description": "Whole number of stars, 1-5"
          },
          "comment": {
            "type": "string",
            "maxLength": 2000
          }
        }
      },
      "ProductReviewSubmitResult": {
        "type": "object",
        "required": [
          "id",
          "status"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "ProductSellingSettings": {
        "type": "object",
        "required": [
          "version"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "collectionAddress": {
            "$ref": "#/components/schemas/PostalAddress"
          },
          "weight": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000
          },
          "leadTime": {
            "type": "string",
            "maxLength": 500
          }
        }
      },
      "ProductVariant": {
        "type": "object",
        "required": [
          "id",
          "optionValues",
          "price",
          "stockQuantity",
          "isActive"
        ],
        "properties": {
          "inventoryKey": {
            "type": [
              "string",
              "null"
            ],
            "description": "Key of the explicit stock record used by this selection, or null for legacy inventory."
          },
          "inventoryRecordId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Stock record consumed by this selection. Several variants may share one quantity."
          },
          "id": {
            "type": "string"
          },
          "optionValues": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Ordered option values aligned with the product's options"
          },
          "price": {
            "type": "number"
          },
          "stockQuantity": {
            "type": "number"
          },
          "sku": {
            "type": [
              "string",
              "null"
            ],
            "description": "Merchant-facing SKU, unique within this product when supplied"
          },
          "isActive": {
            "type": "boolean",
            "description": "Inactive variants remain in order history but cannot be purchased"
          },
          "imageUrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "The variant's primary image — always imageUrls[0], or null when imageUrls is empty."
          },
          "imageUrls": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Ordered gallery photos associated with this variant, in merchant-defined order (not gallery order). Always present, possibly empty."
          }
        }
      },
      "PublicBookingAvailableDays": {
        "type": "object",
        "required": [
          "days",
          "firstAvailable"
        ],
        "properties": {
          "days": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "date",
                "available"
              ],
              "properties": {
                "date": {
                  "type": "string"
                },
                "available": {
                  "type": "boolean"
                },
                "closed": {
                  "type": "boolean",
                  "description": "No opening hours that day (as opposed to fully booked)"
                },
                "nearby": {
                  "type": "boolean",
                  "description": "For a business that travels, it's already working near the customer that day"
                }
              }
            }
          },
          "firstAvailable": {
            "type": [
              "string",
              "null"
            ],
            "description": "The first day in the range with a bookable time"
          },
          "firstNearby": {
            "type": [
              "string",
              "null"
            ],
            "description": "The first day the business is already working near the customer"
          }
        }
      },
      "PublicBookingCharge": {
        "type": "object",
        "description": "What the customer pays when booking this service at its starting price. Options, extras and trip fees can change it, so use /public/booking/quote for the exact amount before taking payment. There's no card surcharge: BeniBrain's platform fee comes out of the business's payout.",
        "required": [
          "mode",
          "amountPence",
          "currency"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "none",
              "deposit",
              "full"
            ]
          },
          "amountPence": {
            "type": "number",
            "description": "In the smallest unit of the currency (cents for USD)"
          },
          "percent": {
            "type": [
              "number",
              "null"
            ],
            "description": "Set when the deposit is a percentage of the total"
          },
          "currency": {
            "type": "string"
          }
        }
      },
      "PublicBookingConfirmation": {
        "type": "object",
        "required": [
          "id",
          "businessName",
          "serviceName",
          "optionsSnapshot",
          "startsAt",
          "endsAt",
          "status",
          "paymentStatus",
          "paymentAmountPence",
          "serviceTotalPence",
          "balanceDuePence",
          "paymentCurrency",
          "paymentKind",
          "paymentExpiresAt",
          "holdExpiredAt",
          "latePaymentDetectedAt",
          "requiresPayment",
          "identityCollection"
        ],
        "properties": {
          "arrivalWindowStart": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "For a business that gives arrival windows, the start of the window the customer was told"
          },
          "arrivalWindowEnd": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "packageUsed": {
            "oneOf": [
              {
                "type": "object",
                "required": [
                  "name",
                  "sessionsLeft"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "sessionsLeft": {
                    "type": "integer"
                  }
                }
              },
              {
                "type": "null"
              }
            ],
            "description": "The package this booking used a session from, and what's left"
          },
          "location": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AppointmentPlace"
              },
              {
                "type": "null"
              }
            ],
            "description": "Where the appointment is"
          },
          "giftCardAppliedPence": {
            "type": "number"
          },
          "giftCardReturnedPence": {
            "type": "number"
          },
          "stripeAmountPence": {
            "type": "number"
          },
          "amountCollectedAtBookingPence": {
            "type": "number"
          },
          "replayed": {
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "businessName": {
            "type": "string"
          },
          "serviceName": {
            "type": "string"
          },
          "optionsSnapshot": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "durationMinutes": {
            "type": "number",
            "description": "Effective duration actually reserved (base service duration plus any selected choice deltas)"
          },
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "endsAt": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "confirmed",
              "completed",
              "cancelled",
              "expired"
            ]
          },
          "paymentStatus": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "pending",
              "paid",
              "refunded",
              "failed",
              "expired",
              "late_paid",
              null
            ]
          },
          "paymentAmountPence": {
            "type": [
              "number",
              "null"
            ]
          },
          "serviceTotalPence": {
            "type": [
              "number",
              "null"
            ]
          },
          "balanceDuePence": {
            "type": [
              "number",
              "null"
            ]
          },
          "paymentCurrency": {
            "type": [
              "string",
              "null"
            ]
          },
          "paymentKind": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "deposit",
              "full",
              "balance",
              "refund",
              null
            ]
          },
          "paymentExpiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "holdExpiredAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "latePaymentDetectedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "requiresPayment": {
            "type": "boolean",
            "description": "True when a Stripe checkout URL was created and the customer must pay"
          },
          "checkoutUrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "Stripe Checkout URL to redirect the customer to for payment"
          },
          "identityCollection": {
            "type": "string",
            "enum": [
              "required"
            ],
            "description": "Always \"required\" in this contract — the connected website always collects name/email; Stripe is only ever used for payment."
          },
          "policyAcceptedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Server timestamp of policy acceptance, or null when this business's policy required none"
          },
          "policyVersion": {
            "type": [
              "string",
              "null"
            ],
            "description": "Version of the accepted policy terms, or null when acceptance was not required"
          }
        }
      },
      "PublicBookingEquipmentEntry": {
        "type": "object",
        "description": "One machine on a booking. Either a saved one (equipmentId, signed-in customers only) or new answers, with photos as upload tokens",
        "properties": {
          "equipmentId": {
            "type": "string"
          },
          "details": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "photos": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      },
      "PublicBookingInfo": {
        "type": "object",
        "required": [
          "businessName",
          "timezone",
          "services",
          "categories",
          "cancellationPolicy",
          "reschedulePolicy",
          "policyAcceptanceRequired"
        ],
        "properties": {
          "businessName": {
            "type": "string"
          },
          "business": {
            "$ref": "#/components/schemas/PublicBusinessProfile"
          },
          "storefront": {
            "$ref": "#/components/schemas/PublicStorefrontCapabilities"
          },
          "timezone": {
            "type": "string"
          },
          "mobile": {
            "type": "boolean",
            "description": "The business travels to the customer, so the booking needs the job address"
          },
          "tripFeePence": {
            "type": "number",
            "description": "A flat fee added to every booking for coming out; 0 when there is none or it depends on the address"
          },
          "equipment": {
            "description": "The equipment questions, when any service asks about the customer's machines",
            "oneOf": [
              {
                "$ref": "#/components/schemas/EquipmentForm"
              },
              {
                "type": "null"
              }
            ]
          },
          "tripFeeText": {
            "type": [
              "string",
              "null"
            ],
            "description": "One sentence telling customers how the trip fee works, or null when there is none"
          },
          "country": {
            "type": "string",
            "enum": [
              "GB",
              "US"
            ]
          },
          "about": {
            "type": "object",
            "description": "The business's public contact details for the booking page",
            "properties": {
              "address": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "comesToYou": {
                "type": "boolean"
              },
              "google": {
                "description": "The business's real Google rating, when its listing is linked",
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "type": "object",
                    "required": [
                      "rating",
                      "reviewCount"
                    ],
                    "properties": {
                      "rating": {
                        "type": "number"
                      },
                      "reviewCount": {
                        "type": "integer"
                      },
                      "url": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  }
                ]
              }
            }
          },
          "services": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicBookingService"
            }
          },
          "categories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicServiceCategory"
            }
          },
          "cancellationPolicy": {
            "type": "string",
            "description": "General-purpose disclosure sentence shown before booking/payment"
          },
          "reschedulePolicy": {
            "type": "string",
            "description": "General-purpose disclosure sentence shown before booking/payment"
          },
          "policyAcceptanceRequired": {
            "type": "boolean",
            "description": "Server-authoritative: true when this business's actual cancellation/reschedule policy imposes a real consequence on the customer (a notice window and/or a non-full refund policy), so booking creation will require an explicit `policyAccepted: true` regardless of whether this booking collects payment. False only when the business's policy is genuinely consequence-free. The authoritative value for a specific service selection is the one returned by `/public/booking/quote`."
          }
        }
      },
      "PublicBookingInput": {
        "type": "object",
        "required": [
          "apiKey",
          "serviceId",
          "startsAt",
          "customerName",
          "customerEmail"
        ],
        "properties": {
          "giftCardCode": {
            "type": "string",
            "description": "Optional gift card applied to the upfront booking amount, never the later service balance."
          },
          "giftCardIdempotencyKey": {
            "type": "string",
            "minLength": 16,
            "maxLength": 128,
            "description": "Required with giftCardCode. Retry the exact same key and body after uncertain responses."
          },
          "buyerExtras": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/StoreCheckoutCustomization"
            },
            "description": "Buyer answers; the server validates and calculates charges before the deposit."
          },
          "apiKey": {
            "type": "string"
          },
          "serviceId": {
            "type": "string"
          },
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "customerName": {
            "type": "string",
            "minLength": 1
          },
          "customerEmail": {
            "type": "string",
            "minLength": 3
          },
          "customerPhone": {
            "type": "string",
            "description": "Customer phone number in E.164 format (e.g. +14155551234). Optional — used to send SMS reminders when the business has SMS enabled."
          },
          "smsConsent": {
            "type": "boolean",
            "description": "Explicit opt-in checkbox shown alongside the phone field. SMS reminders are only sent when true, regardless of business settings."
          },
          "customerNotes": {
            "type": "string"
          },
          "serviceAddress": {
            "type": "string",
            "description": "Where the work is needed. Required when the business travels to customers."
          },
          "serviceLat": {
            "type": "number"
          },
          "serviceLng": {
            "type": "number"
          },
          "equipment": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/PublicBookingEquipmentEntry"
            },
            "description": "The customer's machines, required when the service asks about equipment"
          },
          "agentId": {
            "type": "string",
            "description": "Optional agent to assign the booking to"
          },
          "selectedChoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "IDs of active choices selected for this service"
          },
          "successUrl": {
            "type": "string",
            "description": "Where Stripe redirects after payment. Only used when the service requires payment; no-payment bookings are confirmed immediately and never touch Stripe. Must be an https(s) URL on the business's own verified domain/whitelist (validated server-side) — otherwise BeniBrain's own default booking-status return page is used. The booking `id` returned in this response is not a secret and is not an authentication credential; a connected website that supplies its own successUrl should hold onto that `id` and call `GET /public/booking/{apiKey}/bookings/{id}` after redirect to retrieve authoritative booking/payment status (the id alone does not grant the ability to cancel or reschedule the booking)."
          },
          "cancelUrl": {
            "type": "string",
            "description": "Where Stripe redirects if the customer cancels before paying. Same trusted-origin rule as successUrl."
          },
          "policyAccepted": {
            "type": "boolean",
            "description": "Must be true when the quote (or booking info) reported `policyAcceptanceRequired: true`. The server re-derives applicability from the business's own settings and rejects the request with 400 if it is required but not sent as true; it is ignored (not required) when the business's policy is consequence-free."
          },
          "policyVersion": {
            "type": "string",
            "description": "Required alongside `policyAccepted` whenever acceptance is required — must be exactly the `policyVersion` returned by the most recent `/public/booking/quote` (or booking info) call the customer actually saw. The server never accepts a client-generated value: it re-derives the current authoritative version from the business's live settings and rejects with 400 if this is missing, or 409 if it no longer matches (the policy changed since the customer was quoted). Ignored when acceptance is not required."
          }
        }
      },
      "PublicBookingLocation": {
        "type": "object",
        "required": [
          "address",
          "lat",
          "lng",
          "inArea"
        ],
        "properties": {
          "address": {
            "type": "string"
          },
          "lat": {
            "type": "number"
          },
          "lng": {
            "type": "number"
          },
          "inArea": {
            "type": "boolean",
            "description": "Whether the address is inside the area the business covers"
          },
          "tripFeePence": {
            "type": "number",
            "description": "The trip fee for this address; 0 when there is none"
          }
        }
      },
      "PublicBookingManageCancelInput": {
        "type": "object",
        "properties": {
          "reason": {
            "type": "string"
          }
        }
      },
      "PublicBookingManageCancelResult": {
        "type": "object",
        "required": [
          "status",
          "consequence",
          "refundSummary"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "confirmed",
              "completed",
              "cancelled",
              "expired"
            ]
          },
          "consequence": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CancellationConsequence"
              },
              {
                "type": "null"
              }
            ]
          },
          "refundSummary": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/BookingRefundSummary"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "PublicBookingManageCancellation": {
        "type": "object",
        "required": [
          "allowed",
          "policyDescription",
          "consequence"
        ],
        "properties": {
          "allowed": {
            "type": "boolean"
          },
          "policyDescription": {
            "type": "string"
          },
          "consequence": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/CancellationConsequence"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "PublicBookingManageInfo": {
        "type": "object",
        "required": [
          "id",
          "serviceName",
          "serviceDurationMinutes",
          "startsAt",
          "endsAt",
          "status",
          "timezone",
          "customerName",
          "businessName",
          "paymentStatus",
          "paymentAmountPence",
          "paymentCurrency",
          "cancellation",
          "reschedule"
        ],
        "properties": {
          "arrivalWindowStart": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "For a business that gives arrival windows, the start of the window the customer was told"
          },
          "arrivalWindowEnd": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "id": {
            "type": "string"
          },
          "serviceName": {
            "type": "string"
          },
          "serviceDurationMinutes": {
            "type": "number"
          },
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "endsAt": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "confirmed",
              "completed",
              "cancelled",
              "expired"
            ]
          },
          "timezone": {
            "type": "string"
          },
          "staffName": {
            "type": [
              "string",
              "null"
            ]
          },
          "customerName": {
            "type": "string"
          },
          "businessName": {
            "type": "string"
          },
          "brandColor": {
            "type": "string",
            "description": "The business's brand colour as"
          },
          "location": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AppointmentPlace"
              },
              {
                "type": "null"
              }
            ]
          },
          "contact": {
            "type": "object",
            "properties": {
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "paymentStatus": {
            "type": [
              "string",
              "null"
            ]
          },
          "paymentAmountPence": {
            "type": [
              "number",
              "null"
            ]
          },
          "paymentCurrency": {
            "type": [
              "string",
              "null"
            ]
          },
          "refundSummary": {
            "$ref": "#/components/schemas/BookingRefundSummary"
          },
          "cancellation": {
            "$ref": "#/components/schemas/PublicBookingManageCancellation"
          },
          "reschedule": {
            "$ref": "#/components/schemas/PublicBookingManageReschedule"
          }
        }
      },
      "PublicBookingManageReschedule": {
        "type": "object",
        "required": [
          "allowed",
          "denialReason",
          "policyDescription"
        ],
        "properties": {
          "allowed": {
            "type": "boolean"
          },
          "denialReason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "disabled",
              "too-close",
              null
            ]
          },
          "policyDescription": {
            "type": "string"
          }
        }
      },
      "PublicBookingManageRescheduleInput": {
        "type": "object",
        "required": [
          "startsAt"
        ],
        "properties": {
          "startsAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PublicBookingManageRescheduleResult": {
        "type": "object",
        "required": [
          "status",
          "startsAt",
          "endsAt"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "confirmed",
              "completed",
              "cancelled",
              "expired"
            ]
          },
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "endsAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PublicBookingQuote": {
        "type": "object",
        "required": [
          "serviceId",
          "serviceName",
          "currency",
          "durationMinutes",
          "selectedChoices",
          "buyerExtrasPricePence",
          "serviceTotalPence",
          "paymentMode",
          "paymentRequired",
          "amountDueNowPence",
          "balanceDuePence",
          "identityCollection",
          "policyAcceptanceRequired",
          "policyVersion",
          "cancellationPolicy",
          "reschedulePolicy"
        ],
        "properties": {
          "giftCardAppliedPence": {
            "type": "number"
          },
          "stripeAmountPence": {
            "type": "number",
            "description": "Outstanding upfront Stripe amount after gift tender; amountDueNowPence remains the total upfront obligation."
          },
          "serviceId": {
            "type": "string"
          },
          "serviceName": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "durationMinutes": {
            "type": "number",
            "description": "Effective duration for this exact selection (base service duration plus selected choice deltas) — the same value availability and booking creation will use."
          },
          "selectedChoices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicBookingQuoteChoice"
            }
          },
          "buyerExtrasPricePence": {
            "type": "number"
          },
          "tripFeePence": {
            "type": "number",
            "description": "A travelling business's charge for coming out, already included in serviceTotalPence"
          },
          "serviceTotalPence": {
            "type": "number",
            "description": "Full price of the service with the selected choices and any buyer extras, before any deposit split."
          },
          "paymentMode": {
            "type": "string",
            "enum": [
              "none",
              "deposit",
              "full"
            ],
            "description": "Effective payment mode for this exact total — always \"none\" when the total is zero, regardless of the service's configured mode."
          },
          "paymentRequired": {
            "type": "boolean"
          },
          "amountDueNowPence": {
            "type": "number",
            "description": "What creating the booking would charge right now (0 when paymentRequired is false)"
          },
          "balanceDuePence": {
            "type": "number",
            "description": "Remaining amount owed after amountDueNowPence — meaningful for deposit bookings, 0 otherwise"
          },
          "identityCollection": {
            "type": "string",
            "enum": [
              "required"
            ],
            "description": "Always \"required\" — the connected website always collects name/email; Stripe is only ever used for payment."
          },
          "policyAcceptanceRequired": {
            "type": "boolean",
            "description": "Server-authoritative for this business's actual policy; send policyAccepted as true on booking creation when this is true."
          },
          "policyVersion": {
            "type": "string",
            "description": "Stable identifier for the exact policy terms being quoted; the same value is frozen onto the booking's policySnapshot on acceptance."
          },
          "cancellationPolicy": {
            "type": "string"
          },
          "reschedulePolicy": {
            "type": "string"
          }
        }
      },
      "PublicBookingQuoteChoice": {
        "type": "object",
        "required": [
          "groupId",
          "groupName",
          "choiceId",
          "choiceName",
          "priceDeltaPence",
          "durationDeltaMinutes"
        ],
        "properties": {
          "groupId": {
            "type": "string"
          },
          "groupName": {
            "type": "string"
          },
          "choiceId": {
            "type": "string"
          },
          "choiceName": {
            "type": "string"
          },
          "priceDeltaPence": {
            "type": "number"
          },
          "durationDeltaMinutes": {
            "type": "number"
          }
        }
      },
      "PublicBookingQuoteInput": {
        "type": "object",
        "required": [
          "apiKey",
          "serviceId"
        ],
        "properties": {
          "giftCardCode": {
            "type": "string",
            "description": "Optional preview only; does not reserve balance."
          },
          "apiKey": {
            "type": "string"
          },
          "serviceId": {
            "type": "string"
          },
          "selectedChoiceIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "IDs of active choices selected for this service"
          },
          "buyerExtras": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/StoreCheckoutCustomization"
            },
            "description": "Optional buyer answers already collected; included in the resolved total when provided."
          },
          "serviceAddress": {
            "type": "string",
            "description": "For a service at the customer's address, where it is (from /public/booking/locate), so a trip fee by driving time can be worked out"
          },
          "serviceLat": {
            "type": "number"
          },
          "serviceLng": {
            "type": "number"
          },
          "equipmentCount": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "description": "For a service priced per machine, how many machines"
          }
        }
      },
      "PublicBookingService": {
        "type": "object",
        "required": [
          "id",
          "name",
          "durationMinutes",
          "price",
          "currency",
          "paymentMode",
          "isActive",
          "categoryId",
          "optionGroups"
        ],
        "properties": {
          "atCustomer": {
            "type": "boolean",
            "description": "Done at the customer's address, so the booking asks for it and times allow for driving"
          },
          "askEquipment": {
            "type": "boolean",
            "description": "The booking asks about the customer's machines (see PublicBookingInfo.equipment)"
          },
          "perEquipment": {
            "type": "boolean",
            "description": "Price and time are for each machine; send equipmentCount for times and quotes"
          },
          "includedItems": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The service's \"What's included\" list, one item per line as written in BeniBrain"
          },
          "bookingCharge": {
            "$ref": "#/components/schemas/PublicBookingCharge"
          },
          "media": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicMediaDescriptor"
            }
          },
          "studioMetadata": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/StudioMetadata"
              },
              {
                "type": "null"
              }
            ]
          },
          "commerceSettings": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ServiceCommerceSettings"
              },
              {
                "type": "null"
              }
            ]
          },
          "buyerExtras": {
            "type": [
              "array",
              "null"
            ],
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/BuyerExtraDefinition"
            }
          },
          "images": {
            "type": "array",
            "maxItems": 8,
            "uniqueItems": true,
            "description": "Ordered claimed service-photo paths; first is the cover. Omit on updates to preserve photos; [] clears them.",
            "items": {
              "type": "string",
              "pattern": "^/objects/uploads/[0-9a-fA-F-]{36}$"
            }
          },
          "imageUrls": {
            "type": "array",
            "maxItems": 8,
            "description": "Absolute, publicly fetchable image URLs resolved by BeniBrain. Usable directly by any external caller — never a relative path.",
            "items": {
              "type": "string"
            }
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "durationMinutes": {
            "type": "number"
          },
          "price": {
            "type": "number"
          },
          "currency": {
            "type": "string"
          },
          "paymentMode": {
            "type": "string",
            "enum": [
              "none",
              "deposit",
              "full"
            ]
          },
          "depositAmount": {
            "type": [
              "number",
              "null"
            ]
          },
          "isActive": {
            "type": "boolean"
          },
          "categoryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "optionGroups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicServiceOptionGroup"
            }
          },
          "recommendedProducts": {
            "type": "array",
            "maxItems": 12,
            "description": "Optional merchant-curated \"you might also like\" products for this service. Collection membership is resolved live on every read, so this list can change even when the service itself hasn't. Empty when the merchant hasn't set up any recommendations.",
            "items": {
              "$ref": "#/components/schemas/PublicRecommendedProduct"
            }
          },
          "recommendationLinks": {
            "type": "array",
            "maxItems": 6,
            "description": "The same merchant-curated recommendations as resolved public links — one per recommended product or collection, with the merchant's optional customer-facing label and the URL BeniBrain would send a customer to (the connected website when registered, otherwise a hosted page). Targets that are inactive, empty or have no destination are omitted. Render these on your service pages so customers see the same recommendations as their booking emails.",
            "items": {
              "$ref": "#/components/schemas/PublicRecommendationLink"
            }
          }
        }
      },
      "PublicBookingStatus": {
        "type": "object",
        "required": [
          "id",
          "businessName",
          "serviceName",
          "optionsSnapshot",
          "startsAt",
          "endsAt",
          "status",
          "paymentStatus",
          "paymentAmountPence",
          "serviceTotalPence",
          "balanceDuePence",
          "paymentCurrency",
          "paymentKind",
          "paymentExpiresAt",
          "holdExpiredAt",
          "latePaymentDetectedAt",
          "requiresPayment"
        ],
        "properties": {
          "arrivalWindowStart": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "For a business that gives arrival windows, the start of the window the customer was told"
          },
          "arrivalWindowEnd": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "location": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/AppointmentPlace"
              },
              {
                "type": "null"
              }
            ],
            "description": "Where the appointment is"
          },
          "giftCardAppliedPence": {
            "type": "number"
          },
          "giftCardReturnedPence": {
            "type": "number"
          },
          "stripeAmountPence": {
            "type": "number"
          },
          "amountCollectedAtBookingPence": {
            "type": "number",
            "description": "Original collected upfront tender including gift value; returned value is reported separately."
          },
          "id": {
            "type": "string"
          },
          "businessName": {
            "type": "string"
          },
          "serviceName": {
            "type": "string"
          },
          "optionsSnapshot": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "endsAt": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "confirmed",
              "completed",
              "cancelled",
              "expired"
            ]
          },
          "paymentStatus": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "pending",
              "paid",
              "refunded",
              "failed",
              "expired",
              "late_paid",
              null
            ]
          },
          "paymentAmountPence": {
            "type": [
              "number",
              "null"
            ]
          },
          "serviceTotalPence": {
            "type": [
              "number",
              "null"
            ]
          },
          "balanceDuePence": {
            "type": [
              "number",
              "null"
            ]
          },
          "paymentCurrency": {
            "type": [
              "string",
              "null"
            ]
          },
          "paymentKind": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "deposit",
              "full",
              "balance",
              "refund",
              null
            ]
          },
          "paymentExpiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "holdExpiredAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "latePaymentDetectedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "requiresPayment": {
            "type": "boolean"
          },
          "refundSummary": {
            "$ref": "#/components/schemas/BookingRefundSummary"
          }
        }
      },
      "PublicBusinessProfile": {
        "type": "object",
        "description": "The business's details for its own website, so BeniBrain is the single source of truth.",
        "required": [
          "name",
          "timezone",
          "brandColour",
          "brandColourSet",
          "socialLinks",
          "closedDates",
          "extraOpenings",
          "policies"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": [
              "string",
              "null"
            ],
            "description": "The address customers should write to (invoice email, or the reply-to address for emails)"
          },
          "website": {
            "type": [
              "string",
              "null"
            ],
            "description": "e.g. https://getrapidwrench.com"
          },
          "address": {
            "type": [
              "string",
              "null"
            ],
            "description": "Only for a business customers visit; a travelling business's base stays private"
          },
          "timezone": {
            "type": "string"
          },
          "logoUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "brandColour": {
            "type": "string",
            "description": "Hex colour, e.g. #2563eb"
          },
          "brandColourSet": {
            "type": "boolean",
            "description": "false when brandColour is BeniBrain's default blue"
          },
          "socialLinks": {
            "type": "object",
            "description": "Full https links, only for networks the business has filled in",
            "properties": {
              "facebook": {
                "type": "string"
              },
              "instagram": {
                "type": "string"
              },
              "nextdoor": {
                "type": "string"
              },
              "google": {
                "type": "string"
              },
              "tiktok": {
                "type": "string"
              },
              "youtube": {
                "type": "string"
              },
              "x": {
                "type": "string"
              },
              "linkedin": {
                "type": "string"
              },
              "yelp": {
                "type": "string"
              }
            }
          },
          "hours": {
            "description": "Weekly opening hours, Sunday (0) to Saturday (6), in the business's time zone. null when hours are only set per team member.",
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "object",
              "required": [
                "day",
                "name",
                "closed",
                "windows"
              ],
              "properties": {
                "day": {
                  "type": "integer"
                },
                "name": {
                  "type": "string"
                },
                "closed": {
                  "type": "boolean"
                },
                "windows": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "open",
                      "close"
                    ],
                    "properties": {
                      "open": {
                        "type": "string",
                        "description": "HH:mm"
                      },
                      "close": {
                        "type": "string",
                        "description": "HH:mm"
                      }
                    }
                  }
                }
              }
            }
          },
          "closedDates": {
            "type": "array",
            "description": "Days the business is closed, from today, for the next 120 days",
            "items": {
              "type": "object",
              "required": [
                "date"
              ],
              "properties": {
                "date": {
                  "type": "string",
                  "description": "YYYY-MM-DD"
                },
                "reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "from": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "HH:mm, when closed for part of the day only"
                },
                "until": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "HH:mm"
                }
              }
            }
          },
          "extraOpenings": {
            "type": "array",
            "description": "Extra opening times on particular dates, for the next 120 days",
            "items": {
              "type": "object",
              "required": [
                "date",
                "open",
                "close"
              ],
              "properties": {
                "date": {
                  "type": "string"
                },
                "open": {
                  "type": "string"
                },
                "close": {
                  "type": "string"
                },
                "note": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          },
          "serviceArea": {
            "type": [
              "object",
              "null"
            ],
            "description": "Where a travelling business goes; null when it doesn't travel",
            "properties": {
              "radiusMiles": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Straight-line miles from the business's base; null for no limit"
              },
              "freeTripTowns": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Towns with no trip fee"
              },
              "freeTripMiles": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "No trip fee within this many miles"
              }
            }
          },
          "policies": {
            "type": "object",
            "required": [
              "cancellation",
              "reschedule",
              "acceptanceRequired",
              "version"
            ],
            "properties": {
              "cancellation": {
                "type": "string",
                "description": "The full cancellation policy, one sentence per line"
              },
              "reschedule": {
                "type": "string",
                "description": "The full reschedule policy, one sentence per line"
              },
              "acceptanceRequired": {
                "type": "boolean"
              },
              "version": {
                "type": "string",
                "description": "Send as policyVersion when booking"
              }
            }
          }
        }
      },
      "PublicMediaDescriptor": {
        "type": "object",
        "description": "Optional public delivery metadata. Source fields remain authoritative; clients must retain original fallback.",
        "required": [
          "sourceUrl",
          "sourceWidth",
          "sourceHeight",
          "representations"
        ],
        "properties": {
          "sourceUrl": {
            "type": "string"
          },
          "sourceWidth": {
            "type": "number"
          },
          "sourceHeight": {
            "type": "number"
          },
          "representations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicMediaRepresentation"
            }
          }
        }
      },
      "PublicMediaRepresentation": {
        "type": "object",
        "required": [
          "url",
          "width",
          "height",
          "format"
        ],
        "properties": {
          "url": {
            "type": "string"
          },
          "width": {
            "type": "number"
          },
          "height": {
            "type": "number"
          },
          "format": {
            "type": "string",
            "enum": [
              "webp"
            ]
          }
        }
      },
      "PublicOrderCollectionLocation": {
        "type": "object",
        "required": [
          "name",
          "address",
          "instructions"
        ],
        "properties": {
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "instructions": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "PublicOrderFulfilment": {
        "type": "object",
        "required": [
          "method",
          "collectionLocation"
        ],
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "delivery",
              "collection",
              "no_physical"
            ]
          },
          "collectionLocation": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PublicOrderCollectionLocation"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "PublicOrderInfo": {
        "type": "object",
        "required": [
          "id",
          "businessName",
          "status",
          "customerName",
          "currency",
          "totalAmount",
          "totalAmountFormatted",
          "taxAmount",
          "tipAmount",
          "shippingAmount",
          "discountCode",
          "discountAmount",
          "paidWithGiftCard",
          "giftCardAmount",
          "refundedAmount",
          "createdAt",
          "paidAt",
          "items",
          "fulfilment",
          "shippingAddress",
          "tracking",
          "refunds",
          "fulfilmentStatus",
          "dispatchedAt",
          "deliveredAt",
          "readyForCollectionAt",
          "collectedAt"
        ],
        "properties": {
          "purchasedGiftCards": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PurchasedGiftCardSummary"
            }
          },
          "id": {
            "type": "string"
          },
          "businessName": {
            "type": "string"
          },
          "brandColor": {
            "type": "string",
            "description": "The business's brand colour as #rrggbb."
          },
          "returnsPolicy": {
            "type": [
              "string",
              "null"
            ],
            "description": "The shop's returns policy in plain text, or null when none is written"
          },
          "contact": {
            "type": "object",
            "properties": {
              "email": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "phone": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "contactKey": {
            "type": [
              "string",
              "null"
            ],
            "description": "The business's public name for GET /public/business/contact, so the page can open its Contact panel"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "paid",
              "processing",
              "shipped",
              "delivered",
              "cancelled",
              "refunded"
            ]
          },
          "customerName": {
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "totalAmount": {
            "type": "number"
          },
          "totalAmountFormatted": {
            "type": "string"
          },
          "taxAmount": {
            "type": [
              "number",
              "null"
            ]
          },
          "tipAmount": {
            "type": [
              "number",
              "null"
            ]
          },
          "shippingAmount": {
            "type": [
              "number",
              "null"
            ]
          },
          "discountCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "discountAmount": {
            "type": [
              "number",
              "null"
            ]
          },
          "paidWithGiftCard": {
            "type": "boolean"
          },
          "giftCardAmount": {
            "type": [
              "number",
              "null"
            ]
          },
          "refundedAmount": {
            "type": "number"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "paidAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicOrderItem"
            }
          },
          "fulfilment": {
            "$ref": "#/components/schemas/PublicOrderFulfilment"
          },
          "shippingAddress": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ShippingAddress"
              },
              {
                "type": "null"
              }
            ]
          },
          "tracking": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/PublicOrderTracking"
              },
              {
                "type": "null"
              }
            ]
          },
          "refunds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicOrderRefund"
            }
          },
          "fulfilmentStatus": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "unfulfilled",
              "processing",
              "dispatched",
              "delivered",
              "ready_for_collection",
              "collected",
              "not_required",
              null
            ]
          },
          "dispatchedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "deliveredAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "readyForCollectionAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "collectedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "PublicOrderItem": {
        "type": "object",
        "required": [
          "productName",
          "variantLabel",
          "quantity",
          "unitPrice"
        ],
        "properties": {
          "productName": {
            "type": "string"
          },
          "variantLabel": {
            "type": [
              "string",
              "null"
            ]
          },
          "quantity": {
            "type": "number"
          },
          "unitPrice": {
            "type": "number"
          }
        }
      },
      "PublicOrderRefund": {
        "type": "object",
        "required": [
          "amount",
          "currency",
          "createdAt"
        ],
        "properties": {
          "amount": {
            "type": "number"
          },
          "currency": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PublicOrderSummary": {
        "type": "object",
        "required": [
          "id",
          "businessName",
          "status",
          "totalAmount",
          "currency",
          "items",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "businessName": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "totalAmount": {
            "type": "number"
          },
          "currency": {
            "type": "string"
          },
          "taxAmount": {
            "type": [
              "number",
              "null"
            ]
          },
          "tipAmount": {
            "type": [
              "number",
              "null"
            ]
          },
          "discountCode": {
            "type": [
              "string",
              "null"
            ]
          },
          "discountAmount": {
            "type": [
              "number",
              "null"
            ]
          },
          "shippingAmount": {
            "type": [
              "number",
              "null"
            ]
          },
          "shippingAddress": {
            "$ref": "#/components/schemas/ShippingAddress",
            "nullable": true
          },
          "trackingCarrier": {
            "type": [
              "string",
              "null"
            ]
          },
          "trackingNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderItem"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "PublicOrderTracking": {
        "type": "object",
        "required": [
          "carrier",
          "number",
          "url"
        ],
        "properties": {
          "carrier": {
            "type": [
              "string",
              "null"
            ]
          },
          "number": {
            "type": "string"
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "PublicProductReview": {
        "type": "object",
        "required": [
          "id",
          "customerName",
          "rating",
          "comment",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "customerName": {
            "type": "string"
          },
          "rating": {
            "type": "number"
          },
          "comment": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          }
        }
      },
      "PublicRecommendationLink": {
        "type": "object",
        "required": [
          "kind",
          "targetId",
          "slug",
          "label",
          "url"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "product",
              "collection"
            ]
          },
          "targetId": {
            "type": "string",
            "description": "BeniBrain id of the recommended product or collection"
          },
          "slug": {
            "type": [
              "string",
              "null"
            ],
            "description": "Slug where the target has one (collections)"
          },
          "label": {
            "type": "string",
            "description": "Merchant display label",
            "falling back to the target name": null
          },
          "url": {
            "type": "string",
            "description": "Absolute public URL resolved by BeniBrain"
          }
        }
      },
      "PublicRecommendedProduct": {
        "type": "object",
        "required": [
          "id",
          "name",
          "price",
          "imageUrl",
          "badge"
        ],
        "properties": {
          "media": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicMediaDescriptor"
            }
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "price": {
            "type": "number"
          },
          "imageUrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "Absolute, publicly fetchable image URL resolved by BeniBrain. Usable directly by any external caller — never a relative path."
          },
          "badge": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ProductBadge"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "PublicServiceCategory": {
        "type": "object",
        "required": [
          "id",
          "name",
          "slug",
          "sortOrder"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "sortOrder": {
            "type": "number"
          }
        }
      },
      "PublicServiceOptionChoice": {
        "type": "object",
        "required": [
          "id",
          "name",
          "description",
          "priceDelta",
          "durationDeltaMinutes",
          "sortOrder"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "priceDelta": {
            "type": "number"
          },
          "durationDeltaMinutes": {
            "type": "number"
          },
          "sortOrder": {
            "type": "number"
          }
        }
      },
      "PublicServiceOptionGroup": {
        "type": "object",
        "required": [
          "id",
          "name",
          "description",
          "required",
          "selectionMode",
          "minSelections",
          "maxSelections",
          "sortOrder",
          "choices"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "required": {
            "type": "boolean"
          },
          "selectionMode": {
            "type": "string",
            "enum": [
              "single",
              "multiple"
            ]
          },
          "minSelections": {
            "type": "number"
          },
          "maxSelections": {
            "type": "number"
          },
          "sortOrder": {
            "type": "number"
          },
          "choices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicServiceOptionChoice"
            }
          }
        }
      },
      "PublicStoreCategory": {
        "type": "object",
        "required": [
          "id",
          "name",
          "slug"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          }
        }
      },
      "PublicStoreCollection": {
        "type": "object",
        "required": [
          "id",
          "name",
          "slug",
          "description"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "PublicStoreInfo": {
        "type": "object",
        "required": [
          "businessName",
          "currency",
          "paymentsEnabled",
          "tipsEnabled",
          "products"
        ],
        "properties": {
          "businessName": {
            "type": "string"
          },
          "socialLinks": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "The business's own pages (facebook, instagram, nextdoor…) as full https links"
          },
          "storefront": {
            "$ref": "#/components/schemas/PublicStorefrontCapabilities"
          },
          "metaDescription": {
            "type": [
              "string",
              "null"
            ],
            "description": "Owner-set storefront meta description for SEO/social previews"
          },
          "currency": {
            "type": "string"
          },
          "paymentsEnabled": {
            "type": "boolean",
            "description": "False means checkout runs in test mode (no real payment)"
          },
          "taxRate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Business tax rate as a decimal fraction e.g. 0.2 for 20%"
          },
          "taxDisplay": {
            "type": [
              "string",
              "null"
            ],
            "description": "exclusive = add tax on top (default); inclusive = prices include tax"
          },
          "tipsEnabled": {
            "type": "boolean",
            "description": "Whether the checkout should show the tip/gratuity step"
          },
          "tipPresets": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "Custom tip percentage presets (e.g. [10, 15, 20])"
          },
          "shippingEnabled": {
            "type": "boolean",
            "description": "Whether shipping is charged on orders containing shippable items"
          },
          "shippingFlatRate": {
            "type": [
              "number",
              "null"
            ],
            "description": "Flat shipping charge per order"
          },
          "shippingFreeOverThreshold": {
            "type": [
              "number",
              "null"
            ],
            "description": "Discounted subtotal at or above which shipping is free"
          },
          "returnsPolicy": {
            "type": [
              "string",
              "null"
            ],
            "description": "The shop's returns policy in plain text, or null when none is written"
          },
          "deliveryPolicy": {
            "type": [
              "string",
              "null"
            ],
            "description": "The shop's delivery policy in plain text, or null when none is written"
          },
          "collectionLocation": {
            "type": [
              "object",
              "null"
            ],
            "description": "Present only when the merchant has an enabled collection location configured",
            "properties": {
              "name": {
                "type": "string"
              },
              "addressLine1": {
                "type": "string"
              },
              "addressLine2": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "city": {
                "type": "string"
              },
              "postcode": {
                "type": "string"
              },
              "instructions": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "giftCardsEnabled": {
            "type": "boolean"
          },
          "giftCardDenominations": {
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          "products": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicStoreProduct"
            }
          },
          "categories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicStoreCategory"
            },
            "description": "Categories that contain at least one active product"
          },
          "collections": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicStoreCollection"
            },
            "description": "Collections that contain at least one active product"
          }
        }
      },
      "PublicStoreProduct": {
        "type": "object",
        "required": [
          "id",
          "name",
          "description",
          "price",
          "stockQuantity",
          "requiresShipping",
          "categoryIds"
        ],
        "properties": {
          "media": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicMediaDescriptor"
            }
          },
          "sellingSettings": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ProductSellingSettings"
              },
              {
                "type": "null"
              }
            ]
          },
          "inventoryMode": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "untracked",
              "shared",
              "separate",
              null
            ]
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "price": {
            "type": "number"
          },
          "imageUrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "Absolute, publicly fetchable cover image URL (first gallery image), resolved by BeniBrain. Usable directly by any external caller — never a relative path."
          },
          "images": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Ordered gallery image URLs; the first is the cover image. Each is an absolute, publicly fetchable URL resolved by BeniBrain — never a relative path."
          },
          "categoryId": {
            "type": [
              "string",
              "null"
            ]
          },
          "categoryIds": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "type": "string"
            },
            "description": "All category memberships, with categoryId as the legacy first category"
          },
          "brandId": {
            "type": [
              "string",
              "null"
            ]
          },
          "brand": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "description": {
                "type": "string"
              }
            }
          },
          "productType": {
            "type": [
              "string",
              "null"
            ]
          },
          "collectionIds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "stockQuantity": {
            "type": "number"
          },
          "trackInventory": {
            "type": "boolean",
            "description": "When false, this product is never out of stock and its stockQuantity is not meaningful"
          },
          "preorderEnabled": {
            "type": "boolean",
            "description": "When true, this product can still be ordered as a pre-order even when stockQuantity is 0."
          },
          "requiresShipping": {
            "type": "boolean"
          },
          "fulfilmentMethod": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "delivery",
              "collection",
              "delivery_or_collection",
              "no_physical",
              null
            ]
          },
          "badge": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ProductBadge"
              },
              {
                "type": "null"
              }
            ],
            "description": "Optional customer-facing merchandising label (e.g. \"New\", \"Bestseller\", or a merchant-written custom phrase). Separate from any internal tagging — always shown to shoppers when present."
          },
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductOption"
            },
            "description": "Option groups; empty when the product has no variants"
          },
          "variants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductVariant"
            },
            "description": "Sellable variants; empty when the product has no variants"
          },
          "customizations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductCustomization"
            },
            "description": "Customer-entered fields available for this product"
          },
          "ratingAverage": {
            "type": [
              "number",
              "null"
            ],
            "description": "Average approved star rating (1 decimal place), null when unreviewed"
          },
          "ratingCount": {
            "type": "number",
            "description": "Number of approved reviews"
          }
        }
      },
      "PublicStorefrontCapabilities": {
        "type": "object",
        "description": "Optional hosted-storefront navigation and identity hints; existing connected-site consumers may ignore this object.",
        "required": [
          "logoUrl",
          "shopAvailable",
          "bookingAvailable"
        ],
        "properties": {
          "logoUrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "Resolved public logo URL, or null when unconfigured or invalid."
          },
          "logoMedia": {
            "$ref": "#/components/schemas/PublicMediaDescriptor"
          },
          "brandColor": {
            "type": "string",
            "description": "The business's brand colour as"
          },
          "shopAvailable": {
            "type": "boolean",
            "description": "At least one active product OR hosted gift-card purchases enabled."
          },
          "bookingAvailable": {
            "type": "boolean",
            "description": "At least one active service."
          }
        }
      },
      "PurchasedGiftCardSummary": {
        "type": "object",
        "required": [
          "purchaseIndex",
          "amount",
          "currency",
          "recipientEmail",
          "issuanceStatus",
          "issuedAt",
          "cardStatus",
          "emailDeliveryStatus"
        ],
        "properties": {
          "purchaseIndex": {
            "type": "number"
          },
          "amount": {
            "type": "number",
            "description": "Face value in major currency units."
          },
          "currency": {
            "type": "string"
          },
          "recipientEmail": {
            "type": "string"
          },
          "issuanceStatus": {
            "type": "string",
            "enum": [
              "pending",
              "issued",
              "unknown"
            ]
          },
          "issuedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "cardStatus": {
            "type": [
              "string",
              "null"
            ]
          },
          "emailDeliveryStatus": {
            "type": "string",
            "description": "Persisted attempt outcome or provider event. Accepted is not delivered; unknown is not failed."
          }
        }
      },
      "RelatedProduct": {
        "type": "object",
        "required": [
          "id",
          "name",
          "price"
        ],
        "properties": {
          "media": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicMediaDescriptor"
            }
          },
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "price": {
            "type": "number",
            "description": "Lowest variant price when the product has variants"
          },
          "imageUrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "Absolute, publicly fetchable image URL resolved by BeniBrain. Usable directly by any external caller — never a relative path."
          }
        }
      },
      "ServiceCommerceSettings": {
        "type": "object",
        "required": [
          "version",
          "before",
          "after",
          "location",
          "start",
          "end",
          "weekdays",
          "depositType",
          "deposit",
          "included",
          "preparation",
          "aftercare"
        ],
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "before": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1440
          },
          "after": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1440
          },
          "location": {
            "type": "string",
            "maxLength": 2000
          },
          "address": {
            "$ref": "#/components/schemas/PostalAddress"
          },
          "hoursMode": {
            "type": "string",
            "enum": [
              "inherit",
              "restricted"
            ],
            "description": "\"inherit\" (default): bookable whenever an eligible team member is available. \"restricted\": start/end/weekdays further narrow the effective staff/business availability for this service only."
          },
          "start": {
            "type": "string",
            "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
          },
          "end": {
            "type": "string",
            "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
          },
          "weekdays": {
            "type": "array",
            "uniqueItems": true,
            "items": {
              "type": "integer",
              "minimum": 0,
              "maximum": 6
            }
          },
          "depositType": {
            "type": "string",
            "enum": [
              "amount",
              "percent"
            ]
          },
          "deposit": {
            "type": "number",
            "minimum": 0,
            "description": "Currency amount or percentage according to depositType."
          },
          "requireCard": {
            "type": "boolean",
            "description": "Ask the customer to save a card when booking, for no-show and late-cancellation fees."
          },
          "atCustomer": {
            "type": "boolean",
            "description": "For a business that works in both places: this service is done at the customer's address."
          },
          "askEquipment": {
            "type": "boolean",
            "description": "Ask about the customer's machine, vehicle or appliance when booking."
          },
          "perEquipment": {
            "type": "boolean",
            "description": "Price and time are for each machine."
          },
          "included": {
            "type": "string",
            "maxLength": 20000
          },
          "preparation": {
            "type": "string",
            "maxLength": 20000
          },
          "aftercare": {
            "type": "string",
            "maxLength": 20000
          }
        }
      },
      "ShippingAddress": {
        "type": "object",
        "required": [
          "line1",
          "city",
          "postcode",
          "country"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "line1": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "line2": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 200
          },
          "city": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "state": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 100
          },
          "postcode": {
            "type": "string",
            "minLength": 1,
            "maxLength": 20
          },
          "country": {
            "type": "string",
            "minLength": 2,
            "maxLength": 2,
            "description": "ISO 3166-1 alpha-2 country code e.g. GB"
          }
        }
      },
      "StaffMember": {
        "type": "object",
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "avatarUrl": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "StoreCheckoutCustomization": {
        "type": "object",
        "required": [
          "customizationId"
        ],
        "properties": {
          "choiceIds": {
            "type": "array",
            "uniqueItems": true,
            "maxItems": 20,
            "items": {
              "type": "string"
            },
            "description": "Selected choices for a multiselect field."
          },
          "fileToken": {
            "type": "string",
            "description": "Opaque token returned by the private buyer attachment upload; never file data or an object path."
          },
          "customizationId": {
            "type": "string"
          },
          "textValue": {
            "type": "string",
            "maxLength": 5000,
            "description": "Value for text, textarea, number or date fields. Numbers use finite decimal text and dates use YYYY-MM-DD."
          },
          "choiceId": {
            "type": "string",
            "description": "Selected choice for radio and dropdown customisations"
          },
          "checked": {
            "type": "boolean",
            "description": "Selected state for checkbox customisations"
          }
        }
      },
      "StoreCheckoutInput": {
        "type": "object",
        "required": [
          "apiKey",
          "customerName",
          "customerEmail",
          "items"
        ],
        "properties": {
          "apiKey": {
            "type": "string"
          },
          "customerName": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "customerEmail": {
            "type": "string",
            "minLength": 3,
            "maxLength": 320
          },
          "customerPhone": {
            "type": "string",
            "description": "Customer phone number in E.164 format (e.g. +14155551234). Optional — used to send SMS order updates when the business has SMS enabled."
          },
          "smsConsent": {
            "type": "boolean",
            "description": "Explicit opt-in checkbox shown alongside the phone field. SMS order/shipping updates are only sent when true, regardless of business settings."
          },
          "items": {
            "type": "array",
            "maxItems": 50,
            "items": {
              "$ref": "#/components/schemas/StoreCheckoutItem"
            }
          },
          "giftCardPurchases": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "$ref": "#/components/schemas/GiftCardPurchase"
            },
            "description": "Digital gift cards to issue after this checkout is paid"
          },
          "giftCardCode": {
            "type": "string",
            "maxLength": 32,
            "description": "Gift-card code to redeem as payment"
          },
          "shippingAddress": {
            "$ref": "#/components/schemas/ShippingAddress",
            "description": "Required when the resolved fulfilment method for this cart is \"delivery\""
          },
          "selectedFulfilmentMethod": {
            "type": "string",
            "enum": [
              "delivery",
              "collection"
            ],
            "description": "Required only when the cart's compatible methods include both delivery and collection (i.e. every physical line allows both, via delivery_or_collection). Ignored/rejected if the cart's items force a single method."
          },
          "tipAmount": {
            "type": "number",
            "description": "Customer-selected gratuity in the store currency",
            "minimum": 0
          },
          "redeemPoints": {
            "type": "number",
            "description": "Number of loyalty points to redeem as a discount on this order. Requires a signed-in storefront customer session for the matching customerEmail.",
            "minimum": 0
          },
          "discountCode": {
            "type": "string",
            "maxLength": 64,
            "description": "Discount code to apply to this order (case-insensitive)"
          },
          "recoveredFromOrderId": {
            "type": "string",
            "description": "Order ID from an abandoned-cart recovery link, used to attribute this checkout to cart recovery (verified server-side)"
          },
          "successUrl": {
            "type": "string",
            "description": "Where Stripe redirects after payment. Must be an https(s) URL on the business's own verified domain/whitelist (validated server-side) — otherwise BeniBrain's own default order-status return page is used. BeniBrain does NOT append or substitute the order-access token into a caller-supplied successUrl/cancelUrl; a connected website that supplies its own value must keep the `orderToken` from this response (e.g. in localStorage) and match it up itself after the redirect back, since the URL alone will not carry it."
          },
          "cancelUrl": {
            "type": "string",
            "description": "Where Stripe redirects if the customer cancels before paying. Same trusted-origin rule as successUrl."
          },
          "paymentMode": {
            "type": "string",
            "enum": [
              "hosted",
              "embedded"
            ],
            "description": "embedded returns a PaymentIntent client secret for the on-page Payment Element (cards, Apple Pay, Google Pay, Link); hosted (default) returns a Stripe Checkout URL"
          }
        }
      },
      "StoreCheckoutItem": {
        "type": "object",
        "required": [
          "productId",
          "quantity"
        ],
        "properties": {
          "productId": {
            "type": "string"
          },
          "variantId": {
            "type": "string",
            "description": "Required when the product has variants"
          },
          "quantity": {
            "type": "number",
            "minimum": 1,
            "maximum": 100
          },
          "customizations": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/StoreCheckoutCustomization"
            }
          }
        }
      },
      "StoreCheckoutResponse": {
        "type": "object",
        "required": [
          "orderId",
          "orderToken",
          "stripeLivemode"
        ],
        "properties": {
          "orderId": {
            "type": "string"
          },
          "orderToken": {
            "type": "string",
            "description": "Opaque order-access token for GET /public/store/order and the storefront's own order-confirmation/cart-restore links. The raw orderId is never accepted as a lookup credential."
          },
          "checkoutUrl": {
            "type": [
              "string",
              "null"
            ],
            "description": "Stripe Checkout URL; null when the order is fully covered by a gift card and/or reserved loyalty points"
          },
          "stripeLivemode": {
            "type": "boolean",
            "description": "Whether this checkout used the connected Stripe account's live (real-money) mode, taken directly from the created Stripe Checkout Session or PaymentIntent's own `livemode` field — `false` means a Stripe test-mode transaction (e.g. a `cs_test_...`/`pi_test_...` id), not a real charge. When the order is fully covered by a gift card/loyalty points and no Stripe object is created, this reflects the connected account's configured credential mode instead. Connected websites must use this field (never infer live/test from `checkoutUrl` or the session id prefix) to decide whether a payment was real before taking any payment-security action such as releasing goods or marking an order fulfilled."
          },
          "loyaltyPointsEarned": {
            "type": "number",
            "description": "Points credited to the customer's loyalty account for this order"
          },
          "loyaltyPointsRedeemed": {
            "type": "number",
            "description": "Points deducted from the customer's loyalty account as a redemption discount"
          },
          "loyaltyDiscount": {
            "type": "number",
            "description": "Monetary discount applied from loyalty point redemption (in order currency)"
          },
          "discountCode": {
            "type": [
              "string",
              "null"
            ],
            "description": "Discount code applied to this order (upper-cased)"
          },
          "discountAmount": {
            "type": "number",
            "description": "Monetary discount applied from the discount code"
          },
          "shippingAmount": {
            "type": "number",
            "description": "Shipping charged on this order"
          },
          "giftCardAmount": {
            "type": "number",
            "description": "Amount paid from a gift card"
          },
          "clientSecret": {
            "type": [
              "string",
              "null"
            ],
            "description": "PaymentIntent client secret for the embedded Payment Element (embedded mode only)"
          },
          "publishableKey": {
            "type": [
              "string",
              "null"
            ],
            "description": "Stripe publishable key for loading Stripe.js (embedded mode only)"
          },
          "stripeAccountId": {
            "type": [
              "string",
              "null"
            ],
            "description": "Connected Stripe account the payment is processed on (embedded mode only)"
          },
          "amountDue": {
            "type": "number",
            "description": "Amount the customer still pays by card/wallet after gift-card redemption (embedded mode only)"
          }
        }
      },
      "StudioChoice": {
        "type": "object",
        "required": [
          "id",
          "label",
          "adjustment",
          "minutes"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "choiceId": {
            "type": "string",
            "description": "Persisted service choice ID bound by the server."
          },
          "label": {
            "type": "string"
          },
          "adjustment": {
            "type": "number"
          },
          "minutes": {
            "type": "integer"
          },
          "imageId": {
            "type": "string",
            "description": "Legacy first image; superseded by imageIds but kept as imageIds[0] for backwards compatibility."
          },
          "imageIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Ordered gallery image ids assigned to this choice value; applies to every matching combination unless a StudioException overrides it."
          },
          "removed": {
            "type": "boolean"
          }
        }
      },
      "StudioException": {
        "type": "object",
        "properties": {
          "excluded": {
            "type": "boolean"
          },
          "price": {
            "type": "number",
            "minimum": 0
          },
          "imageId": {
            "type": "string",
            "description": "Legacy first image; superseded by imageIds but kept as imageIds[0] for backwards compatibility."
          },
          "imageIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Ordered gallery image ids that override the choice-level set for this specific combination only; does not mutate the shared choice-level list."
          }
        }
      },
      "StudioGroup": {
        "type": "object",
        "required": [
          "id",
          "name",
          "values"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "groupId": {
            "type": "string",
            "description": "Persisted service group ID bound by the server."
          },
          "name": {
            "type": "string"
          },
          "removed": {
            "type": "boolean"
          },
          "values": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StudioChoice"
            }
          }
        }
      },
      "StudioMedia": {
        "type": "object",
        "required": [
          "id",
          "src",
          "alt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "src": {
            "type": "string"
          },
          "alt": {
            "type": "string"
          }
        }
      },
      "StudioMetadata": {
        "type": "object",
        "required": [
          "version",
          "groups",
          "visualGroup",
          "exceptions"
        ],
        "description": "Stable authoring identities and scoped exceptions. Operational prices and inventory remain server-owned.",
        "properties": {
          "version": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StudioGroup"
            }
          },
          "visualGroup": {
            "type": "string"
          },
          "exceptions": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/StudioException"
            }
          },
          "media": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StudioMedia"
            }
          }
        }
      },
      "TimeSlot": {
        "type": "object",
        "required": [
          "startsAt",
          "endsAt",
          "label"
        ],
        "properties": {
          "startsAt": {
            "type": "string",
            "format": "date-time"
          },
          "endsAt": {
            "type": "string",
            "format": "date-time"
          },
          "label": {
            "type": "string",
            "description": "Human-readable start time in the business timezone (e.g. \"09:30\")"
          },
          "bestFit": {
            "type": "boolean",
            "description": "For a business that travels, a time that adds the least driving to the day"
          },
          "arrivalWindowStart": {
            "type": "string",
            "format": "date-time",
            "description": "For a business that gives arrival windows, the window this time represents; show the window, not the time"
          },
          "arrivalWindowEnd": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WebhookDeliveryDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/WebhookDeliveryLog"
          },
          {
            "type": "object",
            "required": [
              "responseHeaders"
            ],
            "properties": {
              "responseHeaders": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        ]
      },
      "WebhookDeliveryLog": {
        "type": "object",
        "required": [
          "id",
          "event",
          "statusCode",
          "attempt",
          "ok",
          "durationMs",
          "error",
          "responseExcerpt",
          "createdAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "event": {
            "type": "string"
          },
          "statusCode": {
            "type": "number"
          },
          "attempt": {
            "type": "number"
          },
          "ok": {
            "type": "boolean"
          },
          "durationMs": {
            "type": [
              "number",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "responseExcerpt": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 500
          }
        }
      },
      "WebhookDeliveryPage": {
        "type": "object",
        "required": [
          "deliveries",
          "nextOffset"
        ],
        "properties": {
          "deliveries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookDeliveryLog"
            }
          },
          "nextOffset": {
            "type": [
              "number",
              "null"
            ]
          }
        }
      },
      "WebhookEndpoint": {
        "type": "object",
        "required": [
          "id",
          "url",
          "description",
          "events",
          "isActive",
          "secretRotatedAt",
          "lastDelivery",
          "createdAt",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "events": {
            "type": "string",
            "description": "Comma-separated event types or '*' for all"
          },
          "isActive": {
            "type": "boolean"
          },
          "secretRotatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "lastDelivery": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WebhookLastDelivery"
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WebhookEndpointWithSecret": {
        "allOf": [
          {
            "$ref": "#/components/schemas/WebhookEndpoint"
          },
          {
            "type": "object",
            "properties": {
              "secret": {
                "type": "string",
                "description": "HMAC-SHA256 signing secret — only returned at creation"
              }
            }
          }
        ]
      },
      "WebhookInput": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string"
          },
          "events": {
            "type": "string",
            "description": "Comma-separated event types or '*' for all"
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 500
          }
        }
      },
      "WebhookLastDelivery": {
        "type": "object",
        "required": [
          "at",
          "statusCode",
          "ok",
          "durationMs"
        ],
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time"
          },
          "statusCode": {
            "type": "number"
          },
          "ok": {
            "type": "boolean"
          },
          "durationMs": {
            "type": [
              "number",
              "null"
            ]
          }
        }
      },
      "WebhookRotatedSecret": {
        "type": "object",
        "required": [
          "secret",
          "secretRotatedAt"
        ],
        "properties": {
          "secret": {
            "type": "string",
            "description": "New signing secret, returned once"
          },
          "secretRotatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WebhookUpdate": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string"
          },
          "events": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 500
          },
          "isActive": {
            "type": "boolean"
          }
        }
      },
      "WebsiteEnquiryInput": {
        "type": "object",
        "required": [
          "apiKey",
          "name",
          "email",
          "message"
        ],
        "properties": {
          "apiKey": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "email": {
            "type": "string",
            "maxLength": 254
          },
          "message": {
            "type": "string",
            "maxLength": 5000
          },
          "phone": {
            "type": "string",
            "description": "Optional. Saved to the customer if they have no number yet."
          },
          "address": {
            "type": "string",
            "description": "Optional. Where the work is needed."
          },
          "subject": {
            "type": "string",
            "maxLength": 120
          },
          "source": {
            "type": "string",
            "maxLength": 60,
            "description": "Optional label for where it came from, e.g. contact-form or out-of-area"
          },
          "website": {
            "type": "string",
            "description": "Hidden anti-bot field. Leave empty."
          }
        }
      },
      "WebsiteEnquiryReceived": {
        "type": "object",
        "required": [
          "received"
        ],
        "properties": {
          "received": {
            "type": "boolean"
          },
          "conversationId": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "query",
        "name": "apiKey",
        "description": "A business's public storefront/booking key (looks like lc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx). Safe to embed in client-side code."
      },
      "BusinessSession": {
        "type": "http",
        "scheme": "bearer",
        "description": "Authenticated BeniBrain business session. Used only for the /webhooks and /integrations/website management endpoints, which act on your own business's account."
      }
    }
  }
}
