SAGEA LogoDocs & API
Getting Started

Set up document processing

Upload PDFs and scans, extract markdown/JSON with ARVA OCR, then query documents with SAGE models.

  • Process a PDF via POST https://api.sagea.space/v1/ocr/process
  • Get markdown + bounding boxes + confidence
  • Ask questions over the extracted text

Time to complete: ~10 minutes

Prerequisites

  • A SAGEA API key in SAGEA_API_KEY
  • Python 3.9+ and the sagea SDK, or curl
  • A sample PDF (e.g. invoice.pdf)

Step 1: Process a document

import os
import sagea
 
client = sagea.Client(api_key=os.environ["SAGEA_API_KEY"])
 
result = client.ocr.process(
    model="arva-ocr",
    document=open("invoice.pdf", "rb"),
    output_format="markdown",
)
 
print(result.text[:2000])
print(result.pages, result.confidence)

Response shape:

{
  "text": "# Invoice\n\n| Item | Qty | Price |\n...",
  "pages": 2,
  "confidence": 0.992,
  "blocks": [
    { "type": "table", "page": 1, "bbox": [12, 40, 580, 220], "confidence": 0.99 }
  ],
  "model_used": "arva-ocr"
}

Step 2: Query the document

Feed the extracted markdown into chat:

response = client.chat.completions.create(
    model="sage-2-4-actus",
    messages=[
        {"role": "system", "content": "Answer using only the document below."},
        {"role": "user", "content": f"Document:\n{result.text}\n\nQuestion: What is the total amount?"}
    ],
)
print(response.choices[0].message.content)

Verify

  • confidence >= 0.9 on clean scans; check blocks for tables and handwriting regions.
  • Supported inputs: PDF, PNG, JPG, TIFF, WEBP up to 100 MB.
  • Output formats: markdown, json, text.

What's next

On this page