Hospitality Commerce API
Concepts

How does error handling work?

44 stable error codes with structured detail, imperative remediation, and typed recovery actions.

Design principles

  1. Codes are stable. Never renamed — agents branch on them.
  2. Remediation is imperative. "Call POST /v1/quotes again" — not "An error occurred."
  3. Detail is structured. IDs, states, amounts as typed fields.
  4. next_actions is a closed vocabulary. Adding a new rel is a contract change.
  5. Errors on idempotent paths are sealed. Replays return the cached failure.

Error categories

StatusCategoryCountAgent strategy
400Validation1Fix detail.field_errors, retry
401Auth / delegation4Reattach credentials or remint JWT
402Payment1Retry with new token or surface provider message
403Authorization3Request elevated scope
404Not found11Discover valid IDs via search/list
409Conflict14Read detail, follow next_actions
410Gone (expired)2Requote and retry
429Rate limit1Back off for retry_after seconds
500Internal2Retry with backoff, cite trace_id
502Upstream2Retry with backoff

Error recovery decision tree

error.code?
├── *_not_found (404) → discover valid IDs via search/list
├── *_expired (410) → requote, resource TTL elapsed
├── allocation_failed (409) → inventory moved, search alternatives
├── payment_failed (402) → new payment token or surface provider_message
├── rate_limited (429) → sleep(retry_after), retry
├── delegation_* (401) → mint/remint JWT, or escalate to admin
├── idempotency_conflict (409) → replay original body or use new key
├── validation_failed (400) → fix detail.field_errors, retry
└── internal_error (500) → retry with backoff, cite trace_id

See the full Error Catalog for all 44 error codes.

On this page