Search conversations

You are reading the previous version (V1) of this endpoint. Go to V2
SDK platic.search.conversations()

Search conversations by words, meaning or both. Hybrid search combines the results without repeating conversations. Choose which fields to return; messages, phone and email are excluded by default.

Example

const page = await platic.search.conversations({
  query: "refund",
  filters: { startDate: "2030-01-01" },
  limit: 20,
});
// page.data, page.total, page.nextPageToken

for await (const result of platic.search.iterate({ query: "refund" })) {
  console.log(result.id);
}

Read results in page.data and the total in page.total. To continue, send page.nextPageToken as pageToken. iterate reads results up to candidateLimit.

Request body

{
  "query": "the customer wants to cancel because the charge was duplicated",
  "mode": "hybrid",
  "filters": {
    "start_date": "2026-07-01",
    "tags": { "any": ["cancellation", "billing"], "none": ["test"] },
    "platforms": ["whatsapp", "instagram"],
    "is_finished": true
  },
  "page_size": 20,
  "response": {
    "fields": ["id", "contactName", "topic", "tags", "snippet", "score", "sources"]
  }
}
FieldTypeDefaultDescription
querystring, max. 2000"*"Text for the lexical search and, if there are no explicit variants, for the semantic one. You can omit it when exploring by filters.
semantic_queriesstring or string[]—One semantic query or up to 5 variants; the best match per conversation is kept.
modehybrid, lexical or semantichybridSelects the engines.
kindchat, post or allchatchat leaves out comment posts; post searches only them; all searches both. Each result carries kind.
filtersobject{}Advanced filters; see the table below.
pageinteger ≥ 11Requested page.
page_sizeinteger 1-10010Results per page.
candidate_limitinteger 25-1000250Fixed window of candidates retrieved and merged before paginating. Use the same value when you walk through pages.
semantic_score_thresholdnumber 0-20.8Maximum semantic distance. Results with a distance below the threshold are accepted; a lower value demands higher similarity.
rankingobjectweights 0.5, rrf_k: 60Engine weights and the RRF constant.
responseobjectcompact projectionControls fields, results, analytics, diagnostics and text limits.
export_csvboolean or objectfalseGenerates a CSV with a signed URL.

Search modes

ModeEngineWhen to use it
hybridLexical + semanticRecommended. Combines textual and conceptual matches with Reciprocal Rank Fusion (RRF).
lexicalLexicalFor words, names, phone numbers, emails or exact phrases. query: "*" lets you explore with filters and recency only.
semanticSemanticTo find conversations with the same meaning even if they use other words. Requires a query other than "*", or semantic_queries.

In hybrid mode, query is also used as the semantic query when you do not send semantic_queries. If there is no semantic query at all, the search continues with the lexical branch only and says so in warnings. If you send semantic_queries without query, the lexical branch is skipped so semantic matches are not mixed with a general listing by recency.

Filters

Each text filter accepts a string or an array of up to 50 strings. Filters are applied to the result of both engines.

FieldTypeDescription
start_date, end_dateISO 8601 dateInclusive range. If omitted, it searches from the last 90 days up to now. A YYYY-MM-DD date covers the whole day.
date_fieldlastUpdate or creationDateDate used by the range. Default: lastUpdate.
tagsstring, string[] or objectA string or list is the same as any. The object accepts any, all and none to include any tag, require all of them or exclude tags.
platformsstring or string[]Platforms, for example whatsapp, instagram or messenger.
exclude_platformsstring or string[]Platforms that must not appear.
topicsstring or string[]Conversation topics.
statusesstring or string[]Searchable statuses: active, finished or spam.
agentsstring or string[]Agent IDs/paths.
channel_idsstring or string[]Channel IDs.
operationsstring or string[]Operation modes.
owner_idsstring or string[]Owner IDs.
conversation_idsstring or string[]Thread IDs.
client_idsstring or string[]Contact IDs.
phone_numbersstring or string[]Exact phone numbers.
has_phonebooleanIncludes or excludes conversations with a phone number.
is_finishedbooleanFilters by finished conversation.

Hybrid ranking

{
  "ranking": {
    "lexical_weight": 0.65,
    "semantic_weight": 0.35,
    "rrf_k": 60
  }
}

Each weight ranges from 0 to 1. In hybrid mode, at least one must be greater than zero. RRF combines a conversation's position in the two result lists rather than comparing their relevance scales. Before sorting, duplicate semantic fragments are removed by conversation id.

The final score is normalized between 0 and 1. Request sources to learn which engines found the result and scores to inspect lexicalRank, lexicalTextMatch, semanticRank and semanticDistance.

Control the size of the response

By default, the response excludes messages, phone and email:

{
  "response": {
    "fields": [
      "id", "contactName", "platform", "topic", "tags",
      "lastUpdate", "snippet", "conversationUrl", "score", "sources"
    ],
    "include_results": true,
    "include_analytics": false,
    "include_engine_metadata": false,
    "create_search_cache": false,
    "max_snippet_chars": 320,
    "max_content_chars": 2000
  }
}

fields accepts:

id, conversationId, contactName, phoneNumber, email, platform, topic, tags,
status, agent, channelId, clientId, operation, owners, isFinished, creationDate,
lastUpdate, snippet, messages, conversationUrl, contactUrl, score, sources, scores
FieldRangeEffect
include_resultsbooleanWith false, omits results; useful to ask only for analytics, create a cache or export.
include_analyticsbooleanAdds counts by topic, tag, status, agent, platform and date. They are sampled counts over the merged window; check analytics.scope.
include_engine_metadatabooleanAdds status, candidates, time and truncation of the lexical and semantic branches.
create_search_cachebooleanCreates a temporary searchId for later flows and returns its expiry.
max_snippet_charsinteger 40-2000Maximum length of snippet. Default: 320.
max_content_charsinteger 100-10000Maximum length of the matching passage in messages. It is not the full history. Default: 2000.

Export CSV

Send "export_csv": true to export the matches in the candidate window with the default column selection, or control both options:

{
  "query": "cancellation request",
  "response": { "include_results": false },
  "export_csv": {
    "fields": ["id", "contactName", "phoneNumber", "topic", "lastUpdate", "conversationUrl"],
    "max_rows": 500
  }
}

max_rows limits the exported rows but does not widen candidate_limit. Exports that include snippet or messages are limited to 100 rows; without those fields they can include up to 1000.

The response includes export.url, filename, rowCount, sizeBytes, truncated and expiresAt. downloadUrl holds the same URL for compatibility. The file is private, the signed URL expires in 7 days and its cells are protected against spreadsheet formulas.

Response

Read the matches from results and use the fields below to check the search limits.

{
  "success": true,
  "mode": "hybrid",
  "matchCount": 42,
  "candidateCount": 42,
  "totalFound": 42,
  "totalRelation": "lower_bound",
  "returnedCount": 2,
  "truncated": false,
  "fields": ["id", "contactName", "topic", "snippet", "score", "sources"],
  "results": [
    {
      "id": "conv_7a19",
      "contactName": "Ana",
      "topic": "Billing",
      "snippet": "...I'd like to cancel because there is a duplicate charge...",
      "score": 0.967213,
      "sources": ["lexical", "semantic"]
    }
  ],
  "pagination": {
    "currentPage": 1,
    "totalPages": 5,
    "pageSize": 10,
    "hasNextPage": true,
    "hasPreviousPage": false,
    "candidateWindow": 250
  },
  "tookMs": 183
}
FieldMeaning
candidateCount, matchCount, totalFoundUnique conversations retrieved within the candidate window after deduplicating.
totalRelationexact only for an untruncated lexical search; lower_bound for hybrid, semantic or truncated results.
truncatedtrue means an engine or the merge reached its limit; there may be more matches outside the window.
returnedCountItems included in results; it is 0 when include_results is false.
warningsNotices about degradation or result limits.

The requested page must fit inside candidate_limit. The maximum window is 1000 conversations and it stays fixed so the order is preserved while paginating.

Errors

StatusWhen
400A field is invalid: a page_size or candidate_limit out of range, a page outside the candidate window, semantic mode without a query, or a weight outside 0-1
401Missing or invalid API key

Notes

Engine availability

If you request both engines and only one is available, the search uses the available engine, adjusts the result order and reports this in warnings. Use response.include_engine_metadata to diagnose a problem; omit it when you do not need those details.