Developers
Put BarberFlow booking on your own website.
A simple REST API for your services, team, open times and bookings. Hand the prompt to an AI coding tool, or build it yourself in four calls.
Base URL
https://api.barberflow.com/v1Build a booking flow for my barbershop using the BarberFlow API.
Docs: https://api.barberflow.com/v1/llms-full.txt
My publishable key is bf_pk_your_publishable_key.
Pay in person only.
Show my locations, services, team and available times, then create the booking and show the confirmation.
If a location requires a verification code, sign the customer in with a one-time code before booking.What you can build
- Your services, team, open times and bookings, through a simple REST API.
- A booking made on your site gets the same confirmations and reminders as one made on your hosted booking page.
- It shows up in your calendar, customer list and reports, credited to your website.
- Customers pay in person in this version. When you want card checkout, your site hands off to your BarberFlow booking page.
Three steps, no developer needed
If you are building your site with an AI coding tool, this is all it takes.
Create a key
- In BarberFlow, open Settings → Developers and create a publishable key.
- Only the shop owner can create, roll or revoke keys.
- Add your website’s domain so the key only works from browsers on that domain.
Give your AI tool the prompt
- Paste the prompt into Lovable, v0, Cursor or Claude.
- Put your key in place of
bf_pk_your_publishable_key. - The docs link in it hands the tool the whole API in one file.
Publish
- Book a test appointment on your site.
- Check that it shows up in your BarberFlow calendar, then publish.
- Cancel the test booking from BarberFlow when you are done.
Four calls to a real booking
No library needed. The base URL is https://api.barberflow.com/v1, everything is JSON, and money is in cents.
List your locations
- Every request sends your publishable key as a bearer token.
- Only locations taking online bookings come back.
- Each has its address,
timezone, weeklyhoursandbookingVerification(NONE,PHONEorEMAIL).
GET /locations const API = 'https://api.barberflow.com/v1'; const headers = { Authorization: 'Bearer bf_pk_your_publishable_key' }; const locations = await fetch(`${API}/locations`, { headers }).then((res) => res.json()); const locationId = locations[0].id;List the services at a location
- Each service has an
idto pass inserviceIds, aname,priceCentswithcurrency"CAD",durationMinutesand thebarberIdswho offer it. - Add-ons are nested under the service they belong to.
GET /locations/{locationId}/services const services = await fetch(`${API}/locations/${locationId}/services`, { headers }).then((res) => res.json(), ); const haircut = services.find((service) => !service.addOnOnly && service.allowPayInPerson);- Each service has an
Find open times
- You get
days, each withslots. - A slot has
startsAt(ISO 8601 with the location's offset),time(HH:mmin shop time, ready to display) and thebarberIdsfree then. - Leave out
barberIdto merge every barber. - Ask for up to 14 days per call.
GET /locations/{locationId}/availability const params = new URLSearchParams({ serviceIds: haircut.id, from: '2026-10-20', to: '2026-10-26', }); const availability = await fetch(`${API}/locations/${locationId}/availability?${params}`, { headers, }).then((res) => res.json()); const slot = availability.days.find((day) => day.slots.length > 0)?.slots[0];- You get
Create the booking
- Mint one
Idempotency-Keyper booking attempt (letters, digits,-or_, up to 128) and reuse it only to retry that attempt. - A retry with the same location, barber, services, time and email returns the same booking instead of a second one. Anything else is
IDEMPOTENCY_KEY_REUSED. statusisSCHEDULED, orPENDING_APPROVALwhen the location approves bookings by hand. A retry reports where the booking stands now, such asCANCELLED.- Keep
manageTokento let the customer view, cancel or reschedule later, or link them tomanageUrl.
POST /bookings const idempotencyKey = crypto.randomUUID(); const res = await fetch(`${API}/bookings`, { method: 'POST', headers: { ...headers, 'Content-Type': 'application/json', 'Idempotency-Key': idempotencyKey, }, body: JSON.stringify({ locationId, barberId: slot.barberIds[0], serviceIds: [haircut.id], startsAt: slot.startsAt, customer: { name: 'Sam Lee', email: 'sam@example.com', phone: '+16475550123', smsMarketingConsent: false, }, }), }); if (!res.ok) { const { error } = await res.json(); throw new Error(`${error.code}: ${error.message}`); } const { booking, status, manageToken, manageUrl } = await res.json();- Mint one
One key for your site, one code for your customers
| Credential | Header | What it proves | Lasts |
|---|---|---|---|
| Publishable key | Authorization: Bearer bf_pk_… | Which shop the request is for | Until you roll or revoke it |
| Customer token | X-Customer-Token: bf_ct_… | A customer who signed in with a one-time code | 30 days |
| Manage token | X-Booking-Token: <manageToken> | Access to one booking, without signing in | Until 30 days after the appointment |
Your publishable key
- Send it on every request as
Authorization: Bearer bf_pk_…. - The key identifies your shop, so no URL ever carries a shop id.
- It is safe to put in browser code. Everything it can read or create is already public on your hosted booking page: your locations, services, team, open times and pay-in-person bookings.
- What the key adds is control: it only works from the domains you allow, it has its own rate limits, bookings made with it are credited to your website in your reports, and you can roll or revoke it at any time.
Allowed domains
- List your site's domains on the key, such as
https://thebarbershop.ca. A browser request from anywhere else is refused withORIGIN_NOT_ALLOWED. thebarbershop.caandwww.thebarbershop.cacount separately.*.thebarbershop.cacovers every subdomain, but not the bare domain.- Choose Any domain to let the key work from every website, for example before you have a domain.
- Add
http://localhost:3000while you build locally, and your real domain before you publish.
Rolling and revoking
- Roll
- Replaces the key with a new one in Settings → Developers.
- The old key stops working at once, so update your site straight away.
- The key’s name, allowed domains and booking history stay, and customers stay signed in.
- Revoke
- The key stops working at once, for good.
- Every customer token signed in through it stops working too.
Customer sign-in
- Sign a customer in with a one-time code by text or email, at any of your locations.
- Some locations also ask customers to confirm their phone number or email before booking. There, use the method the location asks for.
- Send
POST /verificationswith the location, the method and the customer's contact (email is always required), thenPOST /verifications/{id}/confirmwith the code they type. - The code expires after five minutes, and only the key that sent it can confirm it.
- You get back a customer token. Send it as
X-Customer-Token. It lasts 30 days, works only for your shop, and only with the key that created it. - With it, a customer can book at locations that require verification, see their profile and bookings at your shop, and cancel or reschedule their own bookings.
- There is no password, and it is not a sign-in to their BarberFlow account: it never reaches their bookings at other shops or anything else in BarberFlow.
const verification = await fetch(`${API}/verifications`, {
method: 'POST',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify({
locationId,
method: 'PHONE',
contact: { email: 'sam@example.com', phone: '+16475550123', name: 'Sam Lee' },
}),
}).then((res) => res.json());
const { customerToken } = await fetch(`${API}/verifications/${verification.id}/confirm`, {
method: 'POST',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify({ code }),
}).then((res) => res.json());
const signedIn = { ...headers, 'X-Customer-Token': customerToken };Manage tokens
- Every new booking also returns a
manageToken. - Send it as
X-Booking-Tokento read, cancel or reschedule that one booking without signing in. - It works until 30 days after the appointment.
The rules every endpoint follows
- Base URL
- Every path is relative to
https://api.barberflow.com/v1. - JSON
- Send
Content-Type: application/jsonwith every POST body, 64 KB at most. - Time
- Times come back as ISO 8601 with the location's offset, next to its
timezone. Times you send can be shop time (2026-10-20T14:30) or ISO 8601 with an offset. Dates areYYYY-MM-DDin the location's time zone. - Money
- Whole cents with
currency: "CAD". Taxes are included in a booking'stotalCents. - Ids
- Opaque strings. A service id is the
idof an entry from the services endpoint, and add-on ids work the same way. - Lists
- Locations, services and team return a bare JSON array.
GET /me/bookingsreturns{ bookings, nextCursor }, and availability returns an object withdays. - Idempotency
POST /bookingsneeds anIdempotency-Keyheader: a new random value for each booking attempt, reused only to retry that attempt.- Payments
- Bookings made here are pay in person. When the shop needs a card,
POST /bookingsanswersPAY_IN_PERSON_NOT_ALLOWEDwithdetails.bookingUrl, a link to finish the booking on BarberFlow.
Everything in version 1
Open an endpoint for its parameters, response fields, errors and a request you can copy.
Every error looks the same
- Any response that is not a 2xx carries an
errorobject. codeis stable and safe to branch on,messageis a sentence you can show the customer, anddetailsappears on some codes only.- Branch on the endpoint's own codes first.
VALIDATION_ERROR,NOT_FOUND,FORBIDDENandCONFLICTcan come back from any endpoint as fallbacks.
{
"error": {
"code": "SLOT_TAKEN",
"message": "That time was just taken. Please choose another time."
}
}46 error codes
| Status | Code | What it means |
|---|---|---|
| 400 | VALIDATION_ERROR | The request is not valid. details.issues names the field when a field is the problem. |
| 400 | INVALID_JSON | The body is not valid JSON. |
| 400 | INVALID_BODY | The body could not be read (for example an unsupported encoding). |
| 400 | INVALID_RANGE | to is before from. |
| 400 | RANGE_TOO_LARGE | The date range is longer than 14 days. |
| 400 | IDEMPOTENCY_KEY_REQUIRED | POST /bookings needs an Idempotency-Key header. |
| 400 | IDEMPOTENCY_KEY_INVALID | The Idempotency-Key must be 1 to 128 letters, digits, hyphens or underscores. |
| 400 | VERIFICATION_METHOD_MISMATCH | The location verifies bookings by the other method; use the one in its bookingVerification. |
| 400 | VERIFICATION_INVALID_PHONE | The phone number is not a valid Canadian number. |
| 400 | VERIFICATION_EMAIL_NOT_ALLOWED | A code cannot be sent for this email. The customer can sign in to BarberFlow to continue, or use a different email. |
| 400 | VERIFICATION_PHONE_OPTED_OUT | The phone replied STOP to BarberFlow texts, so no code was sent. The message names the number to text START to; the customer can do that or use a different phone number. |
| 400 | VERIFICATION_CODE_INVALID | The code is wrong. |
| 400 | VERIFICATION_CODE_EXPIRED | The code has expired. Start a new verification. |
| 401 | API_KEY_REQUIRED | No key was sent in the Authorization header. |
| 401 | API_KEY_INVALID | The key is unknown or has been revoked. |
| 401 | CUSTOMER_TOKEN_REQUIRED | This endpoint needs an X-Customer-Token header. |
| 401 | CUSTOMER_TOKEN_INVALID | The customer token is invalid, expired, or was issued under another key. Verify the customer again. |
| 401 | CREDENTIAL_REQUIRED | Send the booking manage token as X-Booking-Token, or the customer token as X-Customer-Token. |
| 403 | ORIGIN_NOT_ALLOWED | The request came from a website the key does not allow. |
| 403 | VERIFICATION_REQUIRED | The location needs a verified customer. details.method says whether the code goes by text or email. |
| 403 | VERIFICATION_TOO_MANY_ATTEMPTS | Too many wrong codes for this verification. Start a new one. |
| 403 | FORBIDDEN | The request is not allowed. |
| 404 | LOCATION_NOT_BOOKABLE | The location does not exist or is not taking online bookings. |
| 404 | BOOKING_NOT_FOUND | No booking with that id for the credential you sent. |
| 404 | NOT_FOUND | The path or the record does not exist. |
| 409 | SLOT_TAKEN | Someone booked that time first. Fetch availability again. |
| 409 | PAY_IN_PERSON_NOT_ALLOWED | The shop, or one of the selected services, needs a card for this booking. Send the customer to details.bookingUrl. |
| 409 | CONFLICT | The request conflicts with the current state of the booking or shop. |
| 409 | IDEMPOTENCY_KEY_REUSED | This Idempotency-Key already created a different booking. Use a new key for each booking attempt. |
| 409 | BOOKING_PAID | The booking is paid; the customer must contact the shop. |
| 409 | BOOKING_ALREADY_CANCELLED | The booking is already cancelled. |
| 409 | BOOKING_NOT_CANCELLABLE | The booking has already started or finished. |
| 409 | FEE_QUOTE_STALE | The late cancellation fee is no longer the quotedFeeCents you sent, so nothing was cancelled or charged. details.feeCents is the fee cancelling now would charge; show it to the customer and send it as quotedFeeCents to go ahead. |
| 409 | BOOKING_NOT_RESCHEDULABLE | The booking is waiting for approval, has already started, or has finished. |
| 409 | BOOKING_RESCHEDULE_LIMIT | The customer has already rescheduled this booking; they must contact the shop. |
| 422 | BARBER_NOT_AT_STORE | The barber does not work at the location or cannot do the services. |
| 422 | SERVICE_NOT_AVAILABLE | A service id is not an active service offered at this location. |
| 422 | OUTSIDE_WORKING_HOURS | The barber is not working at that time. |
| 422 | INVALID_SLOT_INTERVAL | The time is not on the shop's slot grid. Use a slot from availability. |
| 422 | OUTSIDE_BOOKING_HORIZON | The time is further ahead than the shop takes bookings. |
| 422 | DATE_IN_PAST | The time has already passed. |
| 413 | PAYLOAD_TOO_LARGE | The body is larger than 64 KB. |
| 429 | RATE_LIMITED | Too many requests. Wait for the Retry-After seconds, then retry. |
| 500 | INTERNAL | Something failed on our side. Retry later. |
| 500 | VERIFICATION_SEND_FAILED | The code could not be sent. Retry in a moment. |
| 503 | SERVICE_UNAVAILABLE | A safety check is briefly unavailable, so the request was refused. Retry in a moment. |
How much you can send
- Responses carry
RateLimit-Limit,RateLimit-RemainingandRateLimit-Resetfor the first limit the request is checked against, which on most endpoints is the per-visitor one. - Past a limit you get
429 RATE_LIMITEDwith aRetry-Afterheader in seconds. - Most limits count per key, so one busy shop never slows down another.
- “Per visitor” means per IP address.
| Requests | Limit |
|---|---|
| Reads (business, locations, services, team, customer) | 120 a minute per visitor, and 600 a minute per key |
| Availability | 60 a minute per visitor, and 240 a minute per key |
| Creating bookings | 10 a minute per visitor, and 120 a minute per key |
| Sending codes | 20 per visitor, and 5 per email address or phone number, every 10 minutes, shared with your BarberFlow booking page |
| Confirming a code | 30 a minute per visitor, and 10 a minute per verification |
| Reading, cancelling or rescheduling a booking | 120 a minute per visitor (shared with your BarberFlow manage page), and 600 a minute per key |
| The docs (openapi.json, llms-full.txt) | 120 a minute per visitor |
| Requests with a missing or invalid key | 30 a minute per visitor; past that they get 429 instead of 401 |