HackRx Endpoint

The /hackrx-run endpoint processes documents (PDF, DOCX, CSV, Images, etc.) and answers natural language questions using OCR + Hybrid Search + Gemini AI.

Example HackRx Endpoint
A demo of the HackRx Endpoint component in action.

Upload files and ask questions to receive structured answers using advanced document understanding and QA.

POST /hackrx-run
Supported formats:
PDF (.pdf)Text (.txt)CSV (.csv)Excel (.xls, .xlsx)PowerPoint (.ppt, .pptx)Word (.doc, .docx)Email (.eml)HTML (.html)XML (.xml)JSON (.json)Markdown (.md)RTF (.rtf)Images (.jpg, .png, .gif, .svg)Archives (.zip, .rar)

How to add

# Using the HackRx API
BASE_URL="https://hackrx-api.example.com"

# Or run locally
git clone https://github.com/msnabiel/Docura.git
cd hackrx
pip install -r requirements.txt
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
# BASE_URL="http://localhost:9000"

How to use

# Example: Submit documents and questions for QA
curl -X POST "$BASE_URL/hackrx-run" \
  -H "Content-Type: application/json" \
  -d '{
    "documents": ["https://example.com/file1.pdf", "https://example.com/file2.png"],
    "questions": [
      "What medication is prescribed?",
      "What is the dosage frequency?"
    ],
    "search_strategy": "bm25+bge"
  }'

# Expected Success Response:
# {
#   "answers": [
#     "Amoxicillin 500mg is prescribed.",
#     "Take it 3 times a day."
#   ]
# }

📡 Endpoint Details

Method:POST
Path:/hackrx-run
Content-Type:application/json
Parameters:{ documents: string[], questions: string[], search_strategy?: string }

📋 Response Example

{
  "answers": [
    "Amoxicillin 500mg is prescribed.",
    "Take it 3 times a day."
  ]
}
Note: HackRx supports OCR + structured parsing. It works well for scanned prescriptions, research PDFs, slides, spreadsheets, and more.