POST
/
api
/
project
/
{projectId}
/
integration
/
api
/
session
Create Session
curl --request POST \
  --url https://app.pathors.com/api/project/{projectId}/integration/api/session \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '{
  "session_id": "<string>",
  "variables": {}
}'
{
  "sessionId": "<string>",
  "pathwayId": "<string>"
}
Create a new session that can be used to maintain conversation context across multiple API calls.

Create Session

POST /api/project/{projectId}/integration/api/session

Path Parameters

projectId
string
required
The ID of your project

Request Headers

Authorization
string
required
Bearer token authentication using your API key

Request Body

session_id
string
required
A unique identifier for the session. This can be any string you choose to identify the conversation session.
variables
object
Optional initial session variables that can be used within the pathway. These variables can be referenced in your pathway configuration.

Response

sessionId
string
The created session ID (same as the one provided in the request)
pathwayId
string
The pathway ID for this project

Example

Request

curl -X POST https://app.pathors.com/api/project/{projectId}/integration/api/session \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "session_id": "user-123-session-456",
    "variables": {
      "userName": "John Doe",
      "userRole": "admin",
      "customData": "value"
    }
  }'

Response

{
  "sessionId": "user-123-session-456",
  "pathwayId": "project-id-xxx"
}

Usage Notes

  • Session ID: Choose a unique identifier for each conversation. This could be a UUID, user ID + timestamp, or any other unique string.
  • Variables: Session variables can be used within your pathway logic. They persist throughout the session and can be referenced in conversation flows.
  • Reusability: Once created, the session can be used in multiple completion requests by including the session_id parameter or X-Session-ID header.

Error Responses

Status CodeDescription
400Missing or invalid session_id
401Invalid authentication
500Internal server error
Example error response:
{
  "error": "session_id is required"
}