📊

Sage ERP Integration — OCR Document Extraction

Automate invoice data entry in Sage ERP using Cargoffer OCR API.

Overview

Sage 200, Sage X3, and Sage Intacct can all benefit from Cargoffer OCR. A lightweight middleware connects Sage's document inbox to the OCR API.

Python Middleware

python
import requests, json

API_KEY = "ocr_your_api_key"
OCR_URL = "https://ocr.cargoffer.com"

def process_sage_invoice(pdf_path):
    # Upload
    r = requests.post(f"{OCR_URL}/api/upload",
        headers={"Authorization": f"Bearer {API_KEY}"},
        files={"file": open(pdf_path, "rb")})
    job = r.json()["job"]

    # Analyze
    r = requests.post(f"{OCR_URL}/api/analyze/{job}",
        headers={"Authorization": f"Bearer {API_KEY}"})
    result = r.json()

    # Map to Sage fields
    for mid, data in result.get("results", {}).items():
        return {
            "supplier": data.get("provider"),
            "invoice_ref": data.get("invoice_number"),
            "net": data.get("totals", {}).get("total_base"),
            "tax": data.get("totals", {}).get("total_iva"),
            "gross": data.get("totals", {}).get("total"),
            "date": data.get("issue_date"),
        }

Ready to try it?

Start Free →