Hostrail Docs
Discovery + Concepts

How does delegation work?

Agents act on behalf of travelers using short-lived JWTs. Hostrail records both which agent acted and on whose behalf.

Metadata JSONDocs Graph

What is delegation?

When an agent books or cancels a stay, the platform needs to know who the traveler is. The agent attaches a short-lived JWT in the X-Delegated-User header, signed by a trusted delegation issuer.

This is what lets Hostrail behave as a real booking layer for AI agents rather than just an anonymous inventory API.

Which routes require delegation?

RouteDelegation required
POST /v1/bookingsYes
POST /v1/bookings/{id}/cancelYes
All other routesNo

JWT requirements

ClaimRequiredDescription
issYesMust match a registered delegation issuer
subYesTraveler identifier
audYesMust include the platform's audience
expYesKeep short (minutes, not hours)

Accepted algorithms: RS256, ES256.

Error codes

CodeStatusRecovery
delegation_required401Mint a JWT and retry
delegation_invalid401Check detail.reason, remint
delegation_issuer_unknown401Escalate to tenant admin

detail.reason values for delegation_invalid: expired, bad_signature, missing_claim, audience_mismatch, unsupported_algorithm.

Discovering trusted issuers

GET /.well-known/delegation-issuers

Returns active issuers with JWKS URL and allowed audiences.

In practice, most runtimes discover auth metadata from the root site first, then use delegation only on traveler-bound write flows such as booking confirmation and cancellation.

On this page