niiko/developers

Miira · leads & WhatsApp v1 read-only

miira.knowledge_search

Searches the knowledge base the team loaded for the sales agent (manuals, cases, answers to objections) by words, and returns up to 6 fragments with their document and section. Only active documents that finished indexing. It is not the source of a price: that is miira.catalog_search.

Last updated

POST /api/v1/reads/miira.knowledge_search
Token scope
miira.knowledge_search@1
Workspace permission
api.miira.knowledge_search off by default
Who reads
The person behind the token, with their role. Someone who leaves the workspace stops reading.
Three permissions

A token with that scope, the workspace owner having switched the read on, and the person's role seeing it in the product. None of them is enough alone. OAuth only →

Request

fieldtyperules
querystringrequiredmin 1 · max 500

Response — output when status is done

fieldtyperules
foundbooleanrequired
fragmentsobject[]required

fragments[]

fieldtyperules
documentstringrequired
sectionstring | nullrequired
textstringrequired

Example

# Reads take an OAuth access token, not an API key, and no idempotency key: reading changes nothing.
curl -X POST https://niiko.org/api/v1/reads/miira.knowledge_search \
  -H "Authorization: Bearer $NIIKO_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "…"
  }'
# 200 → done · 4xx → refused, with a named reason

Why it may refuse

Each reason names who can fix it and how; detail.message, when present, says what to do. Refusals & HTTP codes →

invalid_inputrole_forbiddengrant_offreads_need_a_person

In the clients

@vorluno/niiko-sdkniiko.searchKnowledge()
niiko (Python)niiko.search_knowledge() from 0.4.0 · not on the registry yet
niiko-cliniiko read miira.knowledge_search
n8n-nodes-niikoNo reads: the node holds a key, and reading needs a person through OAuth.
niiko-mcp-servermiira_knowledge_search readOnlyHint

History