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 como categoria do item, com list = "codBC" (seção 4.2). 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.
Guias por caso, com os codBC, os campos e um exemplo completo de cada evento:
- Serviços remunerados por preço e tarifas (D-2201, D-2202)
- Crédito, TVM e antecipação de recebíveis (D-2211, D-2221)
- Arrendamento mercantil (D-2231)
- Arranjos de pagamento (D-2241, D-2242)
- Seguros, previdência e capitalização (D-2251, D-2252)
- Planos de saúde (D-3201)
- Concursos de prognósticos (D-4201)
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",
"municipality_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" },
{ "list": "codBC", "code": "2405" }
],
"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 municipality_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 typeTodo item leva duas categorias:
"categories": [
{ "list": "DeRE type", "code": "DeRE" },
{ "list": "codBC", "code": "2405" }
]list | code | Para quê |
|---|---|---|
DeRE type | Sempre DeRE | Marca a operação como transação DeRE |
codBC | codBC de 4 dígitos (Tabela 12) | Define o evento DeRE da operação (seção 2) |
- Um codBC fora da Tabela 12 é rejeitado na validação.
- O codBC também pode ir no campo
codedas linhas de IBS e CBS (seção 4.3). Se ele vier nos dois lugares, os valores têm que ser iguais; se forem diferentes, a operação é rejeitada. - Alguns eventos pedem outras categorias DeRE (
DeRE tpContrato,DeRE indIdentifAdq,DeRE tpParticip): ver seção 4.5.
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é opcional: se informado, é o codBC e tem que ser igual à categoriacodBC(seção 4.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.- Eventos sem tributo por operação (D-2251 e D-4201): envie as duas linhas de IBS com
code= codBC,rate= 0 eamount= 0. Em D-2251,taxable_amounté a base para distribuição do IBS (vBCDistr); em D-4201, o valor da operação. A linha de CBS não é necessária.
4.4 Do JSON ao evento DeRE
| Campo DeRE | Campo na API |
|---|---|
codBC | items[].taxes[].code(IBS e CBS) ou items[].categories[].{"list": "codBC", code: ### } |
CPF / CNPJ | buyer.tax_registrations[].number, com type CPF ou CNPJ |
cMun | buyer.address.municipality_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 |
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.municipality_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:
| Evento | Dados adicionais | Envio na API |
|---|---|---|
| D-2202, D-4201 | Município onde o serviço foi prestado ou a aposta foi feita (cMunOper) | buyer.physical_address.municipality_code |
| D-2202, D-4201 | Operação presencial (indPresenc, indApostaPresenc) | Derivado: com buyer.physical_address = 1 (presencial); sem = 0 |
| D-2211, D-2221 | Contrato referenciado em moeda estrangeira (indMoedaEstr) | Derivado de currency (diferente de BRL), com exchange_rate |
| D-2231, D-3201, D-4201 | Valor da operação (vOper) | items[].amount |
| D-2201 | Destinatário do serviço, só quando diferente do adquirente (CPF/CNPJ, município, NIF/país) | beneficiaries[].company, com role_external = recipient. Sem beneficiaries[], vale o buyer. |
| D-2242 | Tipo de participação no arranjo (tpParticip: 1 instituidor/bandeira, 2 emissor, 3 credenciador) | items[].categories[] com list = "DeRE tpParticip". Sem a categoria, vale a categoria padrão da empresa declarante. |
| D-2251 | Base para distribuição do IBS (vBCDistr). O grupo vem do codBC: 3015/3020 seguro sem cobertura por sobrevivência, 3025/3030 com cobertura por sobrevivência e previdência, 3405/3410 capitalização | Linhas de IBS com taxable_amount = base, rate e amount = 0 (seção 4.3) |
| D-2251 | Segurados e base individual de cada um (vBCDistrSeg) | beneficiaries[].company, com role_external = insured, e beneficiaries[].amount |
| D-2251 | Indicador de identificação do adquirente (indIdentifAdq: 0 não obrigado, 1 obrigado), na capitalização | items[].categories[] com list = "DeRE indIdentifAdq" |
| D-2251 | Município de comercialização (cMunOper), na capitalização sem identificação do adquirente | buyer.physical_address.municipality_code |
| D-2251, D-3201 | Tipo de contrato (tpContrato) | items[].categories[] com list = "DeRE tpContrato" |
| D-2251, D-2252, D-4201 | Ponto de venda (CPF/CNPJ) | senders[].company, com role_external = point_of_sale |
| D-3201 | Titulares (CPF, data de nascimento) e valor por titular (vTitularDep) | beneficiaries[].company, com role_external = policyholder e date_of_birth, e beneficiaries[].amount |
| D-3201 | Dependentes (data de nascimento) | beneficiaries[].company.participants[], com role_external = dependent e date_of_birth |
| D-3201 | Número do contrato (idContrato) | items[].external_item_id |
| D-3201 | CNPJ da entidade relacionada (CNPJEntidRelac), em contrato coletivo com administradora de benefícios | senders[].company, com role_external = related_entity |
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",
"municipality_code": "3550308"
},
"tax_registrations": [ { "...": "..." } ]
},
"beneficiaries": [
{
"amount": 1500,
"company": {
"name": "MARIA SILVA",
"type": "person",
"role_external": "policyholder",
"date_of_birth": "1985-04-23",
"address": { "country": "BR", "municipality_code": "3550308" },
"tax_registrations": [
{ "number": "12345678909", "type": "CPF", "level": "country", "location": "BR" }
],
"participants": [
{ "type": "person", "role_external": "dependent", "date_of_birth": "2015-08-10" }
]
}
}
],
"senders": [
{
"company": {
"name": "CORRETORA PONTO DE VENDA LTDA",
"type": "business",
"role_external": "point_of_sale",
"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, devoluções e cancelamentos:
POST /refunds/ (ou um lote de refunds na Batch API), referenciando a venda original com original_transaction_external_id ou original_transaction_id, nunca os dois. O status do refund define o evento DeRE: voided gera cancelamento e refunded gera devolução. Detalhes em DeRE · Devoluções, cancelamentos e ajustes.
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 as categorias DeRE type e codBC em cada item.
{
"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.
-
Regra de estornos acordada: quando usar
voided(serviço não prestado ou registro com erro) e quandorefunded(serviço já prestado).
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 as an item category, with list = "codBC" (section 4.2). The client does not choose 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.
Guides per case, with the codBC, fields and a full example for each event:
- Services paid by price and fees (D-2201, D-2202)
- Credit, securities and receivables advances (D-2211, D-2221)
- Leasing (D-2231)
- Payment arrangements (D-2241, D-2242)
- Insurance, pension and capitalization (D-2251, D-2252)
- Health plans (D-3201)
- Lotteries and betting (D-4201)
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 municipality_code (IBGE code) and tax_registrations (CNPJ or CPF). Can be checked first with the Tax ID Validation API (section 6). |
4.2 DeRE item categories
Every item carries two categories:
"categories": [
{ "list": "DeRE type", "code": "DeRE" },
{ "list": "codBC", "code": "2405" }
]list | code | Purpose |
|---|---|---|
DeRE type | Always DeRE | Flags the operation as a DeRE transaction |
codBC | 4-digit codBC (Table 12) | Sets the operation's DeRE event (section 2) |
- A codBC outside Table 12 is rejected at validation.
- The codBC may also go in the
codefield of the IBS and CBS lines (section 4.3). If it is sent in both places, the values must match; if they differ, the operation is rejected. - Some events need other DeRE categories (
DeRE tpContrato,DeRE indIdentifAdq,DeRE tpParticip): see section 4.5.
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 optional: if sent, it is thecodBCand must match thecodBCcategory (section 4.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.- Events without a per-operation tax (D-2251 and D-4201): send the two IBS lines with
code= codBC,rate= 0 andamount= 0. In D-2251,taxable_amountis the IBS distribution base (vBCDistr); in D-4201, the operation value. The CBS line is not needed.
4.4 From JSON to DeRE event
| DeRE field | API field |
|---|---|
codBC | items[].taxes[].code (IBS and CBS) or items[].categories[].{"list": "codBC", code: ### } |
CPF / CNPJ | buyer.tax_registrations[].number, with type CPF or CNPJ |
cMun | buyer.address.municipality_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 |
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.municipality_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:
| Event | Additional data | API field |
|---|---|---|
| D-2202, D-4201 | Municipality where the service was provided or the bet was placed (cMunOper) | buyer.physical_address.municipality_code |
| D-2202, D-4201 | In-person operation (indPresenc, indApostaPresenc) | Derived: with buyer.physical_address = 1 (in person); without = 0 |
| D-2211, D-2221 | Contract referenced in foreign currency (indMoedaEstr) | Derived from currency (other than BRL), with exchange_rate |
| D-2231, D-3201, D-4201 | Operation value (vOper) | items[].amount |
| D-2201 | Service recipient, only when different from the buyer (CPF/CNPJ, municipality, NIF/country) | beneficiaries[].company, with role_external = recipient. Without beneficiaries[], the buyer applies. |
| D-2242 | Type of participation in the arrangement (tpParticip: 1 scheme owner/brand, 2 issuer, 3 acquirer) | items[].categories[] with list = "DeRE tpParticip". Without the category, the declaring company's default category applies. |
| D-2251 | IBS distribution base (vBCDistr). The group comes from the codBC: 3015/3020 insurance without survival coverage, 3025/3030 with survival coverage and private pension, 3405/3410 capitalization | IBS lines with taxable_amount = base, rate and amount = 0 (section 4.3) |
| D-2251 | Insured persons and each one's base (vBCDistrSeg) | beneficiaries[].company, with role_external = insured, and beneficiaries[].amount |
| D-2251 | Buyer identification indicator (indIdentifAdq: 0 not required, 1 required), for capitalization | items[].categories[] with list = "DeRE indIdentifAdq" |
| D-2251 | Place of sale (cMunOper), for capitalization without buyer identification | buyer.physical_address.municipality_code |
| D-2251, D-3201 | Contract type (tpContrato) | items[].categories[] with list = "DeRE tpContrato" |
| D-2251, D-2252, D-4201 | Point of sale (CPF/CNPJ) | senders[].company, with role_external = point_of_sale |
| D-3201 | Primary beneficiaries (CPF, birth date) and amount per primary beneficiary (vTitularDep) | beneficiaries[].company, with role_external = policyholder and date_of_birth, and beneficiaries[].amount |
| D-3201 | Dependents (birth date) | beneficiaries[].company.participants[], with role_external = dependent and date_of_birth |
| D-3201 | Contract number (idContrato) | items[].external_item_id |
| D-3201 | Related entity CNPJ (CNPJEntidRelac), for group contracts with a benefits administrator | senders[].company, with role_external = related_entity |
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, returns and cancellations:
POST /refunds/ (or a refund batch in the Batch API), referencing the original sale with original_transaction_external_id or original_transaction_id, never both. The refund status defines the DeRE event: voided produces a cancellation and refunded a return. Details in DeRE · Returns, cancellations and adjustments.
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 the POST /sales/ in section 4, with the DeRE type and codBC categories on every item.
{
"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.
-
Categories
DeRE type=DeREandcodBC= the operation's codBC on every item. -
IBS in two lines (
stateandmunicipality) and CBS incountry. If you sendcodeon those lines, it must match thecodBCcategory. -
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.
-
Refund rule agreed: when to use
voided(service not rendered or record issued in error) and whenrefunded(service already rendered).
More on the Batch API: https://docs.brinta.com/docs/batch-transactions
Updated 22 days ago
