E-Invoice Extractor — usage

Subscribe in AWS Marketplace, select the package ARN for your region, and deploy it in your own SageMaker account using ml.c5.2xlarge. The notebook contains original synthetic XML and links to a fictional scanned PDF; it needs no private repository. Start with synthetic or lawfully supplied records.

Software is USD 0.50 per instance-hour with a 14-day software trial for eligible buyers. AWS resources are charged separately, including during the trial. Stopping a notebook does not stop a deployed endpoint. Use the notebook's ownership-checked cleanup when finished.

Request

POST raw application/xml, raw application/pdf, or JSON to /invocations:

{"document_base64":"CANONICAL_BASE64_BYTES","content_type":"application/pdf","country_hint":"MX"}

country_hint is optional and accepts MX or BR; contradictions reject. Strict canonical base64 is required. XML may also be a UTF-8 string. application/jsonlines accepts one record per line; JSON instances preserves input order and per-record errors. A successful batch HTTP response can contain rejected records, so inspect every result.

Limits: XML 1 MiB, PDF 4 MiB, HTTP body 6 MiB, at most 16 records and two PDFs per request, and three PDF pages. Only one PDF worker is active at a time. Queue PDF requests or retry the fixed pdf_busy error with bounded caller backoff. No server-side retry invents a result.

Response and review

The JSON schema describes canonical fields, explicit nulls, decimal strings, source tax paths and provenance. XML decimals preserve source precision; supported PDF separators are normalized without inventing a balancing amount. Convert strings with a decimal type, not binary floats.

Compare every PDF field against its source, especially identifiers and amounts. High recognition confidence and complete-looking output do not authenticate a taxpayer or invoice. Unknown, unreadable or conflicting values remain missing; unreadable rows may be omitted with review reasons.

Format boundaries

CFDI 3.3/4.0 I/E XML supports selected headers, concepts, transfer/withholding paths and optional Timbre Fiscal Digital 1.1 UUID. Legacy NF-e 4.00 model 55 supports selected headers, parties, products, ICMSTot and legacy tax paths; its absent currency tag remains null. New IBS/CBS/IS groups and unfamiliar totals/tax families reject.

National NFS-e is limited to provider-issued version 1.01 with embedded DPS and reviewed monetary/party/tax fields. Standalone DPS, municipal ABRASF/provider variants, other emitters and reform groups are unsupported. Complete XSD conformance, signatures and fiscal acceptance are not verified.

PDF supports bounded printed CFDI/DANFE labels and single-line table rows. Text pages use geometry; image pages use local OCR. Embedded XML, metadata and barcodes do not supply predictions. Handwriting, universal layouts, multiline/merged tables and arbitrary rotation are outside this preview. Encrypted PDFs, attachments, actions/forms, excessive expansion and resource-limit violations reject.

Errors, batch and privacy

Single unsupported inputs return HTTP 415; invalid/resource-limited documents return 400. Batches return ordered per-record errors. Examples: pdf_busy, pdf_page_limit, pdf_expansion_limit, pdf_time_limit, unsupported_pdf_active_content, ocr_artifact_unavailable and unsupported_or_ambiguous_pdf_layout. Fix malformed inputs rather than retrying them indefinitely.

Batch Transform: SingleRecord, MaxConcurrentTransforms=1, MaxPayloadInMB=6, JSON Lines input/output with Line splitting/assembly. Keep input and output in private S3 storage authorized to your execution role. No external OCR service, taxpayer lookup or request-time model download is used. Secure responses and do not send taxpayer documents in public issues or support email.

See the model card for measured errors and sources for licenses and official-reference limits.