DeRE: envio de transações à Brinta / DeRE: sending transactions to Brinta
Português
1. Contexto
A DeRE (Declaração de Regimes Específicos) é a obrigação acessória do IBS e da CBS para os regimes específicos: financeiro, seguros, planos de saúde e afins. A plataforma Brinta recebe os dados que a empresa já tem, transforma em eventos da DeRE, gera o XML assinado e transmite ao fisco.
| Módulo | Dado de entrada | Canal recomendado | Cadência |
|---|---|---|---|
| Eventual (D-1001, D-1011) | Cadastro e plano de contas | Interface web ou SFTP | Uma vez |
| Periódico (D-1101, D-1106, D-1199) | Balancete e lançamentos contábeis | CSV por SFTP ou Batch API | Mensal |
| Transacional | Faturamento e vendas | API REST ou Batch API | Diária ou contínua |
Este guia cobre o módulo transacional: como enviar cada operação à Brinta via API, uma a uma ou em lote. A Brinta agrupa as operações, gera a chave e o sequencial de cada uma, monta o evento correto e transmite.
2. Eventos transacionais e codBC
Cada operação é informada em um único evento, definido pelo seu código de base de cálculo (codBC), Tabela 12 da DeRE. Na API, o codBC vai no campo code das linhas de IBS e CBS (seção 4.3). O cliente não escolhe o evento: a Brinta o determina a partir do codBC.
| Evento | Nome oficial | codBC | Prazo de transmissão |
|---|---|---|---|
| D-2201 | Serviços remunerados por preço | 1015, 1020, 1205, 1210, 1225, 1230, 1805, 1810, 2005, 2010, 2015, 2020, 2210, 2805, 2810, 3605 a 3640, 3805, 3810, 4005, 4010 | 7 dias após cada bloco de 7 dias |
| D-2202 | Tarifas do regime geral | 4210 | 7 dias após cada bloco de 7 dias |
| D-2211 | Operações de crédito e TVM | 1005, 1010, 2220 | 7 dias após cada bloco de 7 dias |
| D-2221 | Antecipação de recebíveis (securitização, faturização e arranjos) | 1215, 1220, 1235, 1240, 2505, 2510 | 7 dias após cada bloco de 7 dias |
| D-2231 | Arrendamento mercantil | 1410 a 1480, 1605, 1610, 1615, 1620, 1630, 1640 | 7 dias após cada bloco de 7 dias |
| D-2241 | Arranjos de pagamento: credenciados ou destinatários | 2405, 2410, 2415, 2420, 2425, 2430 | 5 dias após cada bloco de 5 dias |
| D-2242 | Arranjos de pagamento: operações entre participantes | 2435, 2440, 2445, 2450, 2455, 2460 | 5 dias após cada bloco de 5 dias |
| D-2251 | Seguros, previdência complementar e capitalização | 3015, 3020, 3025, 3030, 3405, 3410 | 7 dias após cada bloco de 7 dias |
| D-2252 | Seguros de ramos elementares e de pessoas sem cobertura por sobrevivência | 3005, 3010 | Até o dia 6 do mês seguinte |
| D-3201 | Planos de assistência à saúde | 5010, 5020, 5030, 5050 | 7 dias após cada bloco de 7 dias |
| D-4201 | Concursos de prognósticos | 6010 | 7 dias após cada bloco de 7 dias |
Como os prazos são curtos (5 ou 7 dias), recomendamos enviar as operações à Brinta diariamente ou de forma contínua.
3. Duas formas de envio
| API REST (unitária) | Batch API | |
|---|---|---|
| Endpoint | POST /sales/ (vendas), POST /refunds/ (estornos) | POST /transaction-batches/ |
| Registros por request | 1 | Até 10.000 |
| Resposta | Síncrona, com validação na resposta | 202 Accepted + batch_id, resultado por registro |
Recalcula IBS/CBS (use_tax_engine) | Sim, opcional | Não. O lote nunca roda o motor de cálculo: os tributos vêm prontos em cada item |
| Ideal para | Integração contínua, operação a operação | Cargas diárias ou de volume |
Base URL: https://api.brinta.com. Autenticação: Authorization: Bearer <token>.
4. Estrutura de uma transação DeRE
Exemplo de uma operação de arranjo de pagamento (codBC 2405, evento D-2241), com POST /sales/:
{
"invoice_date": "2026-10-09T15:42:44.847Z",
"transaction_owner_company_id": "b52692d8-6dde-49b2-ad58-b8cc068c1b80",
"transaction_external_id": "ABC3595695",
"currency": "BRL",
"type": "sale",
"use_tax_engine": false,
"status": "completed",
"buyer": {
"name": "CLIENTE SERVICOS LTDA",
"type": "business",
"address": {
"address_line_1": "AV DAS NAÇÕES UNIDAS 14171",
"address_line_2": "ANDAR 19 E 20 EDIF ROCHAVERA",
"city": "Sao Paulo",
"state": "BR-SP",
"country": "BR",
"municipal_code": "3550308"
},
"tax_registrations": [
{
"number": "05.577.323/0001-38",
"type": "CNPJ",
"status": "Lucro real",
"level": "country",
"location": "BR"
}
]
},
"items": [
{
"name": "DeRE transaction",
"amount": 10000,
"categories": [
{ "list": "DeRE type", "code": "DeRE" }
],
"taxes": [
{
"name": "ISS", "type": "ISS", "description": "Imposto sobre Serviços",
"level": "country", "location": "BR",
"rate": 0.02, "rate_type": "percentage",
"taxable_amount": 10000, "amount": 200,
"adds_to_final_amount": false
},
{
"name": "ISS Outro", "type": "ISS", "description": "Imposto sobre Serviços",
"level": "country", "location": "BR",
"rate": 0.02, "rate_type": "percentage",
"taxable_amount": 10000, "amount": 200,
"adds_to_final_amount": false
},
{
"name": "PIS", "type": "PIS", "description": "Programa de Integração Social",
"level": "country", "location": "BR",
"rate": 0.0065, "rate_type": "percentage",
"taxable_amount": 10000, "amount": 65,
"adds_to_final_amount": false
},
{
"name": "COFINS", "type": "COFINS",
"description": "Contribuição para o Financiamento da Seguridade Social",
"level": "country", "location": "BR",
"rate": 0.03, "rate_type": "percentage",
"taxable_amount": 10000, "amount": 300,
"adds_to_final_amount": false
},
{
"name": "IBS", "type": "VAT", "code": "2405",
"description": "Imposto sobre Bens e Serviços",
"level": "state", "location": "BR",
"rate": 0.001, "rate_type": "percentage",
"taxable_amount": 9235, "amount": 9.24,
"adds_to_final_amount": false
},
{
"name": "IBS", "type": "VAT", "code": "2405",
"description": "Imposto sobre Bens e Serviços",
"level": "municipality", "location": "BR",
"rate": 0.001, "rate_type": "percentage",
"taxable_amount": 9235, "amount": 9.24,
"adds_to_final_amount": false
},
{
"name": "CBS", "type": "VAT", "code": "2405",
"description": "Contribuição sobre Bens e Serviços",
"level": "country", "location": "BR",
"rate": 0.009, "rate_type": "percentage",
"taxable_amount": 9235, "amount": 83.12,
"adds_to_final_amount": false
}
]
}
]
}Outros tributos da operação (CSLL, IRRF etc.) podem ir no mesmo array
taxes, com o mesmo formato. Eles não entram na DeRE.
4.1 Campos do cabeçalho
| Campo | Obrigatório | Descrição |
|---|---|---|
transaction_external_id | Sim | ID da operação no sistema do cliente (NSU, código de autorização ou ID da transação). Único por empresa; é a chave de deduplicação e de referência para estornos. |
transaction_owner_company_id | Sim | ID na Brinta da empresa declarante (CNPJ cadastrado no D-1001). |
invoice_date | Sim | Data e hora da operação (ISO 8601). Define o período e o subperíodo da DeRE. |
type | Sim | sale para vendas. Estornos vão para /refunds/. |
currency | Sim | BRL. |
status | Sim | completed para operações concluídas. |
use_tax_engine | Não | Ver seção 5. |
buyer | Sim | Adquirente: nome, tipo (business/individual), endereço com municipal_code (código IBGE) e tax_registrations (CNPJ ou CPF). Pode ser validado antes com a API de Tax ID Validation (seção 6). |
4.2 Categoria DeRE type
DeRE typeEm cada item, sempre com o mesmo valor:
"categories": [ { "list": "DeRE type", "code": "DeRE" } ]Ela marca a operação como transação DeRE. O evento de destino é definido pelo codBC (seção 4.3), não pela categoria.
4.3 Tributos IBS e CBS
| Tributo | name | type | level | code |
|---|---|---|---|---|
| IBS estadual | IBS | VAT | state | codBC |
| IBS municipal | IBS | VAT | municipality (ou city) | codBC |
| CBS | CBS | VAT | country | codBC |
codeé o codBC (4 dígitos, Tabela 12) e é obrigatório nas três linhas. Ele define o evento DeRE da operação (seção 2).- O IBS vai em duas linhas, uma por esfera:
stateemunicipality(citytambém é aceito). Não envie um IBS único consolidado. taxable_amounté a base de cálculo do IBS/CBS (vBCApur): o valor da operação menos os tributos que não integram a base (ISS e PIS/COFINS) e as deduções permitidas. No exemplo: 10.000 − (200 + 200 + 65 + 300) = 9.235.ratevai em decimal (0.001= 0,1%). A Brinta converte para o percentual da DeRE.amounté o tributo:taxable_amount × rate, arredondado a 2 casas.
4.4 Do JSON ao evento DeRE
| Campo DeRE | Campo na API |
|---|---|
codBC | items[].taxes[].code (IBS e CBS) |
CPF / CNPJ | buyer.tax_registrations[].number, com type CPF ou CNPJ |
cMun | buyer.address.municipal_code |
Destinatário (CPFDest, CNPJDest, cMunDest, NIFDest, cPaisDest) | beneficiaries[].company. Se beneficiaries[] não for enviado, o destinatário é o próprio adquirente (buyer). |
NIF, cPais (adquirente estrangeiro) | buyer.tax_registrations[] com o número fiscal do exterior e buyer.address.country |
ID_OPERACAO | transaction_external_id |
dhOper | invoice_date |
vLiqOper / vOper | items[].amount |
vISSQNProp | tributo ISS |
vISSQNOutro | tributo ISS Outro (ISS de outros participantes do arranjo) |
vPisCofins | tributos PIS + COFINS |
vBCApur, vBCTrib | taxable_amount das linhas de IBS/CBS |
pIBSUFTrib, vIBSUFTrib | IBS level: state: rate e amount |
pIBSMunTrib, vIBSMunTrib | IBS level: municipality: rate e amount |
pCBSTrib, vCBSTrib | CBS: rate e amount |
indMoedaEstr (D-2211, D-2221) | Derivado de currency: diferente de BRL indica contrato em moeda estrangeira |
cMunOper (D-2202, D-4201) | buyer.physical_address.municipal_code |
vOper (D-2231, D-3201, D-4201) | items[].amount |
A Brinta gera o resto: CNPJ raiz do declarante (nrInsc, a partir de transaction_owner_company_id), chave e sequencial do agrupamento (chAgrup, seq), período, subperíodo, finalidade do evento e assinatura.
4.5 Dados adicionais por evento
Alguns eventos pedem dados além dos campos acima. A Brinta orienta o envio de cada um durante a implementação, conforme os codBC em que a sua empresa opera.
| Evento | Dados adicionais | Envio na API |
|---|---|---|
| D-2202 | Município do estabelecimento onde o serviço foi prestado (cMunOper) | buyer.physical_address.municipal_code |
| D-2202 | Serviço fruído presencialmente por pessoa física (indPresenc) | Definido na implementação |
| D-2211, D-2221 | Contrato referenciado em moeda estrangeira (indMoedaEstr) | Derivado de currency (diferente de BRL), com exchange_rate |
| D-2231 | Parcela recebida do arrendamento, incluindo tarifa (vOper) | items[].amount |
| D-2241 | Destinatário do serviço, só quando diferente do adquirente (CPF/CNPJ, município, NIF/país) | beneficiaries[].company (tax_registrations, address.municipal_code, address.country). Sem beneficiaries[], vale o buyer. |
| D-2242 | Tipo de participação no arranjo (tpParticip) | company.role_external |
| D-2251 | Lista de segurados (CPF/CNPJ, município, NIF/país) | beneficiaries[].company |
| D-2251 | Indicador de identificação do adquirente, tipo de contrato, bases para distribuição do IBS (total e por segurado) e município de comercialização (capitalização) | Definido na implementação |
| D-2251, D-2252, D-4201 | Ponto de venda (CPF/CNPJ) | senders[].company, com role_external |
| D-3201 | Beneficiários titulares e dependentes (CPF, data de nascimento) | beneficiaries[].company, com role_external (titular ou dependente) e date_of_birth |
| D-3201 | Contrato (idContrato, tpContrato), CNPJ da entidade relacionada e valor por titular | Definido na implementação |
| D-3201 | Valor total recebido (vOper) | items[].amount |
| D-4201 | Município das apostas presenciais (cMunOper) | buyer.physical_address.municipal_code |
| D-4201 | Aposta presencial (indApostaPresenc) e valor total por apostador (vOper) | vOper: items[].amount; indicador definido na implementação |
Exemplo de buyer com physical_address, beneficiaries[] e senders[]:
"buyer": {
"name": "CLIENTE SERVICOS LTDA",
"type": "business",
"address": { "...": "endereço cadastral do adquirente" },
"physical_address": {
"address_line_1": "RUA AUGUSTA 1500",
"city": "Sao Paulo",
"state": "BR-SP",
"country": "BR",
"municipal_code": "3550308"
},
"tax_registrations": [ { "...": "..." } ]
},
"beneficiaries": [
{
"company": {
"name": "MARIA SILVA",
"type": "person",
"role_external": "titular",
"date_of_birth": "1985-04-23",
"address": { "country": "BR", "municipal_code": "3550308" },
"tax_registrations": [
{ "number": "12345678909", "type": "CPF", "level": "country", "location": "BR" }
]
}
}
],
"senders": [
{
"company": {
"name": "CORRETORA PONTO DE VENDA LTDA",
"type": "business",
"role_external": "ponto de venda",
"address": { "country": "BR" },
"tax_registrations": [
{ "number": "12345678000195", "type": "CNPJ", "level": "country", "location": "BR" }
]
}
}
]5. use_tax_engine: tributos prontos ou recalculados
use_tax_engine: tributos prontos ou recalculados| Valor | Quando usar | O que a Brinta faz |
|---|---|---|
false | O cliente já tem a base de cálculo e o IBS/CBS calculados | Armazena os tributos exatamente como enviados. Nada é recalculado. |
true ou omitido | O cliente envia a operação sem IBS/CBS calculado, ou quer que a Brinta calcule | A Brinta recalcula o IBS/CBS (débitos e créditos) com o motor de cálculo a partir dos dados da operação. |
Na Batch API o motor de cálculo nunca roda: os tributos devem vir prontos em cada item, como em
use_tax_engine: false. Se o cliente precisa que a Brinta recalcule o IBS/CBS, use a API unitária.
6. Validação do adquirente (Tax ID Validation)
A DeRE identifica cada adquirente por CPF ou CNPJ e município. Para evitar rejeições, o cliente pode validar o adquirente antes de enviar as operações, com a API de Tax ID Validation da Brinta. Ela consulta a fonte oficial e devolve, para CPF, nome e situação cadastral e, para CNPJ, razão social, situação cadastral, CNAE e endereço.
curl -X POST https://api.brinta.com/tax-id-validations/ \
-H "Authorization: Bearer $BRINTA_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"locations": ["BR"],
"company": {
"type": "business",
"tax_registration": {
"number": "05577323000138",
"type": "CNPJ",
"level": "country",
"location": "BR"
}
}
}'- A validação é assíncrona: o
POSTdevolve{id, status: "in_process"}e o resultado sai emGET /tax-id-validations/{id}ou por webhook. - Se o adquirente já estiver cadastrado como empresa na Brinta, valide com
company_id(oucompany_external_id) e"update_company": true: os dados oficiais ficam gravados e podem ser referenciados comobuyernas transações. - Também é possível validar dentro da própria transação, enviando
"tax_id_validation": truenobuyer. Essa opção precisa ser habilitada pela Brinta para a sua empresa.
Guia: https://docs.brinta.com/docs/tax-id-validation-how-to · Brasil (CPF e CNPJ): https://docs.brinta.com/reference/tax-id-validation-brazil
7. Envio unitário (API REST)
curl -X POST https://api.brinta.com/sales/ \
-H "Authorization: Bearer $BRINTA_TOKEN" \
-H "Content-Type: application/json" \
-d @transacao.jsonA resposta traz a transação criada (ou os erros de validação). Para consultar depois: GET /sales/{id}.
Estornos e cancelamentos: POST /refunds/, referenciando a venda original com original_transaction_external_id (seu ID) ou original_transaction_id (ID Brinta), nunca os dois. O estorno pode ser total, parcial por valor ou por item. A Brinta gera a referência à operação original no evento (chAgrupRef, seqRef).
8. Envio em lote (Batch API)
Para volume, envie até 10.000 operações por request com POST /transaction-batches/ e "transaction_type": "sale". Cada elemento de transactions tem o mesmo corpo do POST /sales/ da seção 4, com a categoria DeRE type e o codBC em code nas linhas de IBS e CBS. Um mesmo lote pode misturar operações de codBC (e eventos) diferentes.
{
"transaction_type": "sale",
"transactions": [
{ "transaction_external_id": "ABC3595695", "...": "mesmo corpo da seção 4" },
{ "transaction_external_id": "ABC3595696", "...": "mesmo corpo da seção 4" }
]
}O lote é assíncrono, com resultado por operação, e nunca roda o motor de cálculo (seção 5). Idempotência, acompanhamento, correção de erros, estornos e limites estão no guia da Batch API: https://docs.brinta.com/docs/batch-transactions
9. Checklist antes de produção
- Empresa declarante cadastrada na Brinta, com D-1001 e D-1011 ativos.
- codBC de cada tipo de operação identificado (Tabela 12) e, com isso, os eventos que se aplicam.
- Dados adicionais dos eventos aplicáveis (seção 4.5) combinados com a Brinta.
- Categoria
DeRE type=DeREem todos os itens. - IBS em duas linhas (
stateemunicipality) e CBS emcountry, todas com o codBC emcode. - Decidido
use_tax_engine(falsese o IBS/CBS já vem calculado). - Adquirentes validados com Tax ID Validation (recomendado).
- Canal escolhido: API unitária, Batch API ou ambos, com envio diário ou contínuo.
- Lote de teste validado com
dry_run: true.
Mais detalhes da Batch API: https://docs.brinta.com/docs/batch-transactions
English
1. Context
DeRE (Declaração de Regimes Específicos) is the IBS and CBS reporting obligation for Brazil's specific regimes: financial services, insurance, health plans and similar. The Brinta platform takes the data the company already has, turns it into DeRE events, generates the signed XML and transmits it to the tax authority.
| Module | Input data | Recommended channel | Cadence |
|---|---|---|---|
| Eventual (D-1001, D-1011) | Company registration and chart of accounts | Web interface or SFTP | Once |
| Periodic (D-1101, D-1106, D-1199) | Trial balance and journal entries | CSV over SFTP or Batch API | Monthly |
| Transactional | Billing and sales | REST API or Batch API | Daily or continuous |
This guide covers the transactional module: how to send each operation to Brinta through the API, one by one or in batches. Brinta groups the operations, generates each one's key and sequence number, builds the right event and transmits it.
2. Transactional events and codBC
Each operation is reported in exactly one event, set by its tax base code (codBC), DeRE Table 12. In the API, the codBC goes in the code field of the IBS and CBS lines (section 4.3). The client does not pick the event: Brinta derives it from the codBC.
| Event | Official name | codBC | Transmission deadline |
|---|---|---|---|
| D-2201 | Services paid by price | 1015, 1020, 1205, 1210, 1225, 1230, 1805, 1810, 2005, 2010, 2015, 2020, 2210, 2805, 2810, 3605 to 3640, 3805, 3810, 4005, 4010 | 7 days after each 7-day block |
| D-2202 | General-regime fees | 4210 | 7 days after each 7-day block |
| D-2211 | Credit operations and securities (TVM) | 1005, 1010, 2220 | 7 days after each 7-day block |
| D-2221 | Receivables advances (securitization, factoring and arrangements) | 1215, 1220, 1235, 1240, 2505, 2510 | 7 days after each 7-day block |
| D-2231 | Leasing | 1410 to 1480, 1605, 1610, 1615, 1620, 1630, 1640 | 7 days after each 7-day block |
| D-2241 | Payment arrangements: accredited merchants or service recipients | 2405, 2410, 2415, 2420, 2425, 2430 | 5 days after each 5-day block |
| D-2242 | Payment arrangements: operations between participants | 2435, 2440, 2445, 2450, 2455, 2460 | 5 days after each 5-day block |
| D-2251 | Insurance, private pension and capitalization | 3015, 3020, 3025, 3030, 3405, 3410 | 7 days after each 7-day block |
| D-2252 | Property and casualty, and life insurance without survival coverage | 3005, 3010 | By the 6th of the following month |
| D-3201 | Health plans | 5010, 5020, 5030, 5050 | 7 days after each 7-day block |
| D-4201 | Lotteries and betting | 6010 | 7 days after each 7-day block |
Deadlines are short (5 or 7 days), so we recommend sending operations to Brinta daily or continuously.
3. Two ways to send
| REST API (single) | Batch API | |
|---|---|---|
| Endpoint | POST /sales/ (sales), POST /refunds/ (refunds) | POST /transaction-batches/ |
| Records per request | 1 | Up to 10,000 |
| Response | Synchronous, validated in the response | 202 Accepted + batch_id, result per record |
Recalculates IBS/CBS (use_tax_engine) | Yes, optional | No. Batches never run the tax engine: taxes come ready on each item |
| Best for | Continuous, operation-by-operation integration | Daily or high-volume loads |
Base URL: https://api.brinta.com. Authentication: Authorization: Bearer <token>.
4. Structure of a DeRE transaction
See the full example (a payment arrangement operation, codBC 2405, event D-2241) in section 4 of the Portuguese version. The payload is identical.
Other taxes on the operation (CSLL, IRRF, etc.) can go in the same
taxesarray, in the same format. They are not part of DeRE.
4.1 Header fields
| Field | Required | Description |
|---|---|---|
transaction_external_id | Yes | Operation ID in the client's system (NSU, authorization code or transaction ID). Unique per company; it is the deduplication key and the reference for refunds. |
transaction_owner_company_id | Yes | Brinta ID of the declaring company (the CNPJ registered in D-1001). |
invoice_date | Yes | Operation date and time (ISO 8601). Sets the DeRE period and sub-period. |
type | Yes | sale for sales. Refunds go to /refunds/. |
currency | Yes | BRL. |
status | Yes | completed for finished operations. |
use_tax_engine | No | See section 5. |
buyer | Yes | Customer: name, type (business/individual), address with municipal_code (IBGE code) and tax_registrations (CNPJ or CPF). Can be checked first with the Tax ID Validation API (section 6). |
4.2 DeRE type category
DeRE type categoryOn every item, always with the same value:
"categories": [ { "list": "DeRE type", "code": "DeRE" } ]It flags the operation as a DeRE transaction. The target event is set by the codBC (section 4.3), not by the category.
4.3 IBS and CBS taxes
| Tax | name | type | level | code |
|---|---|---|---|---|
| State IBS | IBS | VAT | state | codBC |
| Municipal IBS | IBS | VAT | municipality (or city) | codBC |
| CBS | CBS | VAT | country | codBC |
codeis the codBC (4 digits, Table 12) and is required on all three lines. It sets the operation's DeRE event (section 2).- IBS is sent as two lines, one per level:
stateandmunicipality(cityis also accepted). Do not send a single consolidated IBS line. taxable_amountis the IBS/CBS tax base (vBCApur): the operation value minus the taxes that are not part of the base (ISS and PIS/COFINS) and the allowed deductions. In the example: 10,000 − (200 + 200 + 65 + 300) = 9,235.rateis a decimal (0.001= 0.1%). Brinta converts it to the DeRE percentage.amountis the tax:taxable_amount × rate, rounded to 2 decimals.
4.4 From JSON to DeRE event
| DeRE field | API field |
|---|---|
codBC | items[].taxes[].code (IBS and CBS) |
CPF / CNPJ | buyer.tax_registrations[].number, with type CPF or CNPJ |
cMun | buyer.address.municipal_code |
Service recipient (CPFDest, CNPJDest, cMunDest, NIFDest, cPaisDest) | beneficiaries[].company. If beneficiaries[] is not sent, the recipient is the buyer itself (buyer). |
NIF, cPais (foreign buyer) | buyer.tax_registrations[] with the foreign tax number, and buyer.address.country |
ID_OPERACAO | transaction_external_id |
dhOper | invoice_date |
vLiqOper / vOper | items[].amount |
vISSQNProp | ISS tax |
vISSQNOutro | ISS Outro tax (ISS of other arrangement participants) |
vPisCofins | PIS + COFINS taxes |
vBCApur, vBCTrib | taxable_amount of the IBS/CBS lines |
pIBSUFTrib, vIBSUFTrib | IBS level: state: rate and amount |
pIBSMunTrib, vIBSMunTrib | IBS level: municipality: rate and amount |
pCBSTrib, vCBSTrib | CBS: rate and amount |
indMoedaEstr (D-2211, D-2221) | Derived from currency: anything other than BRL means a foreign-currency contract |
cMunOper (D-2202, D-4201) | buyer.physical_address.municipal_code |
vOper (D-2231, D-3201, D-4201) | items[].amount |
Brinta generates the rest: the declarant's root CNPJ (nrInsc, from transaction_owner_company_id), grouping key and sequence (chAgrup, seq), period, sub-period, event purpose and signature.
4.5 Additional data per event
Some events require data beyond the fields above. Brinta guides how to send each one during implementation, based on the codBC your company operates under.
| Event | Additional data | API field |
|---|---|---|
| D-2202 | Municipality of the establishment where the service was provided (cMunOper) | buyer.physical_address.municipal_code |
| D-2202 | Service used in person by an individual (indPresenc) | Defined during implementation |
| D-2211, D-2221 | Contract referenced in foreign currency (indMoedaEstr) | Derived from currency (other than BRL), with exchange_rate |
| D-2231 | Lease installment received, including fees (vOper) | items[].amount |
| D-2241 | Service recipient, only when different from the buyer (CPF/CNPJ, municipality, NIF/country) | beneficiaries[].company (tax_registrations, address.municipal_code, address.country). Without beneficiaries[], the buyer applies. |
| D-2242 | Type of participation in the arrangement (tpParticip) | Defined during implementation |
| D-2251 | List of insured persons (CPF/CNPJ, municipality, NIF/country) | beneficiaries[].company |
| D-2251 | Buyer identification indicator, contract type, IBS distribution bases (total and per insured person) and place of sale (capitalization) | Defined during implementation |
| D-2251, D-2252, D-4201 | Point of sale (CPF/CNPJ) | senders[].company, with role_external |
| D-3201 | Primary beneficiaries and dependents (CPF, birth date) | beneficiaries[].company, with role_external (primary or dependent) and date_of_birth |
| D-3201 | Contract (idContrato, tpContrato), related entity CNPJ and amount per primary beneficiary | Defined during implementation |
| D-3201 | Total amount received (vOper) | items[].amount |
| D-4201 | Municipality of in-person bets (cMunOper) | buyer.physical_address.municipal_code |
| D-4201 | In-person bet (indApostaPresenc) and total amount per bettor (vOper) | vOper: items[].amount; indicator defined during implementation |
See the physical_address, beneficiaries[] and senders[] example in section 4.5 of the Portuguese version.
5. use_tax_engine: ready-made or recalculated taxes
use_tax_engine: ready-made or recalculated taxes| Value | When to use | What Brinta does |
|---|---|---|
false | The client already has the tax base and IBS/CBS calculated | Stores the taxes exactly as sent. Nothing is recalculated. |
true or omitted | The client sends the operation without IBS/CBS, or wants Brinta to calculate it | Brinta recalculates IBS/CBS (debits and credits) with the tax engine from the operation data. |
The Batch API never runs the tax engine: taxes must come ready on each item, as with
use_tax_engine: false. If the client needs Brinta to recalculate IBS/CBS, use the single-transaction API.
6. Buyer validation (Tax ID Validation)
DeRE identifies each buyer by CPF or CNPJ and municipality. To avoid rejections, the client can validate the buyer before sending operations, with Brinta's Tax ID Validation API. It queries the official source and returns, for a CPF, the name and registration status and, for a CNPJ, the corporate name, registration status, CNAE and address.
curl -X POST https://api.brinta.com/tax-id-validations/ \
-H "Authorization: Bearer $BRINTA_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"locations": ["BR"],
"company": {
"type": "business",
"tax_registration": {
"number": "05577323000138",
"type": "CNPJ",
"level": "country",
"location": "BR"
}
}
}'- Validation is asynchronous: the
POSTreturns{id, status: "in_process"}and the result comes fromGET /tax-id-validations/{id}or a webhook. - If the buyer is already a company in Brinta, validate with
company_id(orcompany_external_id) and"update_company": true: the official data is stored and can be referenced asbuyerin transactions. - You can also validate inside the transaction itself by sending
"tax_id_validation": trueonbuyer. Brinta has to enable this option for your company.
Guide: https://docs.brinta.com/docs/tax-id-validation-how-to · Brazil (CPF and CNPJ): https://docs.brinta.com/reference/tax-id-validation-brazil
7. Single sending (REST API)
curl -X POST https://api.brinta.com/sales/ \
-H "Authorization: Bearer $BRINTA_TOKEN" \
-H "Content-Type: application/json" \
-d @transaction.jsonThe response returns the created transaction (or the validation errors). To look it up later: GET /sales/{id}.
Refunds and cancellations: POST /refunds/, referencing the original sale with original_transaction_external_id (your ID) or original_transaction_id (Brinta ID), never both. A refund can be total, partial by amount, or per item. Brinta generates the reference to the original operation in the event (chAgrupRef, seqRef).
8. Batch sending (Batch API)
For volume, send up to 10,000 operations per request with POST /transaction-batches/ and "transaction_type": "sale". Each element of transactions has the same body as POST /sales/ in section 4, with the DeRE type category and the codBC in code on the IBS and CBS lines. One batch can mix operations with different codBC (and events).
{
"transaction_type": "sale",
"transactions": [
{ "transaction_external_id": "ABC3595695", "...": "same body as section 4" },
{ "transaction_external_id": "ABC3595696", "...": "same body as section 4" }
]
}Batches are asynchronous, return a result per operation, and never run the tax engine (section 5). Idempotency, tracking, fixing errors, refunds and limits are covered in the Batch API guide: https://docs.brinta.com/docs/batch-transactions
9. Go-live checklist
- Declaring company set up in Brinta, with D-1001 and D-1011 active.
- codBC identified for each operation type (Table 12), and with it the events that apply.
- Additional data for the applicable events (section 4.5) agreed with Brinta.
-
DeRE typecategory =DeREon every item. - IBS as two lines (
stateandmunicipality) and CBS ascountry, all with the codBC incode. -
use_tax_enginedecided (falseif IBS/CBS already comes calculated). - Buyers validated with Tax ID Validation (recommended).
- Channel chosen: single API, Batch API, or both, sending daily or continuously.
- Test batch validated with
dry_run: true.
More on the Batch API: https://docs.brinta.com/docs/batch-transactions
Updated about 7 hours ago
