NextOCR API

A Vision-First OCR system designed to support old metal-type printed books (such as Khmer Tripitaka Buddhist editions and Kampuja Surya magazine), historical typewritten texts, traditional Khmer typewriter outputs, and diverse multilingual documents.

1. Getting Access

Authentication requires a username and secret key.
Credentials are managed securely (currently via internal users.csv).
To get your personal access key, please contact:

Email: danhhong@gmail.com
Pricing: $12 / month — up to 10,000 requests.
Need more requests? Please contact danhhong@gmail.com.

2. Endpoint

URL:

https://developer.nextocr.org/ocr_api

Method: POST

Content-Type: multipart/form-data

Authentication (choose ONE method):
  • Recommended: HTTP Headers
    X-Username: your_username
    X-Secret-Key: your_secret_key
  • Query parameters
    ?username=your_username&key=your_secret_key
  • Form fields
    username=your_username
    key=your_secret_key (in multipart/form-data)
Optional query parameters:
  • mode=events → returns real-time NDJSON event stream
  • line_weights=... → custom line detection weights
  • segm_weights=... → custom character segmentation weights
  • device=cpu or cuda (GPU if available)

Bank Receipt API

NextOCR also provides a specialized API for converting mobile banking receipt images into structured JSON data. This is useful for fintech applications, accounting systems, payment verification, and ERP integrations.

Typical pipeline:
Receipt Image → NextOCR → Structured JSON → Accounting / Core Banking / SAP

Endpoint:

https://developer.nextocr.org/ocr_api_receipt

Example request:

curl -X POST \
          -H "X-Username: your_username" \
          -H "X-Secret-Key: your_secret_key" \
          -F "file=@receipt.jpg" \
          "https://developer.nextocr.org/ocr_api_receipt"

For the complete documentation, response format, and live demo:

View Bank Receipt API Tutorial

PDF to Text Tutorial

Need to convert an entire PDF document (scanned books, historical Khmer texts, multi-page reports) into plain text? We provide a ready-to-use Python script that converts every page of a PDF and saves the full result to a single text file.

Pipeline:
PDF → page images → NextOCR API → merged text file (output.txt)

Usage:

python3 nextocr_pdf2text.py 'your_username' 'your_secret_key' 'file.pdf' 'output.txt'

For the full script, installation requirements, and step-by-step instructions:

View PDF to Text Tutorial

3. cURL Examples

Default mode – full extracted text in JSON:

curl -X POST \
  -H "X-Username: your_username" \
  -H "X-Secret-Key: your_secret_key" \
  -F "file=@sample.jpg" \
  "https://developer.nextocr.org/ocr_api"

Events mode – real-time streaming progress (NDJSON):

curl -X POST \
  -H "X-Username: your_username" \
  -H "X-Secret-Key: your_secret_key" \
  -F "file=@sample.jpg" \
  "https://developer.nextocr.org/ocr_api?mode=events"

4. Try it in your browser

Powered by NextOCR — vision-first OCR with continual learning
Developer portal: developer.nextocr.org/

Pricing: $12/month · up to 20,000 requests/month.
Need a higher limit? Contact us for custom plans.

For API keys, custom models, demos, higher request limits, or support:
danhhong@gmail.com


Python Client Library

The official Python client makes it easy to integrate NextOCR into your scripts or applications.

Installation (via PyPI):

pip install nextocr-python

For the very latest development version (optional):

pip install git+https://github.com/danhhong/nextocr-python.git

Basic usage example:

from nextocr import NextOCRClient

client = NextOCRClient(
    username="your_username",
    secretkey="your_secret_key"
)

# Perform OCR - returns the full extracted text
text = client.ocr_image("sample.jpg")
print(text)

# Streaming mode (real-time progress/events)
for event in client.ocr_image_events("sample.jpg"):
    print(event)  # progress updates, detected lines, final result, etc.
      

After installation, import and use the client as shown above. Make sure to replace the placeholders with your real credentials.
For full documentation and advanced usage, visit the developer portal.