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 URLhttps://api.barberflow.com/v1
Prompt for your AI tool
Build 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.
Overview

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.
Build with AI

Three steps, no developer needed

If you are building your site with an AI coding tool, this is all it takes.

  1. 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.
  2. 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.
  3. 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.
Quick start

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.

  1. 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, weekly hours and bookingVerification (NONE, PHONE or EMAIL).
    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;
  2. List the services at a location

    • Each service has an id to pass in serviceIds, a name, priceCents with currency "CAD", durationMinutes and the barberIds who 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);
  3. Find open times

    • You get days, each with slots.
    • A slot has startsAt (ISO 8601 with the location's offset), time (HH:mm in shop time, ready to display) and the barberIds free then.
    • Leave out barberId to 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];
  4. Create the booking

    • Mint one Idempotency-Key per 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.
    • status is SCHEDULED, or PENDING_APPROVAL when the location approves bookings by hand. A retry reports where the booking stands now, such as CANCELLED.
    • Keep manageToken to let the customer view, cancel or reschedule later, or link them to manageUrl.
    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();
Authentication

One key for your site, one code for your customers

The three credentials
CredentialHeaderWhat it provesLasts
Publishable keyAuthorization: Bearer bf_pk_…Which shop the request is forUntil you roll or revoke it
Customer tokenX-Customer-Token: bf_ct_…A customer who signed in with a one-time code30 days
Manage tokenX-Booking-Token: <manageToken>Access to one booking, without signing inUntil 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 with ORIGIN_NOT_ALLOWED.
  • thebarbershop.ca and www.thebarbershop.ca count separately.
  • *.thebarbershop.ca covers 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:3000 while 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 /verifications with the location, the method and the customer's contact (email is always required), then POST /verifications/{id}/confirm with 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.
POST /verifications
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-Token to read, cancel or reschedule that one booking without signing in.
  • It works until 30 days after the appointment.
Conventions

The rules every endpoint follows

Base URL
Every path is relative to https://api.barberflow.com/v1.
JSON
Send Content-Type: application/json with 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 are YYYY-MM-DD in the location's time zone.
Money
Whole cents with currency: "CAD". Taxes are included in a booking's totalCents.
Ids
Opaque strings. A service id is the id of 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/bookings returns { bookings, nextCursor }, and availability returns an object with days.
Idempotency
POST /bookings needs an Idempotency-Key header: 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 /bookings answers PAY_IN_PERSON_NOT_ALLOWED with details.bookingUrl, a link to finish the booking on BarberFlow.
Endpoints

Everything in version 1

Open an endpoint for its parameters, response fields, errors and a request you can copy.

Errors

Every error looks the same

  • Any response that is not a 2xx carries an error object.
  • code is stable and safe to branch on, message is a sentence you can show the customer, and details appears on some codes only.
  • Branch on the endpoint's own codes first. VALIDATION_ERROR, NOT_FOUND, FORBIDDEN and CONFLICT can come back from any endpoint as fallbacks.
Error response
{
  "error": {
    "code": "SLOT_TAKEN",
    "message": "That time was just taken. Please choose another time."
  }
}

46 error codes

