Skip to main content
A hotel AI search answer has two layers. The HTTP status says whether the request was accepted. When it was, the status field says where the search is. Check the HTTP status first, then status.

Task status

Every successful answer (200 or 202) carries status, on POST /v1/hotel_ai_search, on the task read and on :cancel. On POST /v1/hotel_ai_search without streaming, a 200 always carries one of the last four statuses: the turn is over, and nothing more arrives for it. The task read answers 200 with any status, working included, so keep reading it while status is working. A completed reply can still ask the traveler something, with no question field, for example Tell me which condition to drop. when no hotel matches every filter, or Tell me where and when you'd like to stay, and I'll search hotels. for a message that is not a hotel request. Always show message. The traveler’s reply goes in the same conversation. In the event stream, task.status events also carry submitted, the moment a turn is accepted. A task read shows that moment as working.

Why a search fails

A failed task answers 200 with status: "failed" and an error:
message is safe to show to the traveler. Branch on code.

HTTP statuses

Errors use the Jinko error format: {"error": {"code": "...", "message": "..."}}. See Errors.

All four routes

POST /v1/hotel_ai_search

GET /v1/hotel_ai_search/tasks/{task_id}

A task stays readable after its conversation expires.

GET /v1/hotel_ai_search/tasks/{task_id}/events

POST /v1/hotel_ai_search/tasks/{task_id}:cancel