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

{
  "session_id": "IITZ",
  "metadata": {}
}
Endpoint: PUT /v1/sessions/{session_id} This endpoint updates the details of a specific session based on the provided session_id.

Path Parameters

session_id
string
required
The unique ID of the session to update.

Parameters

user_id
string
required
The ID of the user associated with the session.
metadata
object
required
Optional metadata associated with the session.
Curl
curl -X PUT "https://agent.api.lyzr.app/v1/sessions/{session_id}" \
-H "Content-Type: application/json" \
-H "x-api-key: your_api_key_here" \
-d '{
  "user_id": "1234",
  "metadata": {}
}'

Python
import requests
import json

# Define the API URL and headers
session_id = "IITZ"
url = f"https://agent.api.lyzr.app/v1/sessions/{session_id}"
headers = {
    "Content-Type": "application/json",
    "x-api-key": "your_api_key_here"
}
data = {
    "user_id": "7422",
    "metadata": {}
}

response = requests.put(url, headers=headers, data=json.dumps(data))
{
  "session_id": "IITZ",
  "metadata": {}
}

Response Parameters

active
boolean
Indicates if the session is currently active.
session_id
string
The unique identifier of the session.
_id
string
The internal ID of the session in the database.
user_id
string
The ID of the user associated with the session.
created_at
string
The timestamp when the session was created.