Skip to Content
Passage PlatformAPI ReferenceCreate Session

Create Session

Create a new session directly via the Platform Service.

Request

POST /v1/sessions

Headers

HeaderValue
AuthorizationBearer YOUR_API_KEY
Content-Typeapplication/json

Body

FieldTypeRequiredDescription
metadataobjectNoArbitrary metadata to attach to the session
configobjectNoSession configuration options
config.disconnectGracePeriodMsintegerNoGrace period in milliseconds before marking a disconnected session as expired
config.commandTimeoutMsintegerNoTimeout in milliseconds for pending commands

Response

201 Created

{ "sessionId": "sess_xyz789", "clientToken": "ct_...", "workerToken": "wt_...", "websocketUrl": "wss://sessions.services.getpassage.ai/sessions/sess_xyz789/ws", "expiresAt": 1704081600000 }

400 Bad Request

Invalid request body — wrong types for config fields (must be positive integers), or malformed JSON.

Notes

  • Proxied to the Session Service via service binding
  • Session ownership is tracked in D1 for access control
  • Use the returned tokens to connect via WebSocket
Last updated on