Session Management
Session management is an important part of using the ORX API. When a you initiates a search, they will receive a session ID that they can use to build their itinerary for flights, cars, or hotels. Sessions typically expire within two hours of their creation, although the exact expiration time will be included in the session object.
Session Object
The session object includes the following fields:
{
"flow": "FLIGHT",
"id": "60d67317-2529-4e10-ae3e-9ba5c0746a3b",
"expireAt": "2023-03-17T23:05:24.944Z",
"createdAt": "2023-03-17T21:05:24.945Z"
}
session
: (Session) the session object describing the expiry, the creation time and the flow of the session.
Accessing Session Information
GET /session/[sessionId]
Clients can retrieve information about a session using this endpoint. This will return the session object described above, providing the client with important details about their search.
curl -H "x-api-key: your-api-key" -H "x-api-version: 1" https://your-api-url.com/session/60d67317-2529-4e10-ae3e-9ba5c0746a3b
🧨 It's important to manage sessions carefully to ensure that they don't expire before the client has completed their search. If the session expires, the client will need to initiate a new search and create a new session ID.
⛳ By default, session expirations are set to a static window, but you can request the API set the session expiration to be the same as the shortest-lived offer in the response, by setting the header
Prefer: dynamic-session-expiry=true
. This default behavior will change in the future major version of the API.