Skip to main content

AksonOCR V2 API User Guide

AksonOCR Document AI - OCR Processor​

AksonOCR V2 API provides advanced OCR (Optical Character Recognition) capabilities, powered by our advanced models: AksonOCR-preview, AksonOCR-handwriting, and AksonOCR-1.0. You can extract text and structured content from images and PDF documents with high accuracy and markdown output.

Key Features​

  • Extracts text content while maintaining document structure and hierarchy
  • Preserves formatting like headers, paragraphs, lists, and tables
  • Returns results in markdown format for easy parsing and rendering
  • Handles complex layouts including multi-column text and mixed content
  • Processes documents at scale with high accuracy
  • Confidence scoring for each page and overall document (0-100 scale)
  • Optional token-level confidence scores for granular accuracy assessment
  • Supports multiple document formats:
    • image_url: PNG, JPEG/JPG, WEBP, and more
    • document_url: PDF and images (via URL or base64)
    • Base64-encoded images and PDFs

Endpoints​

1. /api/v2/ocr (URL Upload)​

Protected endpoint for OCR processing. Requires API key authentication.

Features

  • API key authentication required
  • Max 50 pages for PDFs
  • Per-page credit charging (varies by model)
  • API-based rate limiting

Supported Input Formats

  • Image URLs (PNG, JPG, WEBP)
  • Document URLs (PDF or images)
  • Base64-encoded images
  • Base64-encoded PDFs

Credits Costs vary by model (0.5-2 credits per page).

Example Requests

OCR with Image URL (with Token Confidence)

curl -X POST 'https://backend.aksonocr.com/api/v2/ocr' \
-H 'X-API-Key: <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"model": "AksonOCR-preview",
"tokenConfidence": true,
"document": {
"type": "image_url",
"image_url": "https://example.com/receipt.png"
}
}'

OCR with PDF URL

curl -X POST 'https://backend.aksonocr.com/api/v2/ocr' \
-H 'X-API-Key: <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"model": "AksonOCR-preview",
"document": {
"type": "document_url",
"document_url": "https://arxiv.org/pdf/2201.04234.pdf",
"document_name": "research_paper.pdf"
},
"pages": [0, 2, 5]
}'

OCR with Base64 Image

curl -X POST 'https://backend.aksonocr.com/api/v2/ocr' \
-H 'X-API-Key: <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"model": "AksonOCR-preview",
"document": {
"type": "document_url",
"document_url": "data:image/png;base64,iVBORw0KGgoAAAANS..."
}
}'

OCR with Base64 PDF

curl -X POST 'https://backend.aksonocr.com/api/v2/ocr' \
-H 'X-API-Key: <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"model": "AksonOCR-preview",
"document": {
"type": "document_url",
"document_url": "data:application/pdf;base64,JVBERi0xLjQKJeLjz9MK..."
}
}'

Example Response

{
"model": "AksonOCR-preview",
"pages": [
{
"index": 0,
"markdown": "# Invoice\n\n**Invoice Number:** INV-2025-001\n**Date:** 2025-10-29\n...",
"confidence": 92,
"tokens": [
{
"token": "Invoice",
"confidence": 99.9
},
{
"token": "Number",
"confidence": 98.5
}
]
}
],
"confidence": 92,
"usage": {
"pages_processed": 1
}
}

2. /api/v2/upload (File Upload)​

Upload endpoint for images and PDFs. Use this to upload files for OCR processing.

Features

  • Accepts image files (PNG, JPG, WEBP) and PDFs
  • Max file size: 10MB
  • For PDFs, max 50 pages
  • Returns extracted text in markdown format with confidence scores

Example Request (Image Upload with Token Confidence)

curl -X POST 'https://backend.aksonocr.com/api/v2/upload' \
-H 'X-API-Key: <YOUR_API_KEY>' \
-F 'file=@/path/to/image.png' \
-F 'model=AksonOCR-preview' \
-F 'tokenConfidence=true'

Example Request (PDF Upload)

curl -X POST 'https://backend.aksonocr.com/api/v2/upload' \
-H 'X-API-Key: <YOUR_API_KEY>' \
-F 'file=@/path/to/document.pdf' \
-F 'model=AksonOCR-preview'

Example Response

{
"model": "AksonOCR-preview",
"pages": [
{
"index": 0,
"markdown": "# Invoice\n\n**Invoice Number:** INV-2025-001\n**Date:** 2025-10-29\n...",
"confidence": 92
}
],
"confidence": 92,
"usage": {
"pages_processed": 1
}
}

Confidence Scoring​

Each OCR response includes confidence scores to help you assess the reliability of the extracted text.

Response Fields

  • pages[].confidence: Per-page confidence score (0-100)
  • confidence: Overall confidence score (average of all pages)
  • pages[].tokens: (Optional) Array of tokens with individual confidence scores. Include tokenConfidence: true in your request to receive this.

Example Multi-Page Response with Confidence

{
"model": "AksonOCR-preview",
"pages": [
{
"index": 0,
"markdown": "# Page 1 Content\n\nExtracted text from page 1...",
"confidence": 95
},
{
"index": 1,
"markdown": "# Page 2 Content\n\nExtracted text from page 2...",
"confidence": 78
}
],
"confidence": 86,
"usage": {
"pages_processed": 2
}
}

Notes​

  • Make sure your URLs are public and accessible by the API
  • Only use supported formats for best results
  • All results are returned in markdown for easy parsing
  • For any issues, refer to error codes in the response

Error Codes​

  • MODEL_NOT_FOUND: Model parameter is invalid
  • INVALID_INPUT: No file provided or invalid input
  • PDF_CONVERSION_ERROR: Failed to process PDF file
  • INSUFFICIENT_CREDITS: Not enough credits for processing
  • RATE_LIMIT_EXCEEDED: Too many requests
  • PROCESSING_ERROR: Internal server error

For further help, contact support or see the full API documentation.