Skip to main content
The Sessions API lets you launch investigations, send follow-up questions, and fetch results programmatically. Sessions are the same investigation primitive that powers the Traversal web application — anything a member can do in the UI, you can do over the API. All endpoints require authentication — see Authentication to create an API key. For base URL, error envelope, and generic status codes, see the API overview.
The V1 Sessions API must be explicitly enabled for your organization. If your organization does not yet have access, contact your Traversal point of contact or support@traversal.com.

Endpoints

See the Endpoints section in the sidebar for the full API reference, generated from the OpenAPI spec.

Required roles

API keys inherit the role of the user who created them. Most Sessions endpoints work for any member, but GET /v1/sessions is admin-only because it returns sessions across the whole organization. A request from an underprivileged key returns 403 Forbidden with a message naming the required role. If GET /v1/sessions is failing for you, check the role of the user who issued the key in Settings > User Management.

Investigation depth

Both POST /v1/sessions and POST /v1/sessions/{session_id}/messages accept an optional thinking_mode field that controls how much depth Traversal applies: If omitted, thinking_mode defaults to auto, so existing integrations need no changes.

Session lifecycle

Investigations are asynchronous. Creating a session or sending a follow-up returns immediately while Traversal investigates in the background. Connect to GET /v1/sessions/{session_id}/events to wait for a terminal status, then retrieve the result with GET /v1/sessions/{session_id}.

Status values

idle, failed, and cancelled are terminal statuses. Once the session reaches one of these states, no further work is in progress.

Status transitions

Stream status updates

The session events endpoint uses Server-Sent Events to report lifecycle changes without polling. Send the same bearer token you use for other API requests and request text/event-stream:
The stream sends a named status event when you connect and whenever the status changes:
Each data value uses the same session shape as other Sessions endpoints, but messages is always null. Fetch GET /v1/sessions/{session_id} after the terminal event to retrieve the conversation and final result. While the status remains running or follow_up_running, the server sends a : keepalive comment every 15 seconds when there is no status change. SSE clients ignore comment lines automatically. The stream closes after it sends an idle, failed, or cancelled status.
If the connection closes before you receive a terminal status, reconnect to the same endpoint. The first event always contains the current status, so you do not need an event cursor or Last-Event-ID header.

Python example

The following example creates an investigation, waits on the event stream, and retrieves the final messages:
Set a read timeout longer than the 15-second keepalive interval. If your client raises a timeout or the connection drops, reconnect and continue waiting.

Polling fallback

If your HTTP client or network path does not support streaming responses, poll GET /v1/sessions/{session_id} at a steady interval until the session is no longer running or follow_up_running. A 5-second interval is a reasonable default.
Investigations have a 1-hour server-side timeout. If an investigation has not completed within that window, the session status transitions to failed.

Session-specific errors

In addition to the generic status codes, the Sessions API returns these session-specific responses: