Quickstart: Knowledge
Ask a question and get a ground-truth answer straight from your documentation - no answer is generated, so there is nothing to hallucinate. This walkthrough takes about five minutes end to end.
Get your API key
Knowledge uses a single shared key during Developer Preview. Grab the rgx_knowledge_demo_ key from the Knowledge page - no sign-up required to try it.
That demo key is scoped to one project, vscode-docs, so every example below searches the VS Code documentation set.
Make your first call
Send a POST request to /v1/knowledge/search. Put your questions in the queries array, the project name in project, and your key in the X-API-Key header.
import requests response = requests.post( "https://api.ragionex.com/v1/knowledge/search", headers={"X-API-Key": "rgx_knowledge_demo_geXuBZJ5O2GltcG63s1LGijGBwlERGlo"}, json={ "queries": ["How do I format code in VS Code?"], "project": "vscode-docs", "results": 5 } ) data = response.json() for r in data["results"]: print(r["answer"], "-", r["source"])
const res = await fetch("https://api.ragionex.com/v1/knowledge/search", { method: "POST", headers: { "Content-Type": "application/json", "X-API-Key": "rgx_knowledge_demo_geXuBZJ5O2GltcG63s1LGijGBwlERGlo" }, body: JSON.stringify({ queries: ["How do I format code in VS Code?"], project: "vscode-docs", results: 5 }) }); const data = await res.json();
curl -X POST https://api.ragionex.com/v1/knowledge/search \ -H "Content-Type: application/json" \ -H "X-API-Key: rgx_knowledge_demo_geXuBZJ5O2GltcG63s1LGijGBwlERGlo" \ -d '{ "queries": ["How do I format code in VS Code?"], "project": "vscode-docs", "results": 5 }'
The request body has three fields:
queries(required) - an array of 1-5 natural-language questions, each 1-128 characters. One question = a one-element array; add more items to search several angles in a single call.project(required) - the documentation set to search. Usevscode-docswith the demo key.results(optional) - how many results to return, 1-50. Defaults to 10.
Read the result
You get back the answer as ground truth - the prepared documentation answer, not a generated guess. Each result carries the answer text, the source file it came from, and a stable id you can log.
{
"success": true,
"results": [
{
"answer": "To format your code in VS Code, use the Format Document command (Shift+Alt+F) or enable Format On Save in settings...",
"source": "docs/editor/codebasics.md",
"id": "X1Y2Z3"
}
]
} Because the answer is prepared content rather than generated text, you can hand it straight to your own AI as trusted context, cite the source, or show it to the user as-is.
Ask the way you would in a chat - full natural questions work far better than loose keywords. See How to ask: Knowledge query best practices for the four rules that get the sharpest answers.
New to the model? Read What is a Context Engine and Knowledge vs Memory. Ready for every parameter and error case? Jump to the full Knowledge API reference.