Search Sessions
curl --request POST \
--url https://api.pathors.com/project/{projectId}/session/search \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"search_string": "<string>",
"limit": 123,
"offset": 123
}
'import requests
url = "https://api.pathors.com/project/{projectId}/session/search"
payload = {
"search_string": "<string>",
"limit": 123,
"offset": 123
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({search_string: '<string>', limit: 123, offset: 123})
};
fetch('https://api.pathors.com/project/{projectId}/session/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pathors.com/project/{projectId}/session/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'search_string' => '<string>',
'limit' => 123,
'offset' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pathors.com/project/{projectId}/session/search"
payload := strings.NewReader("{\n \"search_string\": \"<string>\",\n \"limit\": 123,\n \"offset\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pathors.com/project/{projectId}/session/search")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"search_string\": \"<string>\",\n \"limit\": 123,\n \"offset\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pathors.com/project/{projectId}/session/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"search_string\": \"<string>\",\n \"limit\": 123,\n \"offset\": 123\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"sessionId": "<string>",
"data": {},
"createdAt": "<string>",
"updatedAt": "<string>"
}
],
"pagination": {
"limit": 123,
"offset": 123,
"total": 123
}
}Deprecated APIs
Search Sessions
Search for sessions by matching content in session data, including variables and messages.
POST
/
project
/
{projectId}
/
session
/
search
Search Sessions
curl --request POST \
--url https://api.pathors.com/project/{projectId}/session/search \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"search_string": "<string>",
"limit": 123,
"offset": 123
}
'import requests
url = "https://api.pathors.com/project/{projectId}/session/search"
payload = {
"search_string": "<string>",
"limit": 123,
"offset": 123
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({search_string: '<string>', limit: 123, offset: 123})
};
fetch('https://api.pathors.com/project/{projectId}/session/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pathors.com/project/{projectId}/session/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'search_string' => '<string>',
'limit' => 123,
'offset' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.pathors.com/project/{projectId}/session/search"
payload := strings.NewReader("{\n \"search_string\": \"<string>\",\n \"limit\": 123,\n \"offset\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pathors.com/project/{projectId}/session/search")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"search_string\": \"<string>\",\n \"limit\": 123,\n \"offset\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pathors.com/project/{projectId}/session/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"search_string\": \"<string>\",\n \"limit\": 123,\n \"offset\": 123\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"sessionId": "<string>",
"data": {},
"createdAt": "<string>",
"updatedAt": "<string>"
}
],
"pagination": {
"limit": 123,
"offset": 123,
"total": 123
}
}Deprecated. This endpoint is deprecated and will be sunset on 2026-07-11. It still works until then. Migrate to the V1 path — see the migration guide for the old -> new path table.
Base URL
https://api.pathors.com
Search Sessions
POST https://api.pathors.com/project/{projectId}/session/search
Path Parameters
string
required
The ID of your project
Request Headers
string
required
Bearer token authentication using your Project API Key (starts with
sk_). Format: Bearer {your-api-key}Request Body
string
required
The string to search for in session data. This will match against all session content including variables, messages, and other stored information.
number
Maximum number of results to return. Default: 50
number
Number of results to skip for pagination. Default: 0
Response
array
Array of matching sessions, ordered by most recently updated first
object
Example
Request
curl -X POST https://api.pathors.com/project/{projectId}/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
updatedAtin descending order (most recent first) - Pagination: Use
limitandoffsetto 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 |
{
"error": "search_string is required"
}
{
"error": {
"message": "Invalid authentication"
}
}
Related APIs
- Create Session - Create a new session
- Query Session - Get a specific session by ID
- End Session - End an existing session
