Search

POST /api/loops/{loopId}/search searches what the loop’s published version searches, minus every collection index. loopId is the loop’s public id (pl_…). It takes an API key with the search scope, for a loop that declares api delivery, or the visitor credential the embed and the SDK hold.

The body is {"query": {"text": "what to find"}}. The text is 1 to 500 characters. Add "match": "exact" to find the words together and in order, and "limit" for at most that many results (10 when absent, at most 50). Any other form of query answers 400.

It answers 200 with results: each one has a title, a heading (where it sits in its document), a snippet, and a url for a crawled page. A result is text from the indexed documents, so show it as text. A loop with nothing a visitor may search answers 404. A search the wallet or the loop’s budgets cannot cover answers 503, the same answer as a search that could not run.