curl -X POST https://agent.api.lyzr.app/v1/sessions/ \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
  "user_id": "string",
  "metadata": {}
}'
{
  "session_id": "66e2a2a6a64bxxxxxxx"
}

Endpoint: POST /v1/sessions/

This endpoint creates a new session for a user. You need to provide the user_id and optional metadata in the request body.

Parameters

user_id
string
required

The unique ID of the user for whom the session is created.

metadata
object

Additional metadata related to the session.

Curl
curl -X POST https://agent.api.lyzr.app/v1/sessions/ \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
  "user_id": "string",
  "metadata": {}
}'
Python
import requests

url = "https://agent.api.lyzr.app/v1/sessions/"
headers = {
    "x-api-key": "your_api_key_here",
    "Content-Type": "application/json"
}

data = {
    "user_id": "string",
    "metadata": {}
}

response = requests.post(url, headers=headers, json=data)
{
  "session_id": "66e2a2a6a64bxxxxxxx"
}

Response Parameters

session_id
string

The unique identifier for the newly created session.