# Brazil Invoice Reconciliation: NF-e/NFS-e XML vs ERP

> Reconcile a folder of Brazilian invoice XMLs (NF-e, NFC-e, NFS-e national, cancellation events) against your ERP or ledger export and get every divergence: not booked, missing XML, wrong amount, cancelled but booked, no authorization, duplicates.

Brazil Invoice Reconciliation: NF-e/NFS-e XML vs ERP is a free AI agent skill on Agensi by Diego Godoi, in Finance & Accounting. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Diego Godoi](https://www.agensi.io/creators/diego-godoi)
- Category: [Finance & Accounting](https://www.agensi.io/skills/finance-accounting)
- Version: 1.0
- Last updated: 2026-11-26
- Security: scan passed (2026-11-26); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/brazil-invoice-reconciliation-nf-e-nfs-e-xml-vs-erp
- Tags: finance, brazil-fiscal, accounting, nfe-reconciliation, python

## About this skill

### Close the month without fiscal surprises

Accountants and finance teams in Brazil spend hours matching invoice XMLs against what was booked in the ERP. This skill does it in one run and explains each divergence.

#### What it checks
| Divergence | Why it matters |
|---|---|
| XML not booked | missing expense or revenue, lost tax credit |
| Booked without XML | no fiscal support for the entry |
| Wrong amount | typing errors, discounts, freight left out |
| Cancelled invoice booked | improper credit, must be reversed |
| XML without SEFAZ authorization | not a valid invoice yet |
| Duplicated booking | double credit risk |
| Outside the period | wrong accrual month |

#### How it works
1. Point the agent to a folder of XMLs and a CSV export of your ERP (key, or CNPJ + number, and amount).
2. A tested Python script reads NF-e/NFC-e (models 55/65), NFS-e Padrão Nacional and NF-e cancellation events, matches by access key (or CNPJ + number) and applies a rounding tolerance.
3. You get an Excel-ready divergence sheet (semicolon, decimal comma), a summary with totals XML × ERP, and the agent explains causes and fixes, drafts supplier requests and groups results as you need.

Runs locally with the Python standard library: your fiscal data never leaves your machine.

## Requires

- Python 3.8+

## Known limitations

Reads NF-e/NFC-e (models 55/65), NFS-e Padrão Nacional and NF-e cancellation events; CT-e and municipal NFS-e layouts are not read. Does not query SEFAZ: include cancellation XMLs to detect cancelled invoices. The ERP export must be CSV.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Brazil Invoice Reconciliation: NF-e/NFS-e XML vs ERP skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### Which ERPs are supported?

Any ERP or accounting system that exports CSV. The agent maps your column names (key, CNPJ, number, amount) before running.

### Does it consult SEFAZ?

No. It checks the files you provide. Include cancellation event XMLs to detect cancelled invoices, or check doubtful keys on the SEFAZ portal.

### Does it handle NFS-e?

Yes, the national standard (Padrão Nacional). Municipal layouts that differ from it are not read.

### Is my fiscal data sent anywhere?

The script runs locally with the Python standard library and makes no network calls. Your agent reads the results to explain them.

### How many XMLs can it handle?

Thousands per run; it reads the folder recursively and skips files that are not invoices, listing them separately.

### Does it work in English?

Yes. It answers in the language you write in; report column names stay in Portuguese, as accountants in Brazil expect.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
