Machine translation, not yet reviewed.
RTC/Gov calculator
Exposes the government's RTC Calculator (Reforma Tributária sobre o Consumo — IBS, CBS and IS) to external customers, through an integration application that talks to the…
✅ Available in development and UAT. Production is still pending the pre-production security review (DFE-2796, in progress) and the cut of the
release-proxy-vX.Y.Ztag.
Exposes the government's RTC Calculator (Reforma Tributária sobre o Consumo, the Brazilian consumption tax reform — IBS, CBS and IS) to external customers, through an integration application that talks to the official calculator. The calculation is passed through byte for byte; the service adds authentication, product control, caching and limits.
Base URL
| Environment | URL |
|---|---|
| Development | https://<API_HOST> |
| UAT (sandbox) | https://<API_HOST> |
| Production | (to be confirmed — depends on DFE-2796 + tag release-proxy-v*) 🔜 |
| Production (whitelabel) | https://<API_HOST> (to be confirmed) 🔜 |
API Reference
Full interactive reference (Scalar): API reference.
Authentication
OAuth2 JWT token obtained via client_credentials (application token), in the Authorization: Bearer {token} header. See Authentication and Authorization.
Access requirements, in addition to a valid token:
- Realm role
RTC_INTEGRATION_APIgranted to the client. - RTC Calculator product enabled for the customer.
- The customer is resolved from the token's
customer-idclaim — do not send theX-Customer-IDheader. - The
companyIdin the body must belong to the authenticated customer.
Content-type: application/vnd.materimperium.api.v1+json (standard envelope — see REST APIs).
Endpoints
Prefix: /api/integration/dfe/rtc/calculadora. The {model} path variable is 55 (NF-e) or 65 (NFC-e).
POST /{model}/regime-geral
Calculates the RTC taxes (general regime) for a set of items.
Interactive reference: API reference
POST/api/integration/dfe/rtc/calculadora/{model}/regime-geralSign in to see the host and referenceQuery params
| Parameter | Required | Default | Description |
|---|---|---|---|
versao | no | latest | Calculator version. Outside the whitelist → 400 INVALID_CALCULATOR_VERSION (the accepted list is included in the message). Currently only latest is deployed in all three environments. |
Body (request)
| Field | Type | Required | Description |
|---|---|---|---|
companyId | UUID | yes | Company that provides the context for the call; must belong to the customer. |
dataHoraEmissao | ISO offset date-time | no | Default: now (America/Sao_Paulo time zone). |
municipio | integer (7 digits) | yes | IBGE code of the municipality of the IBS taxable event. |
uf | string (2 uppercase) | yes | Issuer's UF (state). |
itens[] | list (1..990) | yes | Items to calculate. |
itens[].numero | integer | yes | Sequential item number. |
itens[].ncm | string | yes | Product NCM. |
itens[].cst | string | no | IBS/CBS CST. |
itens[].baseCalculo | decimal | yes | Item calculation base. |
itens[].quantidade | decimal | no | Commercial quantity. |
itens[].unidade | string | no | Commercial unit. |
itens[].cClassTrib | string | no | Tax classification code. |
itens[].tributacaoRegular | object | no | { cst, cClassTrib } — taxation the item would have under the regular regime. If sent, both fields are required. |
⚠️ Although cst and cClassTrib are marked as optional in the schema, the government calculator currently rejects (400 TAX_CALCULATION_ERROR) requests without both filled in. Always send both.
Response 200 — standard envelope with data:
| Field | Description |
|---|---|
versaoApp | Calculator application version. |
versaoDb | Version of the rates/rules database. |
descricaoVersaoDb | Database description. |
dataVersaoDb | Database date. |
ambiente | Calculator environment. |
calculo | Byte-for-byte pass-through of the government Calculator's response. The schema belongs to the government and preserves the original numeric representation (e.g., 1000.00 stays 1000.00). It currently contains objetos[] with tribCalc.IBSCBS per item (including memoriaCalculo, a text explaining the legal framework) and a total.tribCalc.IBSCBSTot with the aggregates — treat it as an opaque object: the full schema belongs to the government and may change without notice from this API. |
Example (request):
POST /api/integration/dfe/rtc/calculadora/55/regime-geral?versao=latest
Content-Type: application/json
Authorization: Bearer $TOKEN
{
"companyId": "6f1c1a3e-2d5b-4f0a-9c0d-8b4f2a1c9e77",
"dataHoraEmissao": "2026-05-10T08:15:30-03:00",
"municipio": 3550308,
"uf": "SP",
"itens": [
{
"numero": 1,
"ncm": "84713012",
"cst": "000",
"baseCalculo": 1000.00,
"quantidade": 1.0,
"unidade": "UN",
"cClassTrib": "000001"
}
]
}
Example (response), with calculo captured live:
{
"code": "0",
"message": "",
"success": true,
"data": {
"versaoApp": "1.0.18",
"versaoDb": "v0041",
"descricaoVersaoDb": "Base de alíquotas 2026",
"dataVersaoDb": "2026-01-15",
"ambiente": "PRODUCAO",
"calculo": {
"objetos": [
{
"nObj": 1,
"tribCalc": {
"IBSCBS": {
"CST": "000",
"cClassTrib": "000001",
"gIBSCBS": {
"vBC": "1000.00",
"gIBSUF": { "pIBSUF": "0.10", "vIBSUF": "1.00", "memoriaCalculo": "Operação de consumo com enquadramento legal em LC 214/2025, tributada conforme Tributação integral. A base de cálculo utilizada é de R$ 1000.00000000, com alíquota de 0.100000%." },
"gIBSMun": { "pIBSMun": "0.00", "vIBSMun": "0.00", "memoriaCalculo": "Operação de consumo com enquadramento legal em LC 214/2025, tributada conforme Tributação integral. A base de cálculo utilizada é de R$ 1000.00000000, com alíquota de 0.000000%." },
"vIBS": "1.00",
"gCBS": { "pCBS": "0.90", "vCBS": "9.00", "memoriaCalculo": "Operação de consumo com enquadramento legal em LC 214/2025, tributada conforme Tributação integral. A base de cálculo utilizada é de R$ 1000.00000000, com alíquota de 0.900000%." }
}
}
}
}
],
"total": {
"tribCalc": {
"IBSCBSTot": {
"vBCIBSCBS": "1000.00",
"gIBS": {
"gIBSUF": { "vDif": "0.00", "vDevTrib": "0.00", "vIBSUF": "1.00" },
"gIBSMun": { "vDif": "0.00", "vDevTrib": "0.00", "vIBSMun": "0.00" },
"vIBS": "1.00",
"vCredPres": "0.00",
"vCredPresCondSus": "0.00"
},
"gCBS": { "vDif": "0.00", "vDevTrib": "0.00", "vCBS": "9.00", "vCredPres": "0.00", "vCredPresCondSus": "0.00" },
"gMono": { "vIBSMono": "0.00", "vCBSMono": "0.00", "vIBSMonoReten": "0.00", "vCBSMonoReten": "0.00", "vIBSMonoRet": "0.00", "vCBSMonoRet": "0.00" }
}
}
}
}
}
}
The IBS/CBS rates in the example above (0.10% / 0.90%) reflect the 2026 test period of the Brazilian tax reform (LC 214/2025) — they are not the full reference rates, which increase gradually until 2033.
GET /{model}/versao
Returns the current calculator version (served from cache). Same authentication, same product gate, and it counts toward the customer's quota.
Interactive reference: API reference
GET/api/integration/dfe/rtc/calculadora/{model}/versaoSign in to see the host and referenceQuery params: versao (optional, same as the endpoint above).
Response 200 — data: versaoApp, versaoDb, descricaoVersaoDb, dataVersaoDb, ambiente.
Version, cache and quota semantics
- Version selection:
?versao=is optional (defaultlatest); it allows calculating against older databases. A version outside the configured whitelist →400 INVALID_CALCULATOR_VERSION. Currently the whitelist only haslatestdeployed in all three environments. - Response cache: identical responses (same customer, model, target version and payload) are served from cache for up to 60s. The cache is internal to the application and cannot be controlled by the customer (no status header or bypass). If
dataHoraEmissaois omitted, "now" may reflect up to one TTL ago — anyone who needs determinism should provide the date explicitly. - Quota / limits: per-customer quota (
429 RATE_LIMITED, withRetry-After) — every request counts, includingGET /versaoand responses served from cache. There is also upstream concurrency protection (429 CONCURRENCY_LIMITED).
Message language
Resolved via Accept-Language: pt-BR (default), en-US, es-ES.
Error Codes
Errors follow the standard ApiError envelope (see REST APIs); the code field is the stable identifier for the integrator to branch on. Authentication codes (401, and the 403 for insufficient scope) arrive in the same envelope, but are emitted by the security layer before the controller — which is why they do not appear in the declared responses of the OpenAPI spec.
| HTTP | code | Cause |
|---|---|---|
| 400 | TAX_CALCULATION_ERROR | Invalid/unreadable body, or rejection (4xx) by the calculator (title/detail in the message). |
| 400 | INVALID_MODEL_CODE | model outside the supported list (55, 65). |
| 400 | INVALID_CALCULATOR_VERSION | versao outside the whitelist. |
| 400 | (field validation) | @Valid — e.g., empty itens or more than 990, invalid UF, municipality not 7 digits, incomplete tributacaoRegular. |
| 401 | UNAUTHORIZED | Token missing, invalid or expired. |
| 403 | CUSTOMER_NOT_ACTIVE | Inactive customer. |
| 403 | INVALID_CUSTOMER_CONTEXT | Token without the customer-id claim, or company that does not belong to the customer. |
| 403 | PRODUCT_NOT_ENABLED | RTC Calculator product not enabled for the customer. |
| 403 | FORBIDDEN | Valid token, but without the RTC_INTEGRATION_API role. |
| 413 | PAYLOAD_TOO_LARGE | Body above the configured limit. |
| 429 | RATE_LIMITED | Customer quota exceeded (accompanied by Retry-After). |
| 429 | CONCURRENCY_LIMITED | Upstream concurrency limit reached. |
| 502 | TAX_CALCULATOR_UNAVAILABLE | Transport failure or 5xx from the calculator. |
| 503 | IAM_UNAVAILABLE | IAM unavailable and no cached access decision. |
| 503 | AUTH_UNAVAILABLE | Token issuer/JWKS unreachable during validation (rare). |
| 504 | TAX_CALCULATOR_TIMEOUT | Calculator timeout (accompanied by Retry-After). |
| 500 | INTERNAL_ERROR | Unexpected failure — still returned within the standard envelope. |
Changelog
[1.0.0] — 2026-09-02
Added
POST /{model}/regime-geral— calculation of RTC taxes (general regime).GET /{model}/versao— current calculator version.
Available in development and UAT; production expected after DFE-2796 is closed and the release-proxy-v* tag is cut.
[Unreleased]
Added
- Real example of
calculo(pass-through payload from the government Calculator, engine v0043) in the endpoints section, and a note thatcst/cClassTribare required in practice by the government engine despite being optional in the schema.
Reconciled with the service in development and UAT. Last review: 2026-09-08 (mi-dev-portal-doc — DFE-2852).