# Brazil NF-e XML & Tax Reform 2027 (IBS/CBS) — MCP Ready (`translucent_paste/brazil-nfe-xml-tax-reform`) Actor

Parse Brazilian NF-e and NFC-e XML invoices into clean JSON/CSV/Excel tables (items, NCM, CFOP, ICMS, IPI, PIS, COFINS, IBS, CBS) and simulate 2026-2033 Tax Reform (LC 214/2025) cash-flow impact. Built for accounting, ERPs, n8n, and AI Agents (MCP).

- **URL**: https://apify.com/translucent_paste/brazil-nfe-xml-tax-reform.md
- **Developed by:** [Douglas Freitas](https://apify.com/translucent_paste) (community)
- **Categories:** Business, Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 item parseds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Brazil NF-e XML Parser & Tax Reform 2027 (IBS/CBS) Simulator — MCP Ready

Convert Brazilian **NF-e and NFC-e (layout 4.00) XML files** into clean JSON, CSV, or Excel tables — extracting all line items (`NCM`, `CFOP`, `ICMS`, `IPI`, `PIS`, `COFINS`, plus native `IBS`/`CBS`/`IS` tags) and simulating the **Brazilian Tax Reform (LC 214/2025) transition impact from 2026 to 2033**.

Built for **accounting firms, ERPs, B2B pricing teams, n8n/Make automations, and AI Agents (MCP)**.

### Key Features

- **Zero External Dependencies / Sub-Second Execution:** Pure XML parsing in memory — zero proxies, zero storage retention of sensitive tax data.
- **Full Legacy + Dual VAT Extraction:** Extracts emitter/recipient CNPJ, access key (44 digits), NCM, CFOP, ICMS, ICMS-ST, IPI, PIS, COFINS, and native `IBSCBS` / `cClassTrib` tags.
- **2026–2033 Tax Reform Simulator (LC 214/2025):** Simulates the January 2027 extinction of PIS/COFINS and full CBS ("por fora") rollout, plus the 2029–2033 ICMS-to-IBS phase-in, computing exact tax delta and margin-neutral suggested pricing.
- **Flexible Inputs:** Pass public `xmlUrls`, raw `xmlContents` directly via API/MCP, or run with empty input to inspect a built-in synthetic NF-e 4.00 sample.

### Pricing (Pay-per-Event)

- **Actor Start:** `$0.005` per run
- **Parsed Line Item / Invoice:** `$0.002` per output row (`$2.00` per 1,000 rows)

### Disclaimer

Technical simulation tool based on LC 214/2025 transition rules and user-configurable reference rates. Does not replace formal legal/accounting advice or certified fiscal ERP calculations.

# Actor input Schema

## `xmlUrls` (type: `array`):

Public URLs pointing to Brazilian NF-e or NFC-e XML files to download and parse.

## `xmlContents` (type: `array`):

Raw NF-e/NFC-e XML strings to parse directly (ideal for API, n8n, and MCP agent calls without hosting files).

## `simulationYear` (type: `integer`):

Target transition year under LC 214/2025 (2027 = PIS/COFINS replaced by CBS; 2029-2033 = progressive ICMS/ISS to IBS phase-in).

## `cbsFullRatePct` (type: `number`):

Reference CBS rate (%) applied from 2027 onward (default 8.8% or customize to 11.3% / sector-reduced rate).

## `ibsFullRatePct` (type: `number`):

Full IBS reference rate (%) used for progressive 2029-2033 transition simulation (default 17.7%).

## `outputGranularity` (type: `string`):

Return one dataset row per invoice line item ('item') or one summary row per invoice ('invoice').

## `useBuiltInSampleWhenEmpty` (type: `boolean`):

If no xmlUrls or xmlContents are provided, parses a realistic synthetic NF-e 4.00 sample so you can preview the output schema immediately.

## Actor input object example

```json
{
  "xmlUrls": [],
  "xmlContents": [],
  "simulationYear": 2027,
  "cbsFullRatePct": 8.8,
  "ibsFullRatePct": 17.7,
  "outputGranularity": "item",
  "useBuiltInSampleWhenEmpty": true
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `overview` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("translucent_paste/brazil-nfe-xml-tax-reform").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("translucent_paste/brazil-nfe-xml-tax-reform").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call translucent_paste/brazil-nfe-xml-tax-reform --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,translucent_paste/brazil-nfe-xml-tax-reform"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Cp5lajsBgRXCrzC6D/builds/bCykWgbGyg26BPLZ1/openapi.json
