Overview
The public, API-key-authenticated Booking API. Use StayBind as a headless backend for a booking front end, with the availability ledger guaranteeing no double-bookings.
The Booking API is the surface a storefront or front end calls to read inventory and place bookings, with StayBind as the unified backend. It is intentionally narrow: browse active inventory, check availability, price a stay, place or cancel a booking, run a self-serve checkout, and drive guest KYC. Every call is pinned to the API key's organization, and the ledger guarantees no double-booking across this storefront and any OTAs the org also syncs.
- Base path:
https://api.staybind.com/public/trpc - Auth: an org-scoped API key in
x-api-keyorAuthorization: Bearer(see Authentication). - Protocol: tRPC over HTTP, plain JSON (no transformer).
Calling convention
| Kind | HTTP | Input |
|---|---|---|
| query (read) | GET /public/trpc/<procedure> | ?input=<url-encoded JSON> (omit if no input) |
| mutation (write) | POST /public/trpc/<procedure> | the input JSON as the request body |
Every successful response is wrapped:
{ "result": { "data": <your value> } }Batching
These docs use the single-call form, which works from any HTTP client. tRPC
also supports batched calls (?batch=1 with an indexed input map and an array
response); a generated tRPC client may do this automatically. Both forms hit
the same procedures.
Errors
Errors come back with a non-2xx status and a tRPC error body. The fields that matter are error.data.code (a stable string) and error.data.httpStatus:
{
"error": {
"message": "Check-out must be after check-in.",
"data": { "code": "BAD_REQUEST", "httpStatus": 400, "path": "createCheckout" }
}
}code | HTTP | When |
|---|---|---|
UNAUTHORIZED | 401 | missing or invalid API key on a key-gated procedure |
BAD_REQUEST | 400 | input failed validation, or a domain rule rejected it (e.g. a stay that isn't priced for online booking) |
NOT_FOUND | 404 | the property, unit, or booking doesn't exist in this org |
CONFLICT | 409 | the requested nights are no longer available (the double-booking guard fired) |
Treat CONFLICT as a normal outcome, not a bug: it is the ledger refusing to double-book. Re-query availability and offer the guest another option.
Procedures at a glance
| Procedure | Kind | Auth | Purpose |
|---|---|---|---|
health | query | none | liveness check |
brandByDomain | query | none | resolve a storefront's brand (theme/identity) by host |
properties | query | key | list active properties |
searchAvailability | query | key | units free for a date range |
quote | query | key | server-priced quote for a unit + dates |
createBooking | mutation | key | place a booking (defaults to confirmed) |
createCheckout | mutation | key | open an enquiry + a payment link (pay-first funnel) |
getBooking | query | key | fetch one booking |
cancelBooking | mutation | key | cancel a booking and release the dates |
getKycRequest … submitKyc | mixed | token | the guest KYC link flow |
The pages that follow document each group. Start with Properties & availability.