CardinalCardinal
⌘K
Contact usTry the playground
Cardinal
API Documentation

Getting Started

QuickstartPlayground

Core Functions

Process DocumentOutput Formats

Enterprise

SecurityOn-Premise Setup
Contact usTry the playground
API Reference

Process Document

The process endpoint is the core of Cardinal OCR. Upload documents and receive extracted text, structured data, images, and metadata in your preferred format.

Process Endpoint

POST /v1/process
Process a document and extract text, data, and metadata
POST
https://api.trycardinal.ai/v1/process

Upload a document file and receive processed OCR results with text extraction, structured data, and optional image/metadata extraction.

Content-Type: Use multipart/form-data when uploading files to the process endpoint.

Parameters

Required Parameters
These parameters are required for all requests
file
required

The document file to process. Supports PDF, images, and other document formats.

Optional Parameters
Customize the processing behavior and output format
output_format
optional

Output format for the processed document. Default: json

json
markdown
extract_images
optional

Extract images, charts, and visual elements from the document. Default: false

true
false
include_bounding_boxes
optional

Include precise coordinate data for all text elements. Default: false

true
false
extract_metadata
optional

Extract barcodes, QR codes, and other metadata. Default: false

true
false
extract_signature
optional

Extract detected signatures from the document. Default: false

true
false

Supported File Formats

Document Formats
Text-based document formats
PDF

Supported: PDF (.pdf)
Coming Soon: Excel sheets (.xlsx, .xls) support is currently in development.
Image Formats: JPEG (.jpg, .jpeg), PNG (.png), TIFF (.tif, .tiff)

Response Format

All successful responses return a JSON object with the processed document data, regardless of the chosen output format.

Success Response (200 OK)
Successful document processing response
{
  "status": "success",
  "document_id": "doc_abc123",
  "content": {
    "text": "Extracted text content...",
    "structured_data": {
      // Structured data based on document type
    }
  },
  "metadata": {
    "page_count": 3,
    "processing_time_ms": 2500,
  },
  "images": [
    // Array of extracted images (if extract_images=true)
  ],
  "bounding_boxes": [
    // Array of coordinate data (if include_bounding_boxes=true)
  ],
  "barcodes": [
    // Array of detected barcodes/QR codes (if extract_metadata=true)
  ],
  "signatures": [
    // Array of detected signatures (if extract_signature=true)
  ]
}
Error Response
{
  "error": {
    "code": "invalid_file_format",
    "message": "Unsupported file format",
    "details": {
      "supported_formats": ["pdf", "png", "jpg"]
    }
  }
}
Processing Time
  • • Simple documents: 1-30 seconds (depending on the document size)
  • • Complex documents: 1-2 minutes (depending on the document size)
  • • Large files (50MB): Couple of minutes

Examples

Basic Document Processing
Simple text extraction with JSON output
curl -X POST https://api.trycardinal.ai/v1/process \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@invoice.pdf" \
  -F "output_format=json"
Pro Tip: For documents with charts, diagrams, or barcodes, enable both extract_images=true and extract_metadata=true and extract_signature=true for comprehensive data extraction.
On this page
Process EndpointParametersSupported File FormatsResponse FormatExamples