POST
/
trpc
/
datasets.query
Query Extracted Data
curl --request POST \
  --url https://api.kontext.dev/trpc/datasets.query \
  --header 'x-api-key: <x-api-key>'

Overview

  • Uses only extracted personality for answers
  • Requires userId for user datasets (no personality extraction for population datasets)

Authentication

x-api-key
string
required
Your API key

Request (tRPC HTTP)

Body (JSON): { "input": { datasetId, query, userId?, maxFacts? } }
  • datasetId (string, required)
  • query (string, required)
  • userId (string, required)
  • maxFacts (number, optional; default 60)

Response (tRPC envelope)

200 OK
{
  "result": {
    "data": {
      "answer": "string",
      "factsUsed": 12
    }
  }
}
Note: SDK and tRPC clients return the inner object directly (no wrapper).

Errors

  • 400 BAD_REQUEST — userId missing for a user‑anchored dataset
  • 401 UNAUTHORIZED — invalid API key
  • 403 FORBIDDEN — dataset doesn’t belong to your developer
  • 404 NOT_FOUND — no facts available for this dataset
  • 500 INTERNAL_SERVER_ERROR

Examples

curl -X POST https://api.kontext.dev/trpc/datasets.query \
  -H "x-api-key: ktext_abc123..." \
  -H "content-type: application/json" \
  -d '{
    "input": {
      "datasetId": "ds_123",
      "query": "Summarize the key points from the uploaded notes",
      "maxFacts": 50
    }
  }'

Notes

  • No vector fallback by design. If you need semantic snippet retrieval, use Search Dataset (/trpc/datasets.search).