Search across all sessions to find matches based on string content in session data.
Search Sessions
POST /api/project/{projectId}/integration/api/session/search
Path Parameters
Bearer token authentication using your API key
Request Body
The string to search for in session data. This will match against all session content including variables, messages, and other stored information.
Maximum number of results to return. Default: 50
Number of results to skip for pagination. Default: 0
Response
Array of matching sessions, ordered by most recently updated first
The session data containing variables, messages, and other session information
ISO 8601 timestamp when the session was created
ISO 8601 timestamp when the session was last updated
Pagination information
The limit used for this request
The offset used for this request
Total number of matching sessions
Example
Request
curl -X POST https://app.pathors.com/api/project/{projectId}/integration/api/session/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"search_string": "John Doe",
"limit": 10,
"offset": 0
}'
Response
{
"results": [
{
"sessionId": "user-123-session-456",
"data": {
"variables": {
"userName": "John Doe",
"userRole": "admin"
},
"messages": [
{
"role": "user",
"content": "Hello"
},
{
"role": "assistant",
"content": "Hi John Doe! How can I help you today?"
}
]
},
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:35:00.000Z"
},
{
"sessionId": "user-456-session-789",
"data": {
"variables": {
"userName": "John Doe",
"userRole": "user"
},
"messages": []
},
"createdAt": "2024-01-14T15:20:00.000Z",
"updatedAt": "2024-01-14T15:25:00.000Z"
}
],
"pagination": {
"limit": 10,
"offset": 0,
"total": 2
}
}
Usage Notes
- Search String: The search is case-sensitive and matches against the entire JSON content of the session data
- Ordering: Results are ordered by
updatedAt
in descending order (most recent first)
- Pagination: Use
limit
and offset
to paginate through large result sets
- Performance: For large datasets, consider using more specific search strings to improve query performance
Error Responses
Status Code | Description |
---|
400 | Missing or invalid search_string |
401 | Invalid authentication |
500 | Internal server error |
Example error responses:
400 Bad Request:
{
"error": "search_string is required"
}
401 Unauthorized:
{
"error": {
"message": "Invalid authentication"
}
}