{"openapi":"3.1.0","info":{"title":"Your Business API","version":"v1","description":"The same business brain the chat and the MCP server use: open times, bookings, moves, cancels, blocked time, payments, refunds, revenue, booking counts and customers. Every write takes an Idempotency-Key."},"servers":[{"url":"https://book.prmio.com/v1"}],"security":[{"apiKey":[]}],"tags":[{"name":"Business"},{"name":"Bookings"},{"name":"Schedule"},{"name":"Payments"},{"name":"Metrics"},{"name":"Insights"},{"name":"Customers"},{"name":"Memory"},{"name":"Webhooks"}],"paths":{"/business":{"get":{"tags":["Business"],"summary":"The business (name, services, hours, time zone)","operationId":"getBusiness","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Business"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/services":{"get":{"tags":["Business"],"summary":"Services with price and length","operationId":"listServices","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Service"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}},"required":["object","data","has_more"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/availability":{"get":{"tags":["Bookings"],"summary":"Open times for a service","operationId":"getAvailability","parameters":[{"name":"service","in":"query","description":"Service id (from /services)","required":true,"schema":{"type":"string"}},{"name":"date","in":"query","description":"A day, YYYY-MM-DD (business time). Without it: the next openings.","required":false,"schema":{"type":"string"}},{"name":"party","in":"query","description":"People","required":false,"schema":{"type":"integer","minimum":1}},{"name":"limit","in":"query","description":"How many","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Availability"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/bookings":{"get":{"tags":["Bookings"],"summary":"List bookings","operationId":"listBookings","parameters":[{"name":"from","in":"query","description":"ISO date-time","required":false,"schema":{"type":"string"}},{"name":"to","in":"query","description":"ISO date-time","required":false,"schema":{"type":"string"}},{"name":"status","in":"query","description":"booked, cancelled, done, no_show","required":false,"schema":{"type":"string"}},{"name":"customer","in":"query","description":"A customer_ref","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"1-100","required":false,"schema":{"type":"integer"}},{"name":"starting_after","in":"query","description":"The next_cursor from the last page","required":false,"schema":{"type":"string"}},{"name":"order","in":"query","description":"asc or desc","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Booking"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}},"required":["object","data","has_more"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Bookings"],"summary":"Book","operationId":"createBooking","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingCreate"},"example":{"service":"private-session","start":"2026-11-25T10:00","customer":{"name":"Ana Diaz","phone":"+15555550101"}}}}},"responses":{"201":{"description":"Booked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Booking"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/bookings/{booking_ref}":{"get":{"tags":["Bookings"],"summary":"One booking","operationId":"getBooking","parameters":[{"name":"booking_ref","in":"path","required":true,"description":"BK-XXXXXX","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Booking"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"patch":{"tags":["Bookings"],"summary":"Move a booking","operationId":"moveBooking","parameters":[{"name":"booking_ref","in":"path","required":true,"description":"BK-XXXXXX","schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"start":{"type":"string","description":"New start (business time or with an offset)"}},"required":["start"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Booking"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/bookings/{booking_ref}/cancel":{"post":{"tags":["Bookings"],"summary":"Cancel a booking (paid deposits are refunded)","operationId":"cancelBooking","parameters":[{"name":"booking_ref","in":"path","required":true,"description":"BK-XXXXXX","schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"refund":{"type":"boolean","default":true},"reason":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Booking"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/schedule":{"get":{"tags":["Schedule"],"summary":"A day's bookings and blocked time","operationId":"getSchedule","parameters":[{"name":"date","in":"query","description":"YYYY-MM-DD (default: today)","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/blocks":{"post":{"tags":["Schedule"],"summary":"Block time","operationId":"blockTime","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"},"reason":{"type":"string"}},"required":["start","end"]}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Block"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/blocks/{block_ref}":{"delete":{"tags":["Schedule"],"summary":"Unblock","operationId":"unblockTime","parameters":[{"name":"block_ref","in":"path","required":true,"description":"BLK-XXXXXX","schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Block"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/payments":{"get":{"tags":["Payments"],"summary":"List payments","operationId":"listPayments","parameters":[{"name":"booking","in":"query","description":"A booking_ref","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"1-100","required":false,"schema":{"type":"integer"}},{"name":"starting_after","in":"query","description":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Payment"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}},"required":["object","data","has_more"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Payments"],"summary":"Take a payment (a pay link on the business's own payment platform, or record one taken in person)","operationId":"takePayment","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"booking_ref":{"type":"string"},"method":{"enum":["link","in_person","card_on_file"]},"amount_cents":{"type":"integer"},"kind":{"enum":["charge","deposit","no_show_fee"]},"cash":{"type":"boolean"}},"required":["booking_ref"]}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/payments/{payment_ref}/refund":{"post":{"tags":["Payments"],"summary":"Refund (all, or amount_cents)","operationId":"refundPayment","parameters":[{"name":"payment_ref","in":"path","required":true,"description":"PAY-XXXXXX","schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount_cents":{"type":"integer"},"reason":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/metrics/revenue":{"get":{"tags":["Metrics"],"summary":"Revenue (payments in, minus refunds)","operationId":"getRevenue","parameters":[{"name":"period","in":"query","description":"today, yesterday, this_week, last_week, this_month, last_month, last_7_days, last_30_days, this_year, or custom (with from and to)","required":false,"schema":{"type":"string"}},{"name":"from","in":"query","description":"YYYY-MM-DD","required":false,"schema":{"type":"string"}},{"name":"to","in":"query","description":"YYYY-MM-DD","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/metrics/bookings":{"get":{"tags":["Metrics"],"summary":"Booking counts","operationId":"getBookingCounts","parameters":[{"name":"period","in":"query","description":"today, yesterday, this_week, last_week, this_month, last_month, last_7_days, last_30_days, this_year, or custom (with from and to)","required":false,"schema":{"type":"string"}},{"name":"from","in":"query","description":"YYYY-MM-DD","required":false,"schema":{"type":"string"}},{"name":"to","in":"query","description":"YYYY-MM-DD","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/metrics/ai_cost":{"get":{"tags":["Metrics"],"summary":"What the AI assistant cost","operationId":"getAiCost","parameters":[{"name":"period","in":"query","description":"today, yesterday, this_week, last_week, this_month, last_month, last_7_days, last_30_days, this_year, or custom (with from and to)","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/customers":{"get":{"tags":["Customers"],"summary":"Customers","operationId":"listCustomers","parameters":[{"name":"query","in":"query","description":"Name, phone or email","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"1-100","required":false,"schema":{"type":"integer"}},{"name":"starting_after","in":"query","description":"cursor","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}},"has_more":{"type":"boolean"},"next_cursor":{"type":["string","null"]}},"required":["object","data","has_more"]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/customers/{customer_ref}":{"get":{"tags":["Customers"],"summary":"One customer with their bookings","operationId":"getCustomer","parameters":[{"name":"customer_ref","in":"path","required":true,"description":"CUS-XXXXXX","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Customer"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/customer_sessions":{"post":{"tags":["Memory"],"security":[],"summary":"A customer signs in: a code is texted to their mobile (the same answer whether or not the number is a customer here)","operationId":"startCustomerSession","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"business":{"type":"string"},"phone":{"type":"string"}},"required":["business","phone"]}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/customer_sessions/verify":{"post":{"tags":["Memory"],"security":[],"summary":"The code → a customer token (Bearer ctk_…, 12 hours, this business only). It reaches only open times, the customer's own bookings and their memory","operationId":"verifyCustomerSession","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"business":{"type":"string"},"phone":{"type":"string"},"code":{"type":"string"}},"required":["business","phone","code"]}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"customer_token":{"type":"string"},"expires_at":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/me":{"get":{"tags":["Memory"],"summary":"The signed-in customer (customer token)","operationId":"getMe","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/me/memory":{"get":{"tags":["Memory"],"summary":"What is remembered about the signed-in customer: their usual (from their bookings) and their booking preferences","operationId":"getMyMemory","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Memory"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["Memory"],"summary":"\"Forget me\": every card deleted, signed out everywhere; earlier bookings no longer count toward the usual","operationId":"forgetMe","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/customers/{ref}/memory":{"get":{"tags":["Memory"],"summary":"What is remembered about one customer (owner keys)","operationId":"getCustomerMemory","parameters":[{"name":"ref","in":"path","required":true,"description":"customer_ref","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Memory"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["Memory"],"summary":"Forget one customer (full owner keys)","operationId":"forgetCustomer","parameters":[{"name":"ref","in":"path","required":true,"description":"customer_ref","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/insights":{"get":{"tags":["Insights"],"summary":"Fill rate (by class, time of day, staff), busiest and slowest times, staff, no-shows, new vs returning customers, booked value. as_of rebuilds them as they stood at the end of that day","operationId":"getInsights","parameters":[{"name":"period","in":"query","description":"today, yesterday, this_week, last_week, this_month, last_month, last_7_days, last_30_days, this_year, or custom (with from and to)","required":false,"schema":{"type":"string"}},{"name":"from","in":"query","description":"YYYY-MM-DD (custom)","required":false,"schema":{"type":"string"}},{"name":"to","in":"query","description":"YYYY-MM-DD (custom)","required":false,"schema":{"type":"string"}},{"name":"as_of","in":"query","description":"YYYY-MM-DD or a date-time","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/insights/pacing":{"get":{"tags":["Insights"],"summary":"This week now vs this week as it stood at an earlier moment: booked value (% up or down), fill rate, morning fill rate, anything notable","operationId":"getPacing","parameters":[{"name":"since","in":"query","description":"YYYY-MM-DD (the end of that day) or a date-time","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/webhook_endpoints":{"get":{"tags":["Webhooks"],"summary":"Your webhook endpoints","operationId":"listWebhookEndpoints","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["Webhooks"],"summary":"Add an endpoint (the whsec_ secret is shown once)","operationId":"createWebhookEndpoint","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"enum":["*","booking.created","booking.updated","booking.cancelled","payment.succeeded","payment.refunded","customer.created"]}}},"required":["url"]}}}},"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/webhook_endpoints/{endpoint_ref}":{"delete":{"tags":["Webhooks"],"summary":"Delete an endpoint","operationId":"deleteWebhookEndpoint","parameters":[{"name":"endpoint_ref","in":"path","required":true,"description":"WHE-XXXXXX","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/webhook_endpoints/{endpoint_ref}/resume":{"post":{"tags":["Webhooks"],"summary":"Resume a paused endpoint","operationId":"resumeWebhookEndpoint","parameters":[{"name":"endpoint_ref","in":"path","required":true,"description":"WHE-XXXXXX","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/webhook_deliveries":{"get":{"tags":["Webhooks"],"summary":"Delivery log (every attempt)","operationId":"listWebhookDeliveries","parameters":[{"name":"endpoint","in":"query","description":"endpoint_ref","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"1-100","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/webhook_deliveries/{delivery_id}/resend":{"post":{"tags":["Webhooks"],"summary":"Send a delivery again","operationId":"resendWebhookDelivery","parameters":[{"name":"delivery_id","in":"path","required":true,"description":"dlv_…","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}}}},"/incoming/{business}":{"post":{"tags":["Webhooks"],"summary":"Incoming webhook: your system pushes changes to us (Standard Webhooks signature with your incoming whsec_ secret, no API key)","operationId":"incomingWebhook","security":[],"parameters":[{"name":"business","in":"path","required":true,"description":"The business handle","schema":{"type":"string"}},{"name":"webhook-id","in":"header","required":true,"schema":{"type":"string"}},{"name":"webhook-timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"webhook-signature","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IncomingEvent"},"example":{"type":"booking.created","data":{"service":"express-wash","start":"2026-11-25T10:00:00-08:00","customer":{"name":"Sam Lee","phone":"+15555550177"},"external_id":"their-123"}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Error"}}}}},"webhooks":{"booking.created":{"post":{"summary":"booking.created (Standard Webhooks: webhook-id, webhook-timestamp, webhook-signature \"v1,<base64 HMAC-SHA256>\")","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Any 2xx = received. 410 = stop sending to this endpoint. Anything else is retried with backoff."}}}},"booking.updated":{"post":{"summary":"booking.updated (Standard Webhooks: webhook-id, webhook-timestamp, webhook-signature \"v1,<base64 HMAC-SHA256>\")","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Any 2xx = received. 410 = stop sending to this endpoint. Anything else is retried with backoff."}}}},"booking.cancelled":{"post":{"summary":"booking.cancelled (Standard Webhooks: webhook-id, webhook-timestamp, webhook-signature \"v1,<base64 HMAC-SHA256>\")","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Any 2xx = received. 410 = stop sending to this endpoint. Anything else is retried with backoff."}}}},"payment.succeeded":{"post":{"summary":"payment.succeeded (Standard Webhooks: webhook-id, webhook-timestamp, webhook-signature \"v1,<base64 HMAC-SHA256>\")","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Any 2xx = received. 410 = stop sending to this endpoint. Anything else is retried with backoff."}}}},"payment.refunded":{"post":{"summary":"payment.refunded (Standard Webhooks: webhook-id, webhook-timestamp, webhook-signature \"v1,<base64 HMAC-SHA256>\")","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Any 2xx = received. 410 = stop sending to this endpoint. Anything else is retried with backoff."}}}},"customer.created":{"post":{"summary":"customer.created (Standard Webhooks: webhook-id, webhook-timestamp, webhook-signature \"v1,<base64 HMAC-SHA256>\")","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"}}}},"responses":{"200":{"description":"Any 2xx = received. 410 = stop sending to this endpoint. Anything else is retried with backoff."}}}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"sk_test_… / sk_live_… (full) or rk_test_… / rk_live_… (read only). Made on the dashboard, shown once."}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"description":"Any unique string per write (a UUID). A retry with the same key and body returns the first answer and never repeats the change.","schema":{"type":"string","maxLength":255}}},"responses":{"Error":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Memory":{"type":"object","description":"What Mem0 (the only memory) keeps for this customer at this business. Kept until deleted.","properties":{"object":{"const":"memory"},"enabled":{"type":"boolean"},"memories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"memory":{"type":"string"},"kind":{"type":"string"},"created_at":{"type":["string","null"]}}}}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"type":{"type":"string"},"code":{"type":["string","null"]},"message":{"type":"string"},"param":{"type":["string","null"]},"request_id":{"type":"string"}},"required":["type","message"]}}},"Business":{"type":"object","properties":{"handle":{"type":"string"},"name":{"type":"string"},"time_zone":{"type":"string"},"services":{"type":"array","items":{"$ref":"#/components/schemas/Service"}},"hours":{"type":"object"}}},"Service":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"minutes":{"type":"integer"},"price":{"type":["string","null"]},"price_cents":{"type":["integer","null"]},"capacity":{"type":"integer"},"deposit":{"type":["string","null"]}}},"Availability":{"type":"object","properties":{"service":{"type":"object"},"party":{"type":"integer"},"slots":{"type":"array","items":{"type":"object","properties":{"start":{"type":"string"},"day":{"type":"string"},"time":{"type":"string"},"staff":{"type":["string","null"]},"spots_left":{"type":"integer"}}}}}},"BookingCreate":{"type":"object","properties":{"service":{"type":"string"},"start":{"type":"string","description":"2026-11-25T10:00 (business time) or with an offset"},"party":{"type":"integer","minimum":1},"customer":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"}},"required":["name","phone"]},"notes":{"type":"string"},"customer_agreed_terms":{"type":"boolean","description":"Required when the booking has a deposit or a no-show fee: the customer agreed to them."}},"required":["service","start","customer"]},"Booking":{"type":"object","properties":{"booking_ref":{"type":"string"},"status":{"enum":["booked","cancelled","done","no_show"]},"service":{"type":"object"},"start":{"type":"string"},"end":{"type":"string"},"day":{"type":"string"},"time":{"type":"string"},"party":{"type":"integer"},"price":{"type":["string","null"]},"paid":{"type":"string"},"staff":{"type":["string","null"]},"customer":{"type":"object"}}},"Block":{"type":"object","properties":{"block_ref":{"type":"string"},"start":{"type":"string"},"end":{"type":"string"},"reason":{"type":["string","null"]}}},"Payment":{"type":"object","properties":{"payment_ref":{"type":"string"},"booking_ref":{"type":["string","null"]},"kind":{"type":"string"},"amount":{"type":"string"},"amount_cents":{"type":"integer"},"refunded_cents":{"type":"integer"},"status":{"type":"string"},"method":{"type":["string","null"]},"provider":{"type":"string"},"pay_url":{"type":["string","null"]}}},"Customer":{"type":"object","properties":{"customer_ref":{"type":"string"},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]}}},"WebhookEvent":{"type":"object","properties":{"type":{"enum":["booking.created","booking.updated","booking.cancelled","payment.succeeded","payment.refunded","customer.created"]},"timestamp":{"type":"string","format":"date-time"},"data":{"type":"object"}},"required":["type","timestamp","data"]},"IncomingEvent":{"type":"object","properties":{"type":{"enum":["booking.created","booking.updated","booking.cancelled","block.created"]},"data":{"type":"object"}},"required":["type","data"]}}}}