RAG API for developers: search documents from any application
Published on 2026-11-16 by ArduBot
What a retrieval API should return, how to separate retrieval and generation, design permissions, pagination, traces, and tests.
You want to add smart search to a website, a bot, or an automation, but you don't want to rebuild an indexing engine in every project. A RAG API can serve as a common layer: it receives a question, finds relevant evidence, and returns results that another application uses.
Retrieval API is not the same as a chatbot
A retrieval API returns information: fragments, documents, metadata, and references. A chatbot additionally interprets the conversation, decides what to query, calls the model, and drafts the final message. Separating both responsibilities allows changing the model without redoing the document base.
For example, the same manuals index can feed a support chat, an internal search engine, and a WhatsApp agent. Each interface will have different tone and rules, but should start from the same authorized documents.
What the service would request and return
A query needs a text, an authorized database identifier, and optional filters such as language, product, or date. An illustrative format:
POST /v1/knowledge-bases/{id}/search
Authorization: Bearer <token>
Content-Type: application/json {"query":"¿Cómo reiniciar el equipo X?","top_k":4,"filters":{"product":"X"}} The response should contain results with document_id, chunk_id, text, source_url, page if it exists, updated_at, and a score whose meaning is documented. It is also advisable to include request_id to track failures without indiscriminately recording sensitive data.
These endpoints are design examples, not an API we claim to be available today at ArduMaker.
Decisions that affect quality
Filters before search: authorization must limit the set of accessible documents; it is not enough to hide results at the end.
Hybrid search when it adds value: embeddings can find synonyms, while lexical queries help with part numbers, codes, and exact names.
Verifiable citations: save the location of each fragment. A generic reference to the PDF name does not prove that the answer is on a specific page.
Predictable limits: define maximum payload sizes, quotas, timeouts, and error policy. The client must be able to distinguish “no matches” from “service unavailable”.
Separate search and generation
The /search endpoint must work even if the LLM provider is down. A hypothetical second endpoint, /answer, could generate a response with citations from the results, with an explicit token limit and a confidence indicator based on evidence, not on the model's self-perception.
This design also allows using ArduMaker's AI Router to choose the model at another layer, keeping retrieval independent.
Tests I would run before launching
Create a versioned battery of 50 queries with their expected sources. Measure recall@k of the search, queries without results, p50/p95 latency, and cost per thousand queries. Add cross-company access attempts: a credential from Company A must not be able to get an appointment from Company B, neither through manipulated filters nor through a document shared by mistake.
Is there a commercial need?
The useful signal is not how many people read "what is RAG", but how many teams request a retrieval API without setting up embeddings, indexers, and storage on their own. At ArduMaker we are studying that possibility as a managed service; it is not yet a published RAG API. You can describe your use case at ArduMaker.
References: RAG and sources in Microsoft Foundry · Retrieve in Amazon Bedrock · AI Router.