Runs a semantic search over the case evidence and returns the best matches (messages or conversation chunks) with score, snippet and, when asked, the surrounding messages, filtered by source, dates, participants, conversations, topics or relevance. On a case shared with opposing counsel, callers on the other side see only evidence released to them, and conversation chunks are left out. Requires commenter access or above to the case and an active plan (403 otherwise).
POST
/ai/cases/{caseId}/search
curl \
--request POST 'http://api.example.com/ai/cases/{caseId}/search' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"query": "string",
"filters": {
"sources": [
"device_message"
],
"dateRange": {
"start": "2026-05-04T09:42:00Z",
"end": "2026-05-04T09:42:00Z"
},
"participants": [
"string"
],
"conversationIds": [
"string"
],
"topics": [
"string"
],
"legalRelevance": [
"string"
]
},
"granularity": "messages",
"topK": 50,
"rerank": true,
"expandContext": {
"before": 0,
"after": 0
}
}'
Request examples
{
"query": "string",
"filters": {
"sources": [
"device_message"
],
"dateRange": {
"start": "2026-05-04T09:42:00Z",
"end": "2026-05-04T09:42:00Z"
},
"participants": [
"string"
],
"conversationIds": [
"string"
],
"topics": [
"string"
],
"legalRelevance": [
"string"
]
},
"granularity": "messages",
"topK": 50,
"rerank": true,
"expandContext": {
"before": 0,
"after": 0
}
}
Response examples (200)
{
"data": {
"items": [
{
"kind": "message",
"id": "65a1b2c3d4e5f6a7b8c9d0f1",
"messageId": "65a1b2c3d4e5f6a7b8c9d0f1",
"source": "device_message",
"conversationId": "65a1b2c3d4e5f6a7b8c9d0f0",
"sender": "+15555550123",
"timestamp": "2026-01-15T10:15:00.000Z",
"score": 0.83,
"snippet": "I will not be at the pickup tomorrow.",
"topics": [
"custody",
"scheduling"
],
"expandedContext": {
"before": [
{
"messageId": "65a1b2c3d4e5f6a7b8c9d0f2",
"text": "See you at the exchange on Friday.",
"timestamp": "2026-01-15T10:15:00.000Z"
}
],
"after": [
{
"messageId": "65a1b2c3d4e5f6a7b8c9d0f2",
"text": "See you at the exchange on Friday.",
"timestamp": "2026-01-15T10:15:00.000Z"
}
]
}
}
],
"candidateCount": 50,
"vectorSearchTopN": 50,
"rerankApplied": true,
"queryEmbeddingModel": "cohere.embed-english-v3"
},
"statusCode": 200,
"timestamp": "2026-01-15T10:15:00.000Z"
}