Welcome
The BookFlow API is an HTTP/JSON service that powers the BookFlow dashboard, the public booking pages, and the embeddable widget. The service is built as a Hono app on Cloudflare Workers and persists data in a D1 (SQLite) database.
Base URL
All endpoints live under a single base URL.
https://booking-api.netwit.caFor local development, the same Worker runs on http://localhost:8787 via wrangler dev.
Three audiences, three JWTs
BookFlow has three separate authentication spaces. A token from one space will not work in another — they are signed with the same secret but carry a different aud claim and target different routes.
- Public — no auth.
/api/public/*powers the customer-facing booking flow (browse services, check availability, create a booking, reschedule, cancel). - Owner — JWT returned by
POST /api/auth/login. The token has noaudclaim; the route groups under/api/businesses,/api/services,/api/staff,/api/bookings,/api/customers,/api/payments, and/api/aiaccept it. It is tenant-scoped: every call must satisfy thetenantIdencoded in the token. - Customer — JWT with
aud: customer./api/customer-auth/loginreturns this token. It is not tenant-scoped — a single customer can have bookings with many tenants. Calls land on/api/me/*.
super_admin audience for /api/admin/*. This is internal and not documented here.14 D1 tables
Data lives in 14 tables across 5 migrations (0001-0005). The relationship between users and tenants is many-to-many via tenant_members. End-customer accounts live in customer_users (a separate table from users, which is reserved for owners and staff) and are linked to specific tenants only after they actually book.
tenants— the businesses (one per sign-up)users— owners and stafftenant_members— links users to tenants with a rolestaff_profiles— public-facing staff (display name, title, bio, avatar, color)services— what each tenant offersworking_hours— per-staff weekly hours (day_of_week + open/close)customers— per-tenant customer profiles (tags, blacklist, notes, totals)bookings— every appointmentpayments— Stripe PaymentIntents, refunds, status mirrorscustomer_users— cross-tenant end-customer accountscustomer_tenant_links— per-customer per-tenant rollup (first/last visit, total bookings/spent)super_admins+super_admin_sessions— platform operators (sessions are KV-backed; the table is for audit)audit_log— every super admin write actionai_actions— every AI agent action (drafts, sent, reversed, approved)
Quick start
# 1. Get a token (owner)
curl -X POST https://booking-api.netwit.ca/api/auth/login \
-H "content-type: application/json" \
-d '{"email":"you@example.com","password":"..."}'
# 2. Read your business profile
curl https://booking-api.netwit.ca/api/businesses/me \
-H "authorization: Bearer $TOKEN"OpenAPI
A machine-readable spec is on the roadmap. See the OpenAPI page for status.
Email hello@netwit.ca or call +1-604-206-8169. NetWit responds in 1 business day.