Error codes
StatusCodeWhat it means
400VALIDATION_ERRORThe request is not valid. details.issues names the field when a field is the problem.
400INVALID_JSONThe body is not valid JSON.
400INVALID_BODYThe body could not be read (for example an unsupported encoding).
400INVALID_RANGEto is before from.
400RANGE_TOO_LARGEThe date range is longer than 14 days.
400IDEMPOTENCY_KEY_REQUIREDPOST /bookings needs an Idempotency-Key header.
400IDEMPOTENCY_KEY_INVALIDThe Idempotency-Key must be 1 to 128 letters, digits, hyphens or underscores.
400VERIFICATION_METHOD_MISMATCHThe location verifies bookings by the other method; use the one in its bookingVerification.
400VERIFICATION_INVALID_PHONEThe phone number is not a valid Canadian number.
400VERIFICATION_EMAIL_NOT_ALLOWEDA code cannot be sent for this email. The customer can sign in to BarberFlow to continue, or use a different email.
400VERIFICATION_PHONE_OPTED_OUTThe 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.
400VERIFICATION_CODE_INVALIDThe code is wrong.
400VERIFICATION_CODE_EXPIREDThe code has expired. Start a new verification.
401API_KEY_REQUIREDNo key was sent in the Authorization header.
401API_KEY_INVALIDThe key is unknown or has been revoked.
401CUSTOMER_TOKEN_REQUIREDThis endpoint needs an X-Customer-Token header.
401CUSTOMER_TOKEN_INVALIDThe customer token is invalid, expired, or was issued under another key. Verify the customer again.
401CREDENTIAL_REQUIREDSend the booking manage token as X-Booking-Token, or the customer token as X-Customer-Token.
403ORIGIN_NOT_ALLOWEDThe request came from a website the key does not allow.
403VERIFICATION_REQUIREDThe location needs a verified customer. details.method says whether the code goes by text or email.
403VERIFICATION_TOO_MANY_ATTEMPTSToo many wrong codes for this verification. Start a new one.
403FORBIDDENThe request is not allowed.
404LOCATION_NOT_BOOKABLEThe location does not exist or is not taking online bookings.
404BOOKING_NOT_FOUNDNo booking with that id for the credential you sent.
404NOT_FOUNDThe path or the record does not exist.
409SLOT_TAKENSomeone booked that time first. Fetch availability again.
409PAY_IN_PERSON_NOT_ALLOWEDThe shop, or one of the selected services, needs a card for this booking. Send the customer to details.bookingUrl.
409CONFLICTThe request conflicts with the current state of the booking or shop.
409IDEMPOTENCY_KEY_REUSEDThis Idempotency-Key already created a different booking. Use a new key for each booking attempt.
409BOOKING_PAIDThe booking is paid; the customer must contact the shop.
409BOOKING_ALREADY_CANCELLEDThe booking is already cancelled.
409BOOKING_NOT_CANCELLABLEThe booking has already started or finished.
409FEE_QUOTE_STALEThe 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.
409BOOKING_NOT_RESCHEDULABLEThe booking is waiting for approval, has already started, or has finished.
409BOOKING_RESCHEDULE_LIMITThe customer has already rescheduled this booking; they must contact the shop.
422BARBER_NOT_AT_STOREThe barber does not work at the location or cannot do the services.
422SERVICE_NOT_AVAILABLEA service id is not an active service offered at this location.
422OUTSIDE_WORKING_HOURSThe barber is not working at that time.
422INVALID_SLOT_INTERVALThe time is not on the shop's slot grid. Use a slot from availability.
422OUTSIDE_BOOKING_HORIZONThe time is further ahead than the shop takes bookings.
422DATE_IN_PASTThe time has already passed.
413PAYLOAD_TOO_LARGEThe body is larger than 64 KB.
429RATE_LIMITEDToo many requests. Wait for the Retry-After seconds, then retry.
500INTERNALSomething failed on our side. Retry later.
500VERIFICATION_SEND_FAILEDThe code could not be sent. Retry in a moment.
503SERVICE_UNAVAILABLEA safety check is briefly unavailable, so the request was refused. Retry in a moment.
Rate limits

How much you can send

  • Responses carry RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset for the first limit the request is checked against, which on most endpoints is the per-visitor one.
  • Past a limit you get 429 RATE_LIMITED with a Retry-After header in seconds.
  • Most limits count per key, so one busy shop never slows down another.
  • “Per visitor” means per IP address.
Rate limits
RequestsLimit
Reads (business, locations, services, team, customer)120 a minute per visitor, and 600 a minute per key
Availability60 a minute per visitor, and 240 a minute per key
Creating bookings10 a minute per visitor, and 120 a minute per key
Sending codes20 per visitor, and 5 per email address or phone number, every 10 minutes, shared with your BarberFlow booking page
Confirming a code30 a minute per visitor, and 10 a minute per verification
Reading, cancelling or rescheduling a booking120 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 key30 a minute per visitor; past that they get 429 instead of 401
Resources

Files and support