cd /news/artificial-intelligence/extracting-structured-data-from-invo… · home topics artificial-intelligence article
[ARTICLE · art-73599] src=dev.to ↗ pub= topic=artificial-intelligence verified=true sentiment=↑ positive

Extracting structured data from invoices and contracts with one API call

Mediavox released a document analysis API that extracts structured data from invoices, contracts, and receipts in a single call, supporting Spanish and Portuguese. The multimodal AI endpoint handles scanned PDFs, Word files, and phone photos, returning entities like vendor name, tax ID, and totals with confidence scores. A session feature allows follow-up questions without re-uploading, and an integrity check automatically verifies arithmetic consistency.

read2 min views1 publishedJul 25, 2026

I've been working on a document analysis API and wanted to share a pattern that saved me from writing custom parsers for every document type my clients throw at me.

If you work with LATAM businesses, you know the pain: invoices in PDF (sometimes scanned), contracts in Word, receipts as phone photos. Every client has a different format. Building regex parsers for each one is a nightmare that breaks every time the layout changes slightly.

Instead of building N parsers, I use a single multimodal AI endpoint that:

import requests

with open("invoice.pdf", "rb") as f:
    response = requests.post(
        "https://mediavox.co/mvai/api/v1/documents/analyze",
        files={"file": f},
        data={
            "api_key": "your_key_here",
            "question": "Extract: vendor name, tax ID, invoice number, date, line items with quantities and prices, subtotal, tax, total."
        },
        timeout=60
    )

result = response.json()

print(result["answer"])       # Human-readable summary
print(result["entities"])     # Structured: [{type: "vendor", value: "..."}]
print(result["document_type"]) # "factura", "contrato", "recibo"...
print(result["session_id"])   # For follow-up questions

The session persists the document context, so you can ask clarifying questions without re-up:

follow_up = requests.post(
    "https://mediavox.co/mvai/api/v1/chat",
    json={
        "api_key": "your_key_here",
        "question": "What are the payment terms?",
        "session_id": result["session_id"]
    }
)

print(follow_up.json()["answer"])

The AI answers from the document only — no hallucinations from external knowledge.

Input: a crumpled photo of a Colombian restaurant receipt (low light, tilted)

{
  "document_type": "recibo",
  "entities": [
    {"type": "vendor", "value": "Restaurante El Portal", "confidence": 0.94},
    {"type": "tax_id", "value": "901234567-8", "confidence": 0.91},
    {"type": "total", "value": "98700", "confidence": 0.97},
    {"type": "tax", "value": "15800", "confidence": 0.89},
    {"type": "date", "value": "2026-06-28", "confidence": 0.95}
  ],
  "integrity": {
    "subtotal_matches_items": true,
    "tax_calculation_correct": true
  }
}

The integrity

check catches arithmetic mismatches automatically — useful for expense auditing.

If you use n8n, there's a community node (n8n-nodes-mediavox

) that wraps all of this. Or use HTTP Request nodes directly — the API is straightforward REST.

I published a ready-to-use workflow template: Extract invoice details and ask follow-ups — import it and replace the file path.

Free tier: 100 requests/month. Enough to test with real documents.

n8n-nodes-mediavox

on npmBuilt this for LATAM businesses dealing with messy paperwork. If you're processing documents in Spanish/Portuguese and tired of custom parsers, this might save you time.

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @mediavox 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/extracting-structure…] indexed:0 read:2min 2026-07-25 ·