Skip to main content
POST
/
sessions
Create session
curl --request POST \
  --url https://api.galtea.ai/sessions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "versionId": "ver_123",
  "customId": "my-session-1",
  "testCaseId": "tc_123",
  "isProduction": true,
  "context": "<string>",
  "metadata": {
    "key": "value"
  },
  "status": "COMPLETED"
}
'
{
  "id": "session_123",
  "customId": "custom_session_123",
  "versionId": "ver_123",
  "userId": "user_123",
  "testCaseId": "tc_123",
  "context": {
    "value": "Session context information"
  },
  "stoppingReason": "GOAL_ACHIEVED",
  "error": "External API responded with HTTP 422: Unprocessable Entity — {\"detail\":\"model not found\"}",
  "status": "PENDING",
  "isProduction": false,
  "metadata": {
    "key": "value"
  },
  "createdAt": "2023-11-07T05:31:56Z",
  "deletedAt": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

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

application/json

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.

versionId
string
required

Version ID to create the session for

Example:

"ver_123"

customId
string

Optional caller-defined identifier for the session

Example:

"my-session-1"

testCaseId
string

Test case to link this session to. Forbidden when isProduction=true. Defaults to omitted, in which case isProduction defaults to true.

Example:

"tc_123"

isProduction
boolean

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).

context

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).

metadata
object

Arbitrary key-value metadata

Example:
{ "key": "value" }
status
enum<string>
default:COMPLETED

Initial session status

Available options:
PENDING,
COMPLETED,
FAILED

Response

Session created successfully

id
string
Example:

"session_123"

customId
string | null
Example:

"custom_session_123"

versionId
string
Example:

"ver_123"

userId
string | null
Example:

"user_123"

testCaseId
string | null
Example:

"tc_123"

context
object

Structured context data. For plain text context, format is { value: "..." }

Example:
{ "value": "Session context information" }
stoppingReason
string | null
Example:

"GOAL_ACHIEVED"

error
string | null
Example:

"External API responded with HTTP 422: Unprocessable Entity — {\"detail\":\"model not found\"}"

status
enum<string>
Available options:
PENDING,
COMPLETED,
FAILED
Example:

"PENDING"

isProduction
boolean

True when the session represents real production traffic (no associated test case).

Example:

false

metadata
object
Example:
{ "key": "value" }
createdAt
string<date-time>
deletedAt
string<date-time> | null