Search conversations
Find conversations by words (lexical), by meaning (semantic) or both (hybrid, the default, which fuses the two rankings). Without a query, it explores by filters, newest first. Each result has the same shape as in List conversations, plus the search signals you ask for.
Without filters.from and filters.to, the search looks at the last 90 days. This request only reads, so read-only credentials can call it.
Example
curl https://api.platic.ai/v2/conversations/search \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "refund",
"semanticQueries": ["customer asking for their money back"],
"filters": { "platforms": ["whatsapp"], "from": "2026-11-01" },
"fields": ["id", "contactName", "topic", "snippet", "score", "sources"],
"limit": 10
}' const page = await platic.conversations.search({
query: "refund",
semanticQueries: ["customer asking for their money back"],
filters: { platforms: ["whatsapp"], from: "2026-11-01" },
fields: ["contactName", "topic", "snippet", "score", "sources"],
limit: 10,
});
for (const hit of page.data) console.log(hit.id, hit.score, hit.snippet);
console.log(page.meta.search.totalRelation, page.meta.warnings);
// Every result, up to candidateLimit
for await (const hit of platic.conversations.iterateSearch({ query: "invoice", mode: "lexical", limit: 100 })) {
console.log(hit.id);
} iterateSearch follows nextPageToken and must finish within the 15-minute search session; after that it throws GoneError with code SEARCH_SESSION_EXPIRED. Use search when you need each page's included and meta.
Query parameters
| Parameter | Type | Description |
|---|---|---|
workspace | string | The workspace to read, for an API key that covers several. Other credentials always read their own workspace |
Request body
Every field is optional. An empty body returns the most recent conversations of the last 90 days.
| Field | Type | Default | Description |
|---|---|---|---|
query | string, up to 2000 | — | Words to search. Empty or "*" explores by filters, newest first, without the semantic search |
semanticQueries | string[], 1 to 5, each up to 500 | — | Phrasings of what you mean, for the semantic search. Without them, query is used for meaning too |
mode | string | hybrid | hybrid, lexical or semantic. See Search modes |
kind | string | chat | chat: conversations. post: comment posts. all: both |
filters | object | {} | See Filters |
ranking | object | see below | How hybrid fuses the two rankings. See Ranking |
candidateLimit | integer, 25 to 1000 | 250 | Candidates fused before paging. Pages never go past this window |
limit | integer, 1 to 100 | 10 | Results per page |
pageToken | string, up to 2048 | — | The nextPageToken of the previous page. See Pagination |
fields | string[] | see below | Fields to return. Replaces the defaults; id is always returned. See Fields and signals |
include | string[] | [] | Relations to resolve once per page in included: agents, channels, assignees. They work as in List conversations |
Unknown body fields answer 400 INVALID_REQUEST.
Search modes
| Mode | What it does | Needs |
|---|---|---|
hybrid | Runs both searches and fuses their rankings with reciprocal rank fusion (RRF). A conversation found by both appears once | Nothing. Without any query it explores by filters |
lexical | Matches words: names, phone numbers, order numbers, exact phrases | Nothing. query: "*" explores by filters, newest first |
semantic | Matches meaning, even when the conversation uses other words | A query other than "*", or semanticQueries |
In hybrid, query feeds both searches unless you send semanticQueries, which then drive the semantic one.
Filters
All filters are optional and apply to both searches. Lists take up to 50 values, each up to 500 characters; a conversation matches a list when it has any of its values. Different filters combine with AND.
| Field | Type | Description |
|---|---|---|
contactIds | string[] | Only conversations of these contacts |
channelIds | string[] | Only conversations on these channels |
agentIds | string[] | Only conversations whose main agent is one of these |
platforms | string[] | Only these platforms: whatsapp, instagram, facebook, email, webchat… |
excludePlatforms | string[] | Leave out these platforms |
statuses | string[] | Only these visible states: initiated, active, finished, archived, spam |
operations | string[] | Only these operations: automatic, supervised, assistance |
topics | string[] | Only these topics |
conversationIds | string[] | Only these conversation IDs |
phoneNumbers | string[] | Only conversations with these contact phone numbers |
assigneeIds | string[] | Only conversations assigned to these team members (member ID or email) or to team |
tags | object | Tag names: any (at least one), all (every one), none (none of them). Each is a list of up to 50 |
hasPhone | boolean | Only conversations whose contact has (true) or lacks (false) a phone number |
isFinished | boolean | Only closed (true) or open (false) conversation cycles |
dateField | string | The date from and to apply to: lastActivityAt (default) or createdAt |
from | string | Earliest date: a date (2026-11-01, the whole UTC day) or a date-time (2026-11-01T08:00:00Z) |
to | string | Latest date: a date (2026-11-30, the whole UTC day) or a date-time (2026-11-30T18:00:00Z) |
The 90-day window applies only when you send neither from nor to. Then the search looks at the last 90 days of dateField. With only one of them, the other side is open: "from": "2025-01-01" searches from that date until now. Counts have no date window.
A filter with an impossible value, such as from after to or an invalid date, answers 400 INVALID_FILTER.
Ranking
{
"ranking": {
"lexicalWeight": 0.65,
"semanticWeight": 0.35,
"rrfK": 60,
"semanticThreshold": 0.8
}
} | Field | Range | Default | Description |
|---|---|---|---|
lexicalWeight | 0 to 1 | 0.5 | Weight of the lexical ranking in hybrid |
semanticWeight | 0 to 1 | 0.5 | Weight of the semantic ranking in hybrid |
rrfK | integer 1 to 200 | 60 | Reciprocal rank fusion constant. A higher value flattens the advantage of the top positions |
semanticThreshold | 0 to 2 | 0.8 | Largest cosine distance a semantic match may have. A lower value demands closer meaning |
In hybrid, at least one weight must be above 0. With lexicalWeight: 0, send query or semanticQueries. RRF combines the position of each conversation in the two rankings; it does not compare their scales.
Fields and signals
Without fields, each result has:
id, contactId, contactName, platform, topic, lastActivityAt, snippet fields accepts every conversation field and these search signals:
| Field | Type | Description |
|---|---|---|
snippet | string | null | The matching fragment, as plain text. null when the result matched by filters only |
score | number | null | Fused rank score (RRF). Higher is better. Compare it only within the same search |
sources | string[] | Which searches found the conversation: lexical, semantic or both |
scores | object | Per-search scores: scores.lexical (0 to 1, relative to the best lexical match among the candidates; higher is better) and scores.semanticDistance (cosine distance, 0 to 2; lower is better). A search that did not find the conversation is absent |
An unknown field answers 400 INVALID_FIELD with the accepted names in details.allowed.
For agents and automations, ask only for the fields you need. Use snippet to check relevance, then read the full history with List messages.
Response
{
"status": "success",
"data": [
{
"id": "8Yc2kQ1mZ0rTq4Lp7WvX",
"contactId": "cl_3h7Jt9Q2",
"contactName": "Ana López",
"platform": "whatsapp",
"topic": "Refund",
"lastActivityAt": "2026-11-30T18:00:00.000Z",
"snippet": "…I still have not received the refund for order 1042…",
"score": 0.031,
"sources": ["lexical", "semantic"],
"scores": { "lexical": 0.92, "semanticDistance": 0.41 }
}
],
"nextPageToken": "c2Vzc2lvbjpleGFtcGxl",
"pagination": { "limit": 10, "returnedCount": 1, "hasMore": true },
"meta": {
"fields": ["id", "contactId", "contactName", "platform", "topic", "lastActivityAt", "snippet", "score", "sources", "scores"],
"include": [],
"requestId": "req_7f3a",
"search": {
"mode": "hybrid",
"totalRelation": "lower_bound",
"candidateWindow": 250,
"engines": {
"lexical": { "status": "ok", "candidates": 120, "found": 1340 },
"semantic": { "status": "ok", "candidates": 180 }
}
},
"warnings": []
}
} | Field | Description |
|---|---|
data | Results of this page, in rank order |
included | Related records, only when you sent include |
nextPageToken | Token of the next page; null on the last one |
pagination | limit, returnedCount and hasMore (always the same as nextPageToken !== null) |
meta.search.mode | The mode that ran |
meta.search.totalRelation | How complete the results are: exact (every match), lower_bound (there may be more matches) or candidate_window (cut at candidateWindow) |
meta.search.candidateWindow | Candidates fused before paging |
meta.search.engines.lexical | status (ok, skipped when the request did not need it, failed), candidates it contributed and, when known, found: the total matches it reported |
meta.search.engines.semantic | status and candidates, as above |
meta.warnings | Notices about this answer. See below |
Warnings
A warning does not fail the request. Each one has code and message, and some add id or engine.
code | Meaning |
|---|---|
SEARCH_ENGINE_FAILED | In hybrid, one search failed and the results come from the other one. engine says which failed (lexical or semantic) |
UNKNOWN_STATUS | The conversation in id has a stored state the API does not know; its status is null |
Pagination
- Send
nextPageTokenaspageTokenwith the same query and filters. You can changelimit,fieldsandinclude. - The ranked results are kept for 15 minutes from the first page. After that,
pageTokenanswers410 SEARCH_SESSION_EXPIRED: repeat the search without it. - A token with another query, filter set, workspace or credential answers
400 INVALID_CURSOR. - Pages never go past
candidateLimit. To reach more results, raise it (up to 1000) or narrow the filters. - Every page is checked again against the credential: a conversation deleted or out of reach since the search started is left out, so a page can be shorter than
limit. Keep going untilnextPageTokenisnull.
Who sees what
The search returns only conversations the credential may read, in every mode. An OAuth connection acts as the person who authorized it: if their role only reaches assigned conversations, the results, found and the other totals cover only those assigned to them or to team. A permission revoked between pages applies to the next page.
Errors
| Status | details.code | When it happens |
|---|---|---|
400 | INVALID_REQUEST | The body is invalid: a value out of range, an unknown field, semantic mode without a query, both weights at 0, or lexicalWeight: 0 without a query. details.issues says which |
400 | INVALID_REQUEST | The workspace in ?workspace= is not covered by the credential. details.available lists the ones it covers |
400 | INVALID_FIELD | A name in fields does not exist. details.allowed lists the accepted ones |
400 | INVALID_INCLUDE | A name in include does not exist. details.allowed lists the accepted ones |
400 | INVALID_FILTER | A filter has an impossible value, for example from after to or an invalid date |
400 | INVALID_CURSOR | The pageToken belongs to another query, filter set, workspace or credential. Repeat the search without it |
401 | UNAUTHENTICATED | The credential is missing or invalid |
403 | FORBIDDEN | The credential has no access to conversations in this workspace |
410 | SEARCH_SESSION_EXPIRED | More than 15 minutes passed since the first page. Repeat the search without pageToken |
503 | SEARCH_UNAVAILABLE | The search this request needs is temporarily unavailable. details.retryable is true; details.engine names the search when only one was needed. Try again |
The general error format is in Errors.
Notes
- With
kind: "post"or"all", results can be comment posts. Read those in Posts: Get a conversation answers404 NOT_A_CONVERSATIONfor them. scoreandscoresdescribe the order of one search. Do not compare them across searches or store them as a quality measure.