How many API calls does it take to add document search

Five API calls is all it takes to add document search to any application — create an account, set up a knowledge base, upload documents, wait for processing, and search. No pipeline assembly required.

TL;DR: Five API calls. You sign up and get an API key, create a knowledge base, upload a document, poll until processing completes, and call the search endpoint. Ragex handles parsing, chunking, embedding, and reranking behind those five calls — no pipeline to build.

What are the five API calls?

The full sequence from zero to working document search looks like this:

  1. Create a knowledge basePOST /v1/knowledge-bases with a name. Returns a kb_id.
  2. Upload a documentPOST /v1/knowledge-bases/:kb_id/documents with a file (multipart) or raw text. Returns a doc_id and begins async processing.
  3. Check processing statusGET /v1/knowledge-bases/:kb_id/documents/:doc_id to poll until status is ready. Documents move through pending → parsing → chunking → embedding → ready.
  4. SearchPOST /v1/knowledge-bases/:kb_id/search with a natural language query. Returns ranked chunks with relevance scores.
  5. Use results — Pass the returned text chunks as context to your LLM for grounded answers.

That is the entire integration. You do not select embedding models, configure vector dimensions, or provision a database.

What does the code look like?

Here is the complete flow in Python:

from ragex import RagexClient
import time

client = RagexClient(api_key="YOUR_API_KEY")

# Call 1: Create a knowledge base
kb = client.create_knowledge_base(name="Help Center")

# Call 2: Upload a document
doc = client.upload_document(kb["id"], "faq.pdf")

# Call 3: Poll until ready
while doc["status"] not in ("ready", "failed"):
    time.sleep(2)
    doc = client.get_document(kb["id"], doc["id"])

# Call 4: Search
results = client.search(kb["id"], query="How do I reset my password?", top_k=5)

# Call 5: Use results with your LLM
print(results["results"][0]["text"])

The same flow works in TypeScript with ragex. Method names are identical — createKnowledgeBase, uploadDocument, search.

How long does each call take?

The first four calls are fast. Creating a knowledge base and uploading a document each return in under a second. Processing time depends on the document — a 10-page PDF takes seconds, a 200-page manual takes a minute or two. You can poll or use webhooks to get notified when processing finishes.

Search calls return in milliseconds, even with reranking enabled. Reranking is on by default and improves result quality by re-scoring candidates with a cross-encoder — you do not configure it separately.

What if I need to upload multiple documents?

Each upload is a separate API call, but documents are processed in parallel. You can upload 50 PDFs to the same knowledge base and they all process concurrently. Once any document reaches ready status, it becomes searchable immediately — you do not wait for the entire batch.

Ragex supports 16 file types out of the box. Nine types (PDF, DOCX, PPTX, XLSX, PNG, JPG, WEBP, TIFF, CSV) get advanced parsing that handles tables, images, and complex layouts. Seven types (TXT, MD, HTML, TSV, JSON, and others) are ingested directly as text.

How does this compare to a DIY approach?

Building the same feature from scratch means integrating a document parser, a chunking library, an embedding model, a vector database, and optionally a reranker. That is five separate vendors with five SDKs, each requiring configuration and error handling. The integration typically takes two to four weeks of engineering time.

With Ragex, the same result takes five API calls and an afternoon. Plans start at $29/mo for the Starter tier, with Pro at $79/mo and Scale at $199/mo.

FAQ

Can I skip the polling step?

Yes. You can register a webhook to receive a notification when document processing completes instead of polling the status endpoint. This reduces the integration to four calls — create, upload, wait for webhook, search.

Do I need a separate API key for each knowledge base?

No. One API key works across all your knowledge bases. Each knowledge base is a logical collection of documents scoped to a use case — you can have as many as your plan allows under a single account and API key.

What happens if I upload a file type that is not supported?

The API returns an error at upload time. Check the supported formats before uploading. You can also send raw text directly via the text ingestion endpoint if your content is not in a supported file format.


Last updated: 2026-03-09