GET /api/sessions/search Bearer

Search Sessions

Perform full-text search across all PocketPaw session messages. Returns matching sessions with highlighted excerpts, enabling quick retrieval of past conversations by content or keyword.

Overview

Searches session message content for a query string. Returns matching sessions with the specific message that matched and its role.

Parameters

Query Parameters

q required
string

Search query string. Matches against message content.

limit
integer = 20

Maximum number of matching sessions to return.

Response

sessions array

Array of matching sessions with match context.

id string
Session identifier
title string
Session title
channel string
Origin channel
match string
The matched message content (truncated)
match_role string
Role of the matched message (user or assistant)
last_activity string
ISO 8601 last activity timestamp

Terminal window
curl -X GET "http://localhost:8000/api/sessions/search?q=prime&limit=20" \
-H "Authorization: Bearer <token>"
const response = await fetch("http://localhost:8000/api/sessions/search?q=prime&limit=20", {
headers: { "Authorization": "Bearer <token>" }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get(
"http://localhost:8000/api/sessions/search",
params={"q": "prime", "limit": 20},
headers={"Authorization": "Bearer <token>"},
)
print(response.json())
{
"sessions": [
{
"id": "session_abc123",
"title": "Python prime numbers",
"channel": "web",
"match": "Here's a function to check if a number is prime...",
"match_role": "assistant",
"last_activity": "2024-01-15T11:45:00Z"
}
]
}
Request
curl -X GET "http://localhost:8000/api/sessions/search" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <token>"
const response = await fetch("http://localhost:8000/api/sessions/search", {
  method: "GET",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
},
});

const data = await response.json();
console.log(data);
import requests

response = requests.get(
    "http://localhost:8000/api/sessions/search",
    headers={'Content-Type':'application/json','Authorization':'Bearer <token>'},
)

print(response.json())
package main

import (
    "fmt"
    "net/http"
    "io"
)

func main() {
    req, _ := http.NewRequest("GET", "http://localhost:8000/api/sessions/search", nil)
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("Authorization", "Bearer <token>")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}
Response
Send a request to see the response