API reference
122 endpoints. Responses are JSON; errors carry an error string and the
status code that matches what went wrong.
Authentication
Sign in at POST /api/auth/login and send the returned ws-access-token
and ws-refresh-token cookies with subsequent requests. The access token is an
RS256 token from our identity provider, verified on every request; a modified one is
rejected outright rather than downgraded to an anonymous session.
curl -s -X POST https://warehousescanner.co/api/auth/login \
-H 'content-type: application/json' \
-d '{"email":"you@company.com","password":"…"}' \
-c cookies.txt
curl -s https://warehousescanner.co/api/dashboard/stats -b cookies.txt Endpoints marked Operator additionally require an operator or owner role.
API tokens
For a machine, create a token on API and webhooks
after signing in, and send it as Authorization: Bearer wsk_…. It is shown once; only a hash of it is
kept. A token belongs to your organisation when you are a member of one (its owner or an admin creates and revokes
it), otherwise to your account, and it reads no more than its owner can see here: an organisation's token stops
working when the member who created it leaves. Tokens only read. Booking, messaging and managing tokens or
webhooks always need a signed-in person.
listings:read— Search published marketplace listings (GET /api/listings/search).rates:read— Read the rates board (GET /api/rates): operator-published listing rates, and quoted rates as QUOTED_RATES_SCOPE allows the token’s owner. Also GET /api/v1/rates and GET /api/v1/capacity, which answer that the rates and capacity decision is still open and carry no tariff.storage:read— Read the storage endpoints of the frozen v1 contract (GET /api/v1/storage/*).
A token that is unknown, revoked, expired or whose owner no longer stands behind it is a 401 — it is never
quietly treated as an anonymous call. A token without the scope a route needs is a 403. Each call counts
against the plan allowance of the account behind the token, and against the token's own monthly cap when you set one;
either running out is a 402 with code: "quota_exceeded".
curl -s https://warehousescanner.co/api/v1/storage/rates?country=NL&basis=pallet \
-H 'authorization: Bearer wsk_…' Directory
Open data derived from mapped building outlines. No authentication.
| Method | Path | Auth | Summary |
|---|---|---|---|
| GET | /api/warehouses | Public | Paged list of facilities. |
| GET | /api/warehouses/search | Public | Filter by region, country, type and floor area. Names any filter it could not apply rather than ignoring it. |
| GET | /api/warehouses/{slug} | Public | One facility, including the OpenStreetMap way id it was derived from. |
| GET | /api/regions | Public | Regions with facility counts and combined floor area. |
| GET | /api/facility-types | Public | The facility type codes used by the filters. |
| GET | /api/cities | Public | Cities the directory can be browsed by. Facilities with no mapped city are excluded rather than invented. |
| GET | /api/operators | Public | Operator names recorded on mapped facilities. Listing does not imply a commercial relationship. |
| GET | /api/health | Public | Liveness, dataset size and build stamp. |
Tools
The calculators behind /tools as JSON, over the same functions. Every number in the query is required (a missing one is a 400 naming the field); enumerations default and are echoed back. No tool answers with a market rate: a price is either the operator-declared figure on a published listing or the caller's own, labelled as such.
| Method | Path | Auth | Summary |
|---|---|---|---|
| GET | /api/tools/pallet | Public | Pallet positions for a floor (mode=area-to-pallets: floorAreaM2, clearHeightM, palletHeightM) or the floor for a pallet count (mode=pallets-to-area: pallets, clearHeightM, palletHeightM). Optional pallet and layout; the layout factor used is returned. |
| GET | /api/tools/racking | Public | Every racking layout against the same building (floorAreaM2, clearHeightM, palletHeightM, optional pallet), with the layout that holds the most positions. |
| GET | /api/tools/cold-chain | Public | Temperature bands; with band=<key>, what that band demands of a facility, and how many mapped facilities OpenStreetMap tags as cold storage (a floor, not a register). |
| GET | /api/tools/bonded | Public | A rule-based view of whether bonded storage helps (destination, dutyPaid, reExport, holdMonths), with what bonding does not do. Not customs advice. |
| GET | /api/tools/storage-cost | Session | Storage and handling cost over a term (quantity, months, optional turnsPerTerm) for either listing=<slug> — the listing's operator-declared rate, rateSource listing — or your own rate and currency, rateSource caller. A rate together with listing is refused. Counts one search against the plan's monthly allowance. |
| GET | /api/tools/earnings | Session | An operator's earnings estimate (units, rate, occupancy, months, currency) under the default platform fee rule in force. Your own figures; not a forecast. Counts one search against the plan's monthly allowance. |
Rates and quotes
Every price here came from an operator: a rate published on their own listing, or an answer to a specific requirement. Nothing is derived, and the two sources are never averaged.
| Method | Path | Auth | Summary |
|---|---|---|---|
| GET | /api/rates | Public | Also takes an API token with rates:read; in own mode the token sees its owner's quotes (its organisation's, or its account's personal ones), never more. Two sources, kept apart. rates: quotes still within their validity window, labelled quoted (keys unchanged since the first release). listingRates: operator-published monthly rates from visible, non-demo listings, with listingTotal and listingNote (additive). Both empty until operators have acted; never merged into one figure. quotedScope says which quoted rates this deployment shows: public (all live quotes), own (only the signed-in caller's own; anonymous gets an empty list and signInRequired) or aggregated (rates empty; rateAggregates holds per-facility ranges backed by several requesters). decision is open: the rates and capacity karar is unset, and this field adds no price. |
| POST | /api/quotes/rfq | Session | Send a requirement to a facility. Counts against the plan's monthly rate-request allowance. |
| GET | /api/quotes | Session | Your own requests and their answers. |
| GET | /api/quotes/{reference} | Session | One rate request, with the operator's answer when it has been given. |
| POST | /api/quotes/{reference}/answer | Operator | Operator-side: price a request. |
| POST | /api/quotes/{reference}/decline | Operator | Operator-side: decline with a reason. |
Marketplace listings
Space operators have listed themselves. Public reads show only published, approved listings and never an operator's contact details; everything else is scoped to the signed-in operator.
| Method | Path | Auth | Summary |
|---|---|---|---|
| GET | /api/listings | Public | Published, approved listings entered by operators. Demo listings are labelled and excluded from counts. |
| GET | /api/listings/search | Public | Filter listings by place, unit basis, units, start month and term. Names any filter it could not apply rather than ignoring it. Also takes an API token with listings:read (the same public rows; the token buys a budget, not more data). |
| GET | /api/listings/{slug} | Public | One public listing with its services, operator-declared certifications and 12-month availability. No contact data. |
| GET | /api/listings/{slug}/quote | Public | A price breakdown for units, startDate, termMonths and serviceIds, computed on the server from the listing's own rates and the platform fee rule. Nothing in the query can set a price. |
| GET | /api/markets | Public | Counts of published, approved, non-demo listings by city, country and facility type, each with the market page it links to. Zero is reported as zero; no listing rows and no operator data. |
| GET | /api/operator/profile | Session | Your operator profile, when you have created one. |
| POST | /api/operator/profile | Session | Create or update your operator profile. Creating one requires accepting the operator terms. |
| GET | /api/operator/listings | Session | Listings owned by your operator profile, in every status. |
| POST | /api/operator/listings | Session | Create a draft listing. The rate is your own; nothing else in the body sets a price, status or moderation. |
| GET | /api/operator/listings/{id} | Session | One of your listings. Answers 404 for a listing you do not own. |
| POST | /api/operator/listings/{id} | Session | Update a listing you own. Status and moderation fields in the body are ignored. |
| POST | /api/operator/listings/{id}/status | Session | Publish or pause. Until your operator profile is verified, a publish waits for an administrator's review before it is public. |
| POST | /api/operator/listings/{id}/services | Session | Add, change or deactivate an add-on service and its price. |
| GET | /api/operator/listings/{id}/availability | Session | The next 12 months of capacity for a listing you own: total, blocked and reserved units. |
| POST | /api/operator/listings/{id}/availability | Session | Set total and blocked units per month. Refused when it would drop below what is already reserved. |
| POST | /api/operator/listings/{id}/availability/bulk | Session | Set one total (and optionally one blocked figure) for a range of months, this month through +12. Every month is checked against what bookings hold before any is written; dryRun answers the plan. |
| POST | /api/operator/listings/{id}/availability/import | Session | Set capacity from a CSV (month, total_units, blocked_units; other columns ignored) sent as a file, a csv field or a text/csv body. One bad row refuses the whole file; dryRun answers the plan. |
| GET | /api/operator/listings/{id}/availability/export | Session | The capacity ledger as CSV (from, months up to 36), or with kind=holds the booking holds on the listing. |
| GET | /api/operator/listings/{id}/booking-rules | Session | Instant-book limits (minimum term, maximum units, notice) and the deposit you declare. The deposit is never charged by the platform. |
| POST | /api/operator/listings/{id}/booking-rules | Session | Replace the booking rules. Outside the instant-book limits a booking goes to you as a request. |
| GET | /api/operator/notifications | Session | Your notification preferences, the operator emails you may turn off, and the ones always sent, with the reason. |
| POST | /api/operator/notifications | Session | Turn optional operator emails off or on. Booking, payment, account and moderation emails cannot be turned off; asking to is a 400 that says so. |
| GET | /api/operator/terms | Session | The operator terms version in force, the version you accepted and every acceptance on record. |
| POST | /api/operator/terms | Session | Accept the operator terms in force (acceptTerms=yes and the version you read; another version is a 409). Publishing is refused until the version in force is accepted. |
| GET | /api/operator/listings/{id}/occupancy | Session | Occupancy per month for a listing you own: total, blocked, held, committed and free units. Answers 404 for a listing you do not own. |
| POST | /api/admin/listings/{id}/moderate | Operator | Approve, reject, unpublish or restore a listing, with a note the operator can read. Restore applies only to an unpublished listing and brings it back paused and approved. |
Bookings (marketplace)
A marketplace booking (reference BK-…) runs from request to completion. Its price is the server-computed quote snapshotted at the time; the body of no request sets a price, fee or total. Every route answers only the booking's shipper, its listing's operator, or an admin — anyone else gets 404.
| Method | Path | Auth | Summary |
|---|---|---|---|
| GET | /api/reservations | Session | Your bookings: as a shipper, the ones you requested; as an operator, the ones on your listings. Optional status filter. |
| POST | /api/reservations/create | Session | Book a listing: mode "instant" on an instant-book listing confirms a hold at once; "request" asks the operator. Units, start date, term and services only — the price is computed here. |
| GET | /api/reservations/{reference} | Session | One booking with its price breakdown, counter-offer, payment state and history. 404 unless you are a party to it. |
| POST | /api/reservations/{reference}/accept | Session | Operator: accept a request. The hold is extended to the payment window. |
| POST | /api/reservations/{reference}/decline | Session | Operator: decline a request with a reason. The hold is released. |
| POST | /api/reservations/{reference}/counter | Session | Operator: propose different units, dates, term or your own rate for this booking. The counter is re-priced on the server. |
| POST | /api/reservations/{reference}/respond-counter | Session | Shipper: accept or decline the operator's counter-offer. |
| POST | /api/reservations/{reference}/pay | Session | Shipper: start payment for an accepted booking. With no payment provider configured the booking stays held and says so. |
| POST | /api/reservations/{reference}/cancel | Session | Cancel with a reason. Shippers before confirmation; operators from acceptance; a confirmed booking is cancelled by an admin only. |
| POST | /api/admin/reservations/{reference}/mark-paid | Operator | Record a payment received outside the platform. Confirms the booking and commits its hold. |
| POST | /api/admin/reservations/{reference}/refund | Operator | Retry the refund of a cancelled, provider-paid booking whose refund is due, for the booking's own total. 409 when no configured provider can refund it; the refund then stays due and is settled outside the platform. |
| GET | /api/operator/payouts/statement.pdf | Session | Operator: the payout statement as a PDF — gross, platform fee and net per line and per currency. A statement of amounts owed, not a remittance advice. |
| GET | /api/operator/payouts | Session | Operator: payout statement — paid and offline-recorded bookings on your listings, shipper total minus platform fee, grouped per currency and never summed across. Derived only; nothing is transferred by this deployment. |
| GET | /api/operator/payouts/export | Session | Operator: the same statement lines as CSV (one row per booking, its own currency, no totals row). Cells that a spreadsheet would run as a formula are prefixed with an apostrophe. |
Messages
Plain-text threads between a shipper and an operator: one per booking, created automatically, and one pre-booking inquiry per listing and shipper. Admins can read for support but not post as a party.
| Method | Path | Auth | Summary |
|---|---|---|---|
| GET | /api/threads | Session | Your threads with unread counts, newest message first. |
| POST | /api/threads | Session | Open (or reuse) the inquiry thread on a listing with a first message: listingSlug and body. |
| GET | /api/threads/{id} | Session | One thread and its messages; marks it read for you. 404 unless you are a party to it. Until the booking is confirmed, email addresses, phone numbers and links in the other party's messages come back masked; contactsRevealed and contactsMasked say whether and how many. |
| POST | /api/threads/{id}/messages | Session | Post a message of 1 to 4000 characters to a thread you are a party to. |
| GET | /api/me/notifications | Session | The signed-in bell: your bookings and conversations, newest first. Message text is not included, so contact details are not shown here before a booking is confirmed. |
Reviews
A shipper reviews a booking once it is completed; the operator may respond once; an administrator can hide a review with a reason. Public reads show visible reviews only and name the author by company or as "Verified shipper", never by email. A listing has a rating only when it has at least one visible review.
| Method | Path | Auth | Summary |
|---|---|---|---|
| GET | /api/listings/{slug}/reviews | Public | Visible reviews of a published listing, newest first, with the aggregate rating and count. Hidden reviews are excluded; authors are shown by company name or "Verified shipper". |
| POST | /api/reviews | Session | Review a completed booking you were the shipper of: reservationRef, rating 1–5, optional title, body of 10–4000 characters. One review per booking; 400 before completion, 409 for a second. |
| POST | /api/reviews/{id}/respond | Session | Operator: respond once to a review of your listing. 404 for a review on a listing you do not own. |
| POST | /api/admin/reviews/{id}/hide | Operator | Hide a review with a reason. It leaves the public page and the aggregate; the author and the operator see "Removed by moderator". |
Operator verification
Registration and VAT references are reviewed by an administrator, who may also record a register look-up made by hand. The platform calls no register and performs no sanctions screening; the verified badge means an administrator checked the references the operator supplied.
| Method | Path | Auth | Summary |
|---|---|---|---|
| GET | /api/operator/kyc | Session | Your verification status, what is still missing, and the note from the last review. Document references are visible to you and to administrators only. |
| POST | /api/operator/kyc | Session | Submit your profile for verification. Refused with the list of missing fields when registration, VAT, insurance or document references are incomplete. |
| GET | /api/admin/operators | Operator | Operator profiles for review, pending first, with their verification status and document references. |
| POST | /api/admin/operators/{id}/verify | Operator | Verify a pending operator (decision=verify, optional note, optional register check made by hand: registryKind company_register or vat, registryNumber matching the operator's own entry, registrySource an https link — all three or none) or reject one (decision=reject, reason of at least 10 characters). Once verified, the operator's future publishes are approved without review. No register, VAT service or sanctions list is called. |
Admin console
Moderation, platform-fee rules and the audit trail. Every route answers administrators only. Fee changes never re-price an existing booking: its quote is a snapshot.
| Method | Path | Auth | Summary |
|---|---|---|---|
| GET | /api/admin/listings | Operator | Every marketplace listing for the moderation queue, moderation note included. Filters: status, moderation, queue=1 (published and not yet approved). |
| GET | /api/admin/fee-rules | Operator | Every stored platform-fee rule, active or not, plus the rule PLATFORM_FEE_PERCENT would supply when nothing is stored. |
| POST | /api/admin/fee-rules | Operator | Create a fee rule (scope default or one country, fee as a percentage, optional floor and ceiling in a currency), or replace one by id. One active rule per scope; a second is 409. Existing bookings keep their price. |
| POST | /api/admin/fee-rules/{id} | Operator | Deactivate a fee rule from a browser form: body action=deactivate, answers 303 back to the pricing page. Rules are never deleted; the audit trail names them. |
| DELETE | /api/admin/fee-rules/{id} | Operator | Deactivate a fee rule from a JSON client. Same effect as POST with action=deactivate; HTML forms cannot send DELETE, which is why both exist. |
| GET | /api/cron/deliver-webhooks | Operator | The webhook outbox the scheduler runs: claims due deliveries with a lease, signs and sends each, retries on a backoff and dead-letters after the last attempt; prunes old rows. Authorization: Bearer CRON_SECRET (or ?secret=); with no secret configured, an admin session. Safe under two concurrent runs. |
| GET | /api/cron/sweep-reservations | Operator | The booking sweep the scheduler runs: expires bookings whose hold ran out, starts and completes bookings by date. Authorization: Bearer CRON_SECRET (or ?secret=); with no secret configured, an admin session. Idempotent; reads run the same sweep as a fallback. |
| GET | /api/admin/audit | Operator | The audit trail, newest first: one entry per domain event with actor, action, subject and a redacted payload. Filter by subjectKind, subjectId, actorEmail, action (exact or a domain prefix), before and limit. |
Bookings and stock
A booking takes its price from the quote it was created from.
| Method | Path | Auth | Summary |
|---|---|---|---|
| GET | /api/bookings | Session | Bookings belonging to your account, cancelled ones included. |
| POST | /api/bookings/create | Session | Create from an answered quote. The request body cannot set a price. |
| GET | /api/bookings/{reference} | Session | One booking, with its quoted price, term and current status. |
| POST | /api/bookings/{reference}/update | Session | Amend term or quantity. |
| POST | /api/bookings/{reference}/cancel | Session | Cancel with a reason. |
| GET | /api/movements | Session | Recorded receipts and despatches: RFQ bookings as movements, marketplace bookings as marketplace.shipper (bookings you or your organisation made) and marketplace.operator (bookings on your listings). |
| POST | /api/movements | Session | Record one. An RFQ booking (WS-…) is recorded by its shipper side; a marketplace booking (BK-…) only by the listing's operator, only while it is confirmed or active. A despatch exceeding stock on hand, or a receipt beyond the reserved units, is refused. |
| GET | /api/inventory | Session | On-hand quantities per booking. |
| GET | /api/capacity | Session | Committed units by month for the signed-in caller. decision is open. Does not report free space — no operator supplies it, and this route does not invent it. |
Account
Session-cookie authenticated.
| Method | Path | Auth | Summary |
|---|---|---|---|
| POST | /api/auth/login | Public | Exchange credentials for a signed session cookie. |
| POST | /api/auth/signup | Public | Create an account. |
| POST | /api/auth/logout | Public | Clear the session cookies. Needs no session, so it never fails. |
| GET | /api/auth/me | Session | The current account. |
| POST | /api/account/password | Session | Retired: answers 410. Passwords are changed with an emailed code through /forgot-password. |
| GET | /api/dashboard/stats | Session | The figures behind the dashboard, scoped to your account. |
| GET | /api/billing/usage | Session | Plan counters for the current month. |
Workspace
Saved facilities (your organisation’s shortlist when you are a member) and support conversations (always your own account’s).
| Method | Path | Auth | Summary |
|---|---|---|---|
| GET | /api/shortlist | Session | Saved facilities, joined to the live directory record rather than a copy taken at save time. |
| POST | /api/shortlist | Session | Save a facility, or update the note on one already saved. Saving twice is one entry, not an error. |
| DELETE | /api/shortlist | Session | Remove a saved facility. Answers 404 when it was never saved. |
| GET | /api/support | Session | Your support tickets and the replies on them. |
| POST | /api/support | Session | Open a ticket, or reply to one by sending its reference. |
Storage API (v1)
The frozen v1 envelope (docs/API_CONTRACT.md): { status, data, meta } or { status: "error", code, message, details }, X-Api-Version and X-RateLimit-* on every answer. Needs an API token with storage:read, or a session. Storage as a landed-cost component: operator-published rates and server-computed quotes only — no derived market rate, no average.
| Method | Path | Auth | Summary |
|---|---|---|---|
| GET | /api/v1/storage/rates | Token | Operator-published monthly rates per unit from visible, non-demo listings (basis, country, city, currency, limit 1–100), cheapest first. Money in integer minor units; rateKind operator_published; meta.mode live. |
| GET | /api/v1/storage/quote | Token | The server-computed price for listing, units, startDate, termMonths and optional serviceIds: the shipper-paid lines, total and per month. rateKind computed_quote; meta.mode mock for a labelled demo listing. Nothing in the query sets a price. |
| GET | /api/v1/rates | Token | The rates decision in the v1 envelope. While the karar line is empty, data.decision is open and data.tariff is null. No quote and no listing price. A token without rates:read is 403. Quota is 402 and still carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. |
| GET | /api/v1/capacity | Token | The capacity decision in the v1 envelope. While the karar line is empty, data.decision is open and data.tariff is null. No booked totals and no free-space figure. A token without rates:read is 403. Quota is 402 with the rate-limit headers. |
API tokens and webhooks
Managed with a signed-in session only: a request presenting a bearer token is refused, so a leaked token cannot mint another or register a webhook. Tokens and shipper-side webhooks belong to your organisation (managed by its owner or an admin) or, when you belong to none, to your account; operator-side webhooks to your operator profile.
| Method | Path | Auth | Summary |
|---|---|---|---|
| GET | /api/account/api-tokens | Session | Your owner's tokens — name, prefix, scopes, expiry, last use, revoked or live. Never a hash or a secret. |
| POST | /api/account/api-tokens | Session | Mint a token (JSON: name, scopes from listings:read, rates:read, storage:read; optional expiresAt and monthlyQuota). The plaintext is in this answer once; only its SHA-256 is stored. Ten live per owner, twenty created per hour. |
| POST | /api/account/api-tokens/{id}/revoke | Session | Revoke a token now. Kept on record, never deleted; revocation is final. 404 for a token that is not your owner's. |
| GET | /api/account/webhooks | Session | Your webhook endpoints (shipper and operator side) and their recent deliveries — delivered, retrying or dead, with the last status and error. Never the signing secret. |
| POST | /api/account/webhooks | Session | Register an https endpoint on a public host for reservation events (JSON: side shipper|operator, url, optional events and description). The signing secret is in this answer once. |
| POST | /api/account/webhooks/{id}/delete | Session | Stop sending to an endpoint. Its undelivered events end as dead; the endpoint is kept on record as deleted. |
| POST | /api/account/webhooks/{id}/rotate | Session | Issue a new signing secret (JSON; the answer carries it once). For 24 hours every delivery carries both signatures in webhook-signature, the new one first, so your receiver keeps verifying while it switches; then the old secret is retired. 409 while a rotation window is open. |
| POST | /api/account/webhooks/{id}/retire-secret | Session | End a rotation window now: from the next delivery only the new secret signs. 409 when no window is open. |
| POST | /api/account/webhooks/deliveries/{id}/redeliver | Session | Queue a dead delivery again with its attempts reset. It is sent with the same webhook-id, so a receiver that already has it dedupes. |
Team
Your organisation. Members are added only by invitation, accepted while signed in with the invited address verified. Bookings, quotes, the shortlist and conversations made for the organisation are read by its members; a viewer changes nothing.
| Method | Path | Auth | Summary |
|---|---|---|---|
| GET | /api/team | Session | Your organisation, its members and role, its invitations (owner only), and invitations addressed to you. |
| POST | /api/team | Session | Found an organisation; you become its owner. Needs a verified address and no current membership. |
| POST | /api/team/rename | Session | Rename the organisation. Owner or admin. |
| POST | /api/team/invitations | Session | Owner: invite an address as viewer, booker or admin. Open for 14 days. |
| POST | /api/team/invitations/{id} | Session | action=accept or decline (the invited address, verified), or revoke (the owner). Anyone else: 404. |
| POST | /api/team/members/{id} | Session | Owner: action=role with a role, or action=remove. The owner’s own membership is never changed here. |
| POST | /api/team/leave | Session | Leave the organisation. The owner cannot (no ownership transfer yet). |
Webhooks
Register an https endpoint on a public host on API and webhooks
and it is sent a POST when a booking changes state — on the shipper side for the bookings your
organisation (or account) made, on the operator side for bookings on your listings. Each side's body carries only
what that side sees on its booking page. Events: reservation.requested, reservation.instant_booked, reservation.accepted, reservation.declined, reservation.countered, reservation.counter_accepted, reservation.counter_declined, reservation.payment_started, reservation.paid, reservation.confirmed, reservation.cancelled, reservation.expired, reservation.started, reservation.completed, reservation.refunded, reservation.payment_after_expiry.
Every delivery is signed with the endpoint's secret (shown once, when you add it), in the open
Standard Webhooks scheme: headers webhook-id, webhook-timestamp (unix
seconds) and webhook-signature (v1, + base64 HMAC-SHA256 of
id.timestamp.body, keyed with the secret after whsec_, base64-decoded). Refuse a timestamp
more than 5 minutes from your clock: that is the replay window.
Delivery is at least once. The same event can arrive twice — after a timeout, or when a send was
made but its result was not recorded — always with the same webhook-id. Make your handler idempotent:
store the ids you have processed and acknowledge a repeat without acting on it again. Answer any 2xx
within 10 seconds; anything else, a redirect included, is a failure. Failures are retried after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h, 24 h; after
8 attempts the delivery is marked dead and shown on your page with the last error, where you can send
it again, and the endpoint's owner is emailed once about it (the event, the booking reference and the last status —
never the body or the secret). Deliveries are sent by a scheduled job every few minutes, not at the moment the
booking changes.
Rotating a secret. Rotate on your page: the new secret is shown once, and for
24 hours every delivery carries two signatures in webhook-signature, separated by a
space — the new secret's first, the old one's second. Accept a delivery when either matches (the example below
does), switch to the new secret, then the old one is retired: automatically when the window closes, or at once
with "Retire the old secret". After that only the new secret signs.
// Node — verify before you act. `raw` is the request body exactly as received.
import { createHmac, timingSafeEqual } from 'node:crypto'
function verify(secret, id, ts, sigHeader, raw) {
if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false
const key = Buffer.from(secret.slice('whsec_'.length), 'base64')
const want = Buffer.from('v1,' + createHmac('sha256', key).update(`${id}.${ts}.${raw}`).digest('base64'))
return sigHeader.split(' ').some((s) => s.length === want.length && timingSafeEqual(Buffer.from(s), want))
} Rate limits
Listing search, the rates board and the v1 reads answer every request — refusals included — with
X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (unix seconds).
The budget is per minute: 120 for a token, 120 for a signed-in account, 60
per address otherwise. Past it the answer is 429 with Retry-After. With a database
configured the count is shared by every server instance; without one it is kept per instance.
Separately, searches and rate requests count against the monthly allowance on your plan. When a payment
provider is configured, an exhausted allowance is refused (402 for an API token, still with the
rate-limit headers above, 429 with the counter in the body for the signed-in tools). A token
without the route's read scope is 403. Until a provider is configured the counters are
recorded and not enforced, and /api/billing/usage says which mode the deployment is in.
GET /api/v1/rates and GET /api/v1/capacity answer that the rates and capacity
decision is still open. They do not return a price. The public rates board stays on GET /api/rates.