StayBindDevelopers
Booking API

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-key or Authorization: Bearer (see Authentication).
  • Protocol: tRPC over HTTP, plain JSON (no transformer).

Calling convention

KindHTTPInput
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" }
  }
}
codeHTTPWhen
UNAUTHORIZED401missing or invalid API key on a key-gated procedure
BAD_REQUEST400input failed validation, or a domain rule rejected it (e.g. a stay that isn't priced for online booking)
NOT_FOUND404the property, unit, or booking doesn't exist in this org
CONFLICT409the 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

ProcedureKindAuthPurpose
healthquerynoneliveness check
brandByDomainquerynoneresolve a storefront's brand (theme/identity) by host
propertiesquerykeylist active properties
searchAvailabilityquerykeyunits free for a date range
quotequerykeyserver-priced quote for a unit + dates
createBookingmutationkeyplace a booking (defaults to confirmed)
createCheckoutmutationkeyopen an enquiry + a payment link (pay-first funnel)
getBookingquerykeyfetch one booking
cancelBookingmutationkeycancel a booking and release the dates
getKycRequestsubmitKycmixedtokenthe guest KYC link flow

The pages that follow document each group. Start with Properties & availability.

On this page