Create session
Create a new session. See Sessions.
Authorizations
API key authorization. Pass your API key in the Authorization header as a Bearer token. Both new (gsk_*) and legacy (gsk-) API keys are accepted, e.g. Authorization: Bearer gsk_... or Authorization: Bearer gsk-....
Body
Session creation input. testCaseId and isProduction are independent: a session can be production (no testCaseId), test-driven non-production (testCaseId set, isProduction defaults to false), or externally-ingested non-production (no testCaseId, isProduction explicitly false — typical for imported traces). The only forbidden combination is testCaseId set together with isProduction=true. When testCaseId is set, context is rejected because it would be derived from the test case.
Version ID to create the session for
"ver_123"
Optional caller-defined identifier for the session
"my-session-1"
Test case to link this session to. Forbidden when isProduction=true. Defaults to omitted, in which case isProduction defaults to true.
"tc_123"
Whether the session represents real production traffic. Defaults to true when testCaseId is omitted and false when testCaseId is set. May be set explicitly to false without a testCaseId for externally-ingested sessions (e.g. trace imports).
Additional context for the session. Accepts a plain string or a structured JSON object. Forbidden when testCaseId is set (the context is derived from the test case).
Arbitrary key-value metadata
{ "key": "value" }Initial session status
PENDING, COMPLETED, FAILED Response
Session created successfully
"session_123"
"custom_session_123"
"ver_123"
"user_123"
"tc_123"
Structured context data. For plain text context, format is { value: "..." }
{ "value": "Session context information" }"GOAL_ACHIEVED"
"External API responded with HTTP 422: Unprocessable Entity — {\"detail\":\"model not found\"}"
PENDING, COMPLETED, FAILED "PENDING"
True when the session represents real production traffic (no associated test case).
false
{ "key": "value" }