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

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

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/

For API keys, custom models, demos, 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.