API Documentation

Integrate FreeOCR.AI into your applications with our powerful API.

Authentication

All API requests require an API key passed in the Authorization header as a Bearer token.

Authorization: Bearer focr_your_api_key_id

Create and manage your API keys in the API Keys page.


Rate Limits

Default rate limit: 200 requests per minute per API key.

Rate limits can be adjusted per key. Contact support for custom limits.


POST /ocr

Live demo

Extract text from images with layout preservation.

Parameters

multipartimage(required) - Image file
queryformat(optional) - Response format: json (default), text, docx
queryversion(optional) - Model version: 261029 (default), 260428

Response

jsonContent-Type: application/json
{
  "text": "# Document Title\n\nExtracted markdown content..."
}

Returns GitHub Flavored Markdown with layout preservation, including HTML tables and LaTeX formulas.

textContent-Type: application/json
{
  "text": "Document Title\n\nExtracted plain text content..."
}

Markdown is stripped to plain text via internal conversion.

docxContent-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document

Binary file download. Content-Disposition: attachment; filename="result.docx"

Example

Format:
curl -X POST "https://freeocr.ai/api/v1/platform/ocr" \
  -H "Authorization: Bearer focr_your_key" \
  -F "image=@document.png"

POST /table

Live demo

Extract tables from images into structured data.

Parameters

multipartimage(required) - Image file
queryformat(optional) - Response format: json (default), csv, xlsx
queryversion(optional) - Model version: 261029 (default), 260428

Response

jsonContent-Type: application/json
{
  "tables": [
    {
      "title": "Sales Report",
      "html": "<table><tr><th>Item</th><th>Qty</th></tr><tr><td>Apple</td><td>10</td></tr></table>"
    }
  ]
}

Each table includes a title and its content as an HTML table string.

csvContent-Type: text/csv; charset=utf-8

Plain-text CSV download. Multiple tables are separated by --- SheetName --- delimiters. Content-Disposition: attachment; filename="tables.csv"

xlsxContent-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

Binary XLSX file download. Each table becomes a separate sheet named after its title. Content-Disposition: attachment; filename="tables.xlsx"

Example

Format:
curl -X POST "https://freeocr.ai/api/v1/platform/table" \
  -H "Authorization: Bearer focr_your_key" \
  -F "image=@spreadsheet.png"

POST /extract

Live demo

Extract specific fields from images using AI.

Parameters

multipartimage(required) - Image file
queryfields(required) - Fields to extract (repeat or JSON array)
queryformat(optional) - Response format: json (default), csv, xlsx
queryversion(optional) - Model version: 261029 (default), 260428

Response

jsonContent-Type: application/json
{
  "result": [
    { "key": "name", "values": ["John Doe"] },
    { "key": "date", "values": ["2024-03-15"] },
    { "key": "amount", "values": ["$1,234.56"] }
  ]
}

Each requested field is returned as a key with an array of extracted values.

csvContent-Type: text/csv; charset=utf-8

CSV file with field keys as column headers and extracted values as rows. Content-Disposition: attachment; filename="extraction.csv"

xlsxContent-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

XLSX file with a single "Results" sheet, same layout as CSV. Content-Disposition: attachment; filename="extraction.xlsx"

Example

Format:
curl -X POST "https://freeocr.ai/api/v1/platform/extract?fields=name&fields=date&fields=amount" \
  -H "Authorization: Bearer focr_your_key" \
  -F "image=@invoice.png"

Error Responses

401

Unauthorized

{ "error": { "code": "unauthorized", "message": "Invalid API key" } }
402

Insufficient Balance

{ "error": { "code": "insufficient_credits", "message": "Insufficient balance. Please top up." } }
429

Rate Limit Exceeded

{ "error": { "code": "rate_limit_exceeded", "message": "Rate limit exceeded. Try again later." } }
500

Internal Error

{ "error": { "code": "internal_error", "message": "Failed to process image" } }