GreenPT Docs

Documents (OCR)

Transform any document into AI-ready structured content with our powerful document processing API.

POST

Transform any document into AI-ready structured content with our powerful document processing API.

The Documents API enables you to extract text, tables, and images from a wide variety of file formats including PDFs, Microsoft Office documents (Word, PowerPoint, Excel), images, and more. Using advanced OCR technology, even scanned documents and images with embedded text can be converted into clean, structured output formats like Markdown, HTML, or JSON. Perfect for building RAG pipelines, document digitization workflows, invoice processing, and any application that needs to understand document content.

Authentication

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

Authorization: Bearer YOUR_API_KEY

Supported file formats

The Documents API accepts a wide range of document and image formats.

CategoryExtensions
Documents.pdf, .docx, .pptx, .xlsx, .csv, .md, .asciidoc, .adoc, .html, .htm, .xhtml
Images.png, .jpg, .jpeg, .tiff, .tif, .bmp, .webp
Special.vtt, .xml, .json

Output formats

Choose one or more output formats for your processed documents.

FormatDescription
mdMarkdown format (default)
jsonStructured JSON with DoclingDocument schema
htmlHTML format
html_split_pageHTML split by page
textPlain text
doctagsDocument tags format

Highlights

  • Wide format support: process PDFs, Office documents, images, and more in a single API.
  • Table extraction: fast or accurate modes for table structure detection.
  • Multiple output formats: get results in Markdown, JSON, HTML, or plain text.

API endpoint

Process documents and images using multipart/form-data.

POST https://api.greenpt.ai/v1/tools/documents/convert/file

Note: This endpoint uses multipart/form-data for file uploads.

Basic example

A simple request to convert a PDF to markdown.

curl -X POST https://api.greenpt.ai/v1/tools/documents/convert/file \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "files=@document.pdf"
import fs from 'node:fs';

const form = new FormData();
form.append(
  'files',
  new Blob([fs.readFileSync('document.pdf')]),
  'document.pdf',
);

const response = await fetch(
  'https://api.greenpt.ai/v1/tools/documents/convert/file',
  {
    method: 'POST',
    headers: {
      Authorization: 'Bearer YOUR_API_KEY',
    },
    body: form,
  },
);

const result = await response.json();
console.log(result);
import requests

url = "https://api.greenpt.ai/v1/tools/documents/convert/file"

headers = {
  "Authorization": "Bearer YOUR_API_KEY"
}

with open("document.pdf", "rb") as f:
  files = {"files": ("document.pdf", f)}
  response = requests.post(url, headers=headers, files=files)

print(response.json())

Advanced example

A more advanced request with OCR and table extraction options.

curl -X POST https://api.greenpt.ai/v1/tools/documents/convert/file \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "files=@document.pdf" \
  -F "to_formats=md" \
  -F "do_ocr=true" \
  -F "table_mode=accurate" \
  -F "do_table_structure=true" \
  -F "include_images=true"
import fs from 'node:fs';

const form = new FormData();
form.append(
  'files',
  new Blob([fs.readFileSync('document.pdf')]),
  'document.pdf',
);
form.append('to_formats', 'md');
form.append('do_ocr', 'true');
form.append('table_mode', 'accurate');
form.append('do_table_structure', 'true');
form.append('include_images', 'true');

const response = await fetch(
  'https://api.greenpt.ai/v1/tools/documents/convert/file',
  {
    method: 'POST',
    headers: {
      Authorization: 'Bearer YOUR_API_KEY',
    },
    body: form,
  },
);

const result = await response.json();
console.log(result);
import requests

url = "https://api.greenpt.ai/v1/tools/documents/convert/file"

headers = {
  "Authorization": "Bearer YOUR_API_KEY"
}

data = {
  "to_formats": "md",
  "do_ocr": "true",
  "table_mode": "accurate",
  "do_table_structure": "true",
  "include_images": "true"
}

with open("document.pdf", "rb") as f:
  files = {"files": ("document.pdf", f)}
  response = requests.post(url, headers=headers, files=files, data=data)

print(response.json())

Parameters

ParameterTypeDefaultDescription
filesbinary[]-Required. Files to process.
to_formatsstring"md"Output format: "md", "json", "html", "html_split_page", "text", "doctags".
do_ocrstring"true"Enable OCR processing for bitmap content.
force_ocrstring"false"Replace existing text with OCR-generated text.
do_table_structurestring"true"Extract table structure.
table_modestring"accurate"Table detection mode: "fast" or "accurate".
include_imagesstring"true"Extract images from the document.

Response format

{
  "document": {
    "filename": "document.pdf",
    "md_content": "# Document Title\n\nExtracted content...",
    "json_content": {
      "schema_name": "DoclingDocument",
      "version": "1.8.0",
      "name": "document.pdf",
      "origin": {
        "mimetype": "application/pdf",
        "filename": "document.pdf"
      },
      "body": { },
      "texts": [ ],
      "tables": [ ],
      "pictures": [ ],
      "pages": { }
    },
    "html_content": "<html>...</html>",
    "text_content": "Plain text content..."
  },
  "status": "completed",
  "errors": [],
  "processing_time": 2.45,
  "timings": {
    "ocr": 1.2,
    "parsing": 0.8,
    "export": 0.45
  }
}

Use cases

  • Document digitization: convert scanned documents and PDFs to searchable text.
  • Data extraction: extract tables from financial reports and spreadsheets.
  • Invoice processing: automate invoice and receipt data extraction.
  • Academic research: process research papers with formulas and citations.
  • Legacy migration: convert old document formats to modern standards.
  • Accessibility: make image-based documents accessible with text extraction.
  • Content indexing: prepare documents for search engine indexing.
  • Translation prep: extract text for translation workflows.

On this page