API reference

The custom GraphQL queries and mutations, who may call them, and what they return.

Everything is on POST /api/graphql. Custom operations are in features/keystone/mutations/index.ts. Except publicBusiness and homeBusiness, they return CommandResult { success, error, data }. When success is false, error is a sentence to show as it is.

Public

OperationPurpose
publicBusiness(slug)The barber's page: name, bio, photo, phone, location, timezone, booking rules, active services and weekly hours. Deposits read 0 when Stripe is not set up.
homeBusinessThe same for the first barber with booking open.
publicSlots(slug, serviceId, date)Open start times for one day (YYYY-MM-DD). Releases unpaid holds first.
bookOnline(slug, serviceId, startsAt, guest)Book. guest is { name, phone, email, notes }. Returns appointmentId, token and depositCents.
publicBooking(id, token)The client's booking, including holdEndsAt and canPayDeposit.
payDepositOnline(id, token)Opens Stripe Checkout and returns its url.
confirmDepositOnline(id, token)Reads the deposit back from Stripe. Returns { paid }.
cancelMyBooking(id, token)Client cancel inside the window, with a refund of any paid deposit.

Signed in

OperationNeedsPurpose
setUpMyBusiness(businessName, slug, timezone, phone, location, workStyle, starterMenu)signed inFirst-run setup
checkOutAppointment(appointmentId, method, tipCents, priceCents, products)canManagePaymentsTake payment and complete the visit
markAppointmentNoShow(appointmentId)canManageAppointmentsMark a no-show
cancelAppointmentAsBarber(appointmentId, reason)canManageAppointmentsCancel and refund an online deposit
myEarnings(from, to)canViewEarningsEarnings for a date range

The generic Keystone queries and mutations for each list are also available, with the access rules in Roles and permissions.

Other routes

RoutePurpose
/api/completionThe dashboard assistant (needs OPENROUTER_API_KEY)
/api/mcp-transport/[transport]MCP access with OAuth tokens issued under /oauth/*

On this page