Skip to main content

RAG Query

Query a specific pipeline using vector similarity search. This endpoint requires a pipeline-specific API key. POST /rag/query

Headers

Authorization
string
required
Bearer token containing your pipeline API key (e.g., Bearer rag_...)
Content-Type
string
required
Must be application/json

Body

query
string
required
The search query you want to find context for.
topK
number
The maximum number of results to return. Defaults to the pipeline’s configured retrievalTopK setting. (Max: 20)

Response

{
  "results": [
    {
      "content": "The actual text chunk retrieved from your data sources...",
      "score": 0.892,
      "metadata": {
        "sourceName": "document.pdf",
        "sourceType": "file",
        "chunkIndex": 12,
        "totalChunks": 45
      }
    }
  ],
  "pipelineId": "pip_123",
  "pipelineName": "Support Docs",
  "query": "How do I reset my password?",
  "topK": 5,
  "totalResults": 1
}

Error Codes

HTTP StatusCodeDescription
401MISSING_API_KEYNo Authorization header provided.
401INVALID_API_KEYThe API key is invalid or has been revoked.
404PIPELINE_NOT_FOUNDThe pipeline this key belongs to no longer exists.
400MISSING_QUERYThe query field was missing from the body.