Skip to main content

Documentation

Docs

Guides to connect to the booking API and add the booking widget to your site.

Sample (mock): URLs, keys and responses are not real and only show the shape of the documentation.

Base URL
https://api.example.com/v1
Version
v1

Getting started

Introduction

The booking API lets you read and create provider profiles, services, free slots and bookings from your own app. If you only need a booking button, use the widget instead.

https://api.example.com/v1

All responses are JSON and times are returned as ISO 8601 in the provider’s time zone.

Getting started

Quickstart

Create your first booking in three steps: fetch services, find a free slot, then book it.

# 1) list services
curl https://api.example.com/v1/providers/ilia-salon/services \
  -H "Authorization: Bearer hg_test_xxxxxxxx"

# 2) find free slots
curl "https://api.example.com/v1/providers/ilia-salon/availability?service=svc_color&date=2026-10-10" \
  -H "Authorization: Bearer hg_test_xxxxxxxx"

# 3) book one
curl -X POST https://api.example.com/v1/bookings \
  -H "Authorization: Bearer hg_test_xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"service":"svc_color","start":"2026-10-10T10:30:00+03:30"}'

Getting started

Authentication

Every request must send the API key in the Authorization header. hg_test keys only touch sample data; hg_live keys touch real data.

Authorization: Bearer hg_test_xxxxxxxx

Never put the key in browser-side code. For customer-facing booking use the widget or your own server.

Booking API

Providers

GET/providers/{slug}

Returns the public profile of a provider or business.

NameTypeRequiredDescription
slugstringYesThe unique identifier in the profile link.
200Response
{
  "slug": "ilia-salon",
  "name": "Ilia Salon",
  "kind": "business",
  "timezone": "Asia/Tehran",
  "services": 3
}

Booking API

Services

GET/providers/{slug}/services

Lists bookable services; each service has a fixed or variable duration.

200Response
{
  "data": [
    { "id": "svc_cut", "name": "Haircut", "duration": 45, "fixed": true },
    { "id": "svc_color", "name": "Colour & highlights", "duration": 90, "fixed": true },
    { "id": "svc_skin", "name": "Skin cleansing", "duration": null, "fixed": false }
  ]
}

Booking API

Availability

GET/providers/{slug}/availability

Computes the free slots of a day in real time from the provider’s calendar.

NameTypeRequiredDescription
servicestringYesThe service id.
dateYYYY-MM-DDYesThe day to check.
context"independent" | "business"NoBooking context; defaults to the profile’s context.
GET/providers/ilia-salon/availability?service=svc_color&date=2026-10-10

Booking API

Bookings

POST/bookings

Creates a booking. If the slot was taken, a 409 is returned.

NameTypeRequiredDescription
servicestringYesThe service id.
startISO 8601YesBooking start; must be one of the free slots.
customerobjectNoName and phone; read from the signed-in customer if omitted.
notestringNoA note for the provider.
201Response
{
  "id": "bk_8f2a",
  "status": "confirmed",
  "service": "svc_color",
  "start": "2026-10-10T10:30:00+03:30",
  "end": "2026-10-10T12:00:00+03:30"
}

DELETE/bookings/{id}

Cancels the booking and frees the slot again.

Booking API

Customers

GET/customers/{id}

Returns the customer profile and booking history for the provider.

200Response
{
  "id": "cus_31c9",
  "bookings": 6,
  "last_visit": "2026-09-21",
  "notes": ["prefers mornings"]
}

Booking API

Webhooks

Register a URL to be told when bookings change — events such as booking.created and booking.cancelled. Each request is signed with the X-Signature header.

{
  "event": "booking.created",
  "data": { "id": "bk_8f2a", "service": "svc_color", "start": "2026-10-10T10:30:00+03:30" }
}

Booking widget

Embedding the widget

The booking widget is added to your site with two lines — no server and no API key.

<script src="https://cdn.example.com/booking-widget.js" defer></script>
<div data-booking-widget="ilia-salon"></div>

Booking widget

Widget options

NameTypeRequiredDescription
data-booking-widgetstringYesThe provider slug.
data-theme"dark" | "light"NoDisplay theme.
data-lang"fa" | "en"NoWidget language and direction.
data-servicestringNoPre-selects a service.

Booking widget

Widget events

The widget dispatches browser events on its own element, so you can for instance show a thank-you message.

document
  .querySelector("[data-booking-widget]")
  .addEventListener("booking:confirmed", (e) => {
    console.log("confirmed", e.detail.id);
  });

Reference

Errors

Errors come back with an HTTP status and a JSON body containing code and message.

NameTypeRequiredDescription
400invalid_requestNoInvalid or missing parameter.
401unauthorizedNoMissing or invalid key.
404not_foundNoProvider, service or booking not found.
409slot_takenNoThe slot has just been booked.
429rate_limitedNoToo many requests.
409Response
{
  "error": { "code": "slot_taken", "message": "This slot is no longer free." }
}

Reference

Rate limits

Each key may make up to 60 requests per minute. The X-RateLimit-Remaining and Retry-After headers show where you stand.

Reference

Changelog

NameTypeRequiredDescription
v1.22026-10NoWidget: booking:confirmed event and the data-service option.
v1.12026-09NoWebhooks and the X-Signature header.
v1.02026-08NoFirst release: providers, services, availability and bookings.

Still stuck?

Talk to us