API Reference

Complete documentation for the DocuProx API including endpoints, authentication, and code examples to help you integrate document extraction into your applications.

API Overview

The DocuProx Process API is the core document processing service that extracts structured data from images using predefined templates. It supports both reference-based and reference-free processing modes for various document types.

Core Endpoint

POST /process

The primary endpoint for document processing that accepts images and returns extracted structured data based on your templates.

Template Definition Mode

With Reference Mode

Ideal for standard document formats with consistent layouts. Uses a reference image from your template to guide extraction through label-value pair identification.

VALUE Identifies target data using actual values from reference document
RECTANGLE Defines bounded regions for precise data extraction

Without Reference Mode

Perfect for variable document layouts and multi-page PDFs. Processes documents directly without requiring a reference image, offering flexible extraction capabilities.

FLEXIBLE Adapts to varying document structures and layouts
MULTI-PAGE Supports complex PDF documents with multiple pages

Supported Formats

Images

  • • JPEG
  • • PNG
  • • GIF, BMP, TIFF

Documents

  • • PDF (single page)
  • • PDF (multi-page)

Input Methods

  • • Base64 encoded
  • • File uploads
  • • Data URLs

Rate Limiting

The API includes configurable rate limiting with a 60-second window.

  • • Default limits apply per API key
  • • Contact support for enterprise limits
  • • Rate limit headers included in responses

Process API

The /process endpoint is the core service for document processing. It accepts images and returns extracted structured data based on your templates.

Endpoint Details

Method

POST

URL

/process

Content Types

  • • application/json
  • • multipart/form-data

Required Parameters

These parameters are sent in the request body using either JSON or form data format:

Parameter Type Description
actual_image string/file Base64-encoded image or file upload
template_id string UUID of the template to use

Option 1: JSON Request Example

{
  "actual_image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD...",
  "template_id": "123e4567-e89b-12d3-a456-426614174000"
}

Option 2: Form Data Request

  • actual_image: Image file upload
  • template_id: Template UUID as form field

Authentication Headers

Option Header Type Description
Option 1 x-auth string Authentication token required for API access
Option 2 Authorization string Bearer token format: Bearer <API_KEY>

Template Requirements

Before processing, ensure your template meets these requirements:

Required Fields

  • • Template status: active
  • • Active current version
  • • Valid document_type

Optional Fields

  • • reference_image (for reference mode)
  • • edited_json (extraction structure)
  • • custom_instructions

Code Examples

Complete code examples for integrating the Process API in popular programming languages.

JavaScript / Node.js

const response = await fetch('/process', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-auth': 'dp-123-your-api-key'
  },
  body: JSON.stringify({
    actual_image: 'data:image/jpeg;base64,...',
    template_id: '123e4567-e89b-12d3'
  })
});
const result = await response.json();
console.log(result.document_data);

Python

import requests
import base64
# Read and encode image
with open('document.jpg', 'rb') as f:
    image_data = base64.b64encode(f.read()).decode()
response = requests.post('/process', 
  headers={
    'Content-Type': 'application/json',
    'x-auth': 'dp-123-your-api-key'
  },
  json={
    'actual_image': f'data:image/jpeg;base64,{image_data}',
    'template_id': '123e4567-e89b-12d3'
  }
)
result = response.json()
print(result['document_data'])

cURL Examples

JSON Request

curl -X POST https://api.docuprox.com/process \
  -H "Content-Type: application/json" \
  -H "x-auth: dp-123-your-api-key" \
  -d '{
    "actual_image": "data:image/jpeg;base64,/9j/4AAQ...",
    "template_id": "123e4567-e89b-12d3-a456-426614174000"
  }'

Form Data Request

curl -X POST https://api.docuprox.com/process \
  -H "x-auth: dp-123-your-api-key" \
  -F "actual_image=@/path/to/document.jpg" \
  -F "template_id=123e4567-e89b-12d3-a456-426614174000"

Best Practices

  • Error Handling: Always check response status
  • Retry Logic: Implement exponential backoff
  • Rate Limiting: Respect API limits
  • Image Optimization: Compress images appropriately
  • Template Testing: Test thoroughly before production
  • Monitoring: Track API usage and performance