Knowledge Search
POST /v1/knowledge/search
Search your indexed documentation with a natural language question. Returns semantically relevant results with answer content, source reference, and unique ID.
https://api.ragionex.com/v1/knowledge/search
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| question | string | required | The search query (1-128 characters) |
| collection | string | required | The knowledge base collection name (max 64 characters) |
| results | integer | optional | Number of results to return (1-50) Default: 10 |
Example Request
curl
curl -X POST https://api.ragionex.com/v1/knowledge/search \ -H "Content-Type: application/json" \ -H "X-API-Key: rgx_demo_gYLaf3LGp0aplximXA2ycH1GOXHrSADPvApTkwbhQivuFpz6GHvtwjF3dlD2oWxNnzBgnwGEWEo2mLmr2KxEEk0" \ -d '{ "question": "How to format code in VS Code?", "collection": "vscode-docs", "results": 5 }'
Python
import requests response = requests.post( "https://api.ragionex.com/v1/knowledge/search", headers={"X-API-Key": "rgx_demo_gYLaf3LGp0aplximXA2ycH1GOXHrSADPvApTkwbhQivuFpz6GHvtwjF3dlD2oWxNnzBgnwGEWEo2mLmr2KxEEk0"}, json={ "question": "How to format code in VS Code?", "collection": "vscode-docs", "results": 5 } ) data = response.json()
Response
200 OK
{
"success": true,
"results": [
{
"answer": "To format your code in VS Code, use the Format Document command (Shift+Alt+F) or configure Format On Save in settings...",
"source": "docs/editor/codebasics.md",
"id": "X1Y2Z3"
},
{
"answer": "VS Code supports automatic formatting through language-specific formatters...",
"source": "docs/languages/javascript.md",
"id": "A4B5C6"
}
]
}
401 Unauthorized
{
"success": false,
"error": "Invalid or missing API key"
}