API Documentation

Everything you need to integrate BharatOCR into your application.

Authentication

All API requests require an API key passed via the X-Api-Key header. Get your API key from the dashboard.

X-Api-Key: boc_your_api_key_here

Endpoints

POST/api/v1/ocr

Extract text from an image or PDF

Auth: X-Api-Key header

Body: multipart/form-data with 'file' field

Response: OCRResponse with pages, words, lines, and metadata

POST/api/v1/ocr/table

Extract tables from a document

Auth: X-Api-Key header

Body: multipart/form-data with 'file' field

Response: OCRResponse with table data in pages[].tables

GET/api/v1/usage

Get current usage and quota

Auth: X-Api-Key header

Body: None

Response: UsageResponse with tier, pages_used, pages_remaining

GET/api/v1/health

Check API health status

Auth: None

Body: None

Response: Health status of all services

Response Format

{
  "pages": [{
    "page_number": 1,
    "text": "full extracted text here",
    "words": [{
      "text": "word",
      "confidence": 0.98,
      "bbox": [x1, y1, x2, y2]
    }],
    "lines": [{
      "text": "line text",
      "confidence": 0.95
    }],
    "tables": [{
      "rows": [["cell1", "cell2"], ["cell3", "cell4"]],
      "confidence": 0.92
    }],
    "language": "hi"
  }],
  "metadata": {
    "processing_time_ms": 450,
    "page_count": 1,
    "file_type": "pdf"
  }
}

Code Examples

curl -X POST https://api.bharatocr.com/api/v1/ocr \
  -H "X-Api-Key: boc_your_api_key_here" \
  -F "[email protected]"

Supported File Types

JPEGPNGTIFFBMPPDF

Max file size: 10MB. Max pages per PDF: 50.

Rate Limits

Default: 60 requests per minute per API key. Contact us for higher limits on Pro and Enterprise plans.

Ready to start?

Create your free API key and start extracting text in minutes.