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óduloDado de entradaCanal recomendadoCadência
Eventual (D-1001, D-1011)Cadastro e plano de contasInterface web ou SFTPUma vez
Periódico (D-1101, D-1106, D-1199)Balancete e lançamentos contábeisCSV por SFTP ou Batch APIMensal
TransacionalFaturamento e vendasAPI REST ou Batch APIDiá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.

EventoNome oficialcodBCPrazo de transmissão
D-2201Serviços remunerados por preço1015, 1020, 1205, 1210, 1225, 1230, 1805, 1810, 2005, 2010, 2015, 2020, 2210, 2805, 2810, 3605 a 3640, 3805, 3810, 4005, 40107 dias após cada bloco de 7 dias
D-2202Tarifas do regime geral42107 dias após cada bloco de 7 dias
D-2211Operações de crédito e TVM1005, 1010, 22207 dias após cada bloco de 7 dias
D-2221Antecipação de recebíveis (securitização, faturização e arranjos)1215, 1220, 1235, 1240, 2505, 25107 dias após cada bloco de 7 dias
D-2231Arrendamento mercantil1410 a 1480, 1605, 1610, 1615, 1620, 1630, 16407 dias após cada bloco de 7 dias
D-2241Arranjos de pagamento: credenciados ou destinatários2405, 2410, 2415, 2420, 2425, 24305 dias após cada bloco de 5 dias
D-2242Arranjos de pagamento: operações entre participantes2435, 2440, 2445, 2450, 2455, 24605 dias após cada bloco de 5 dias
D-2251Seguros, previdência complementar e capitalização3015, 3020, 3025, 3030, 3405, 34107 dias após cada bloco de 7 dias
D-2252Seguros de ramos elementares e de pessoas sem cobertura por sobrevivência3005, 3010Até o dia 6 do mês seguinte
D-3201Planos de assistência à saúde5010, 5020, 5030, 50507 dias após cada bloco de 7 dias
D-4201Concursos de prognósticos60107 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:

3. Duas formas de envio

API REST (unitária)Batch API
EndpointPOST /sales/ (vendas), POST /refunds/ (estornos)POST /transaction-batches/
Registros por request1Até 10.000
RespostaSíncrona, com validação na resposta202 Accepted + batch_id, resultado por registro
Recalcula IBS/CBS (use_tax_engine)Sim, opcionalNão. O lote nunca roda o motor de cálculo: os tributos vêm prontos em cada item
Ideal paraIntegração contínua, operação a operaçãoCargas 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

CampoObrigatórioDescrição
transaction_external_idSimID 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_idSimID na Brinta da empresa declarante (CNPJ cadastrado no D-1001).
invoice_dateSimData e hora da operação (ISO 8601). Define o período e o subperíodo da DeRE.
typeSimsale para vendas. Estornos vão para /refunds/.
currencySimBRL.
statusSimcompleted para operações concluídas.
use_tax_engineNãoVer seção 5.
buyerSimAdquirente: 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

Todo item leva duas categorias:

"categories": [
  { "list": "DeRE type", "code": "DeRE" },
  { "list": "codBC", "code": "2405" }
]
listcodePara quê
DeRE typeSempre DeREMarca a operação como transação DeRE
codBCcodBC 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 code das 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

Tributonametypelevelcode
IBS estadualIBSVATstatecodBC
IBS municipalIBSVATmunicipality (ou city)codBC
CBSCBSVATcountrycodBC
  • code é opcional: se informado, é o codBC e tem que ser igual à categoria codBC (seção 4.2).
  • O IBS vai em duas linhas, uma por esfera: state e municipality (city també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.
  • rate vai 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 e amount = 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 DeRECampo na API
codBCitems[].taxes[].code(IBS e CBS) ou items[].categories[].{"list": "codBC", code: ### }
CPF / CNPJbuyer.tax_registrations[].number, com type CPF ou CNPJ
cMunbuyer.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
dhOperinvoice_date
vLiqOper / vOperitems[].amount
vISSQNProptributo ISS
vISSQNOutrotributo ISS Outro (ISS de outros participantes do arranjo)
vPisCofinstributos PIS + COFINS
vBCApur, vBCTribtaxable_amount das linhas de IBS/CBS
pIBSUFTrib, vIBSUFTribIBS level: state: rate e amount
pIBSMunTrib, vIBSMunTribIBS level: municipality: rate e amount
pCBSTrib, vCBSTribCBS: 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:

EventoDados adicionaisEnvio na API
D-2202, D-4201Município onde o serviço foi prestado ou a aposta foi feita (cMunOper)buyer.physical_address.municipality_code
D-2202, D-4201Operação presencial (indPresenc, indApostaPresenc)Derivado: com buyer.physical_address = 1 (presencial); sem = 0
D-2211, D-2221Contrato referenciado em moeda estrangeira (indMoedaEstr)Derivado de currency (diferente de BRL), com exchange_rate
D-2231, D-3201, D-4201Valor da operação (vOper)items[].amount
D-2201Destinatá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-2242Tipo 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-2251Base 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çãoLinhas de IBS com taxable_amount = base, rate e amount = 0 (seção 4.3)
D-2251Segurados e base individual de cada um (vBCDistrSeg)beneficiaries[].company, com role_external = insured, e beneficiaries[].amount
D-2251Indicador de identificação do adquirente (indIdentifAdq: 0 não obrigado, 1 obrigado), na capitalizaçãoitems[].categories[] com list = "DeRE indIdentifAdq"
D-2251Município de comercialização (cMunOper), na capitalização sem identificação do adquirentebuyer.physical_address.municipality_code
D-2251, D-3201Tipo de contrato (tpContrato)items[].categories[] com list = "DeRE tpContrato"
D-2251, D-2252, D-4201Ponto de venda (CPF/CNPJ)senders[].company, com role_external = point_of_sale
D-3201Titulares (CPF, data de nascimento) e valor por titular (vTitularDep)beneficiaries[].company, com role_external = policyholder e date_of_birth, e beneficiaries[].amount
D-3201Dependentes (data de nascimento)beneficiaries[].company.participants[], com role_external = dependent e date_of_birth
D-3201Número do contrato (idContrato)items[].external_item_id
D-3201CNPJ da entidade relacionada (CNPJEntidRelac), em contrato coletivo com administradora de benefíciossenders[].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

ValorQuando usarO que a Brinta faz
falseO cliente já tem a base de cálculo e o IBS/CBS calculadosArmazena os tributos exatamente como enviados. Nada é recalculado.
true ou omitidoO cliente envia a operação sem IBS/CBS calculado, ou quer que a Brinta calculeA 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 POST devolve {id, status: "in_process"} e o resultado sai em GET /tax-id-validations/{id} ou por webhook.
  • Se o adquirente já estiver cadastrado como empresa na Brinta, valide com company_id (ou company_external_id) e "update_company": true: os dados oficiais ficam gravados e podem ser referenciados como buyer nas transações.
  • Também é possível validar dentro da própria transação, enviando "tax_id_validation": true no buyer. 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.json

A 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 = DeRE em todos os itens.

  • IBS em duas linhas (state e municipality) e CBS em country, todas com o codBC em code.

  • Decidido use_tax_engine (false se 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 quando refunded (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.

ModuleInput dataRecommended channelCadence
Eventual (D-1001, D-1011)Company registration and chart of accountsWeb interface or SFTPOnce
Periodic (D-1101, D-1106, D-1199)Trial balance and journal entriesCSV over SFTP or Batch APIMonthly
TransactionalBilling and salesREST API or Batch APIDaily 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.

EventOfficial namecodBCTransmission deadline
D-2201Services paid by price1015, 1020, 1205, 1210, 1225, 1230, 1805, 1810, 2005, 2010, 2015, 2020, 2210, 2805, 2810, 3605 to 3640, 3805, 3810, 4005, 40107 days after each 7-day block
D-2202General-regime fees42107 days after each 7-day block
D-2211Credit operations and securities (TVM)1005, 1010, 22207 days after each 7-day block
D-2221Receivables advances (securitization, factoring and arrangements)1215, 1220, 1235, 1240, 2505, 25107 days after each 7-day block
D-2231Leasing1410 to 1480, 1605, 1610, 1615, 1620, 1630, 16407 days after each 7-day block
D-2241Payment arrangements: accredited merchants or service recipients2405, 2410, 2415, 2420, 2425, 24305 days after each 5-day block
D-2242Payment arrangements: operations between participants2435, 2440, 2445, 2450, 2455, 24605 days after each 5-day block
D-2251Insurance, private pension and capitalization3015, 3020, 3025, 3030, 3405, 34107 days after each 7-day block
D-2252Property and casualty, and life insurance without survival coverage3005, 3010By the 6th of the following month
D-3201Health plans5010, 5020, 5030, 50507 days after each 7-day block
D-4201Lotteries and betting60107 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:

3. Two ways to send

REST API (single)Batch API
EndpointPOST /sales/ (sales), POST /refunds/ (refunds)POST /transaction-batches/
Records per request1Up to 10,000
ResponseSynchronous, validated in the response202 Accepted + batch_id, result per record
Recalculates IBS/CBS (use_tax_engine)Yes, optionalNo. Batches never run the tax engine: taxes come ready on each item
Best forContinuous, operation-by-operation integrationDaily 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 taxes array, in the same format. They are not part of DeRE.

4.1 Header fields

FieldRequiredDescription
transaction_external_idYesOperation 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_idYesBrinta ID of the declaring company (the CNPJ registered in D-1001).
invoice_dateYesOperation date and time (ISO 8601). Sets the DeRE period and sub-period.
typeYessale for sales. Refunds go to /refunds/.
currencyYesBRL.
statusYescompleted for finished operations.
use_tax_engineNoSee section 5.
buyerYesCustomer: 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" }
]
listcodePurpose
DeRE typeAlways DeREFlags the operation as a DeRE transaction
codBC4-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 code field 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

Taxnametypelevelcode
State IBSIBSVATstatecodBC
Municipal IBSIBSVATmunicipality (or city)codBC
CBSCBSVATcountrycodBC
  • code is optional: if sent, it is the codBC and must match the codBC category (section 4.2).
  • IBS is sent as two lines, one per level: state and municipality (city is also accepted). Do not send a single consolidated IBS line.
  • taxable_amount is 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.
  • rate is a decimal (0.001 = 0.1%). Brinta converts it to the DeRE percentage.
  • amount is 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 and amount = 0. In D-2251, taxable_amount is 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 fieldAPI field
codBCitems[].taxes[].code (IBS and CBS) or items[].categories[].{"list": "codBC", code: ### }
CPF / CNPJbuyer.tax_registrations[].number, with type CPF or CNPJ
cMunbuyer.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
dhOperinvoice_date
vLiqOper / vOperitems[].amount
vISSQNPropISS tax
vISSQNOutroISS Outro tax (ISS of other arrangement participants)
vPisCofinsPIS + COFINS taxes
vBCApur, vBCTribtaxable_amount of the IBS/CBS lines
pIBSUFTrib, vIBSUFTribIBS level: state: rate and amount
pIBSMunTrib, vIBSMunTribIBS level: municipality: rate and amount
pCBSTrib, vCBSTribCBS: 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:

EventAdditional dataAPI field
D-2202, D-4201Municipality where the service was provided or the bet was placed (cMunOper)buyer.physical_address.municipality_code
D-2202, D-4201In-person operation (indPresenc, indApostaPresenc)Derived: with buyer.physical_address = 1 (in person); without = 0
D-2211, D-2221Contract referenced in foreign currency (indMoedaEstr)Derived from currency (other than BRL), with exchange_rate
D-2231, D-3201, D-4201Operation value (vOper)items[].amount
D-2201Service recipient, only when different from the buyer (CPF/CNPJ, municipality, NIF/country)beneficiaries[].company, with role_external = recipient. Without beneficiaries[], the buyer applies.
D-2242Type 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-2251IBS 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 capitalizationIBS lines with taxable_amount = base, rate and amount = 0 (section 4.3)
D-2251Insured persons and each one's base (vBCDistrSeg)beneficiaries[].company, with role_external = insured, and beneficiaries[].amount
D-2251Buyer identification indicator (indIdentifAdq: 0 not required, 1 required), for capitalizationitems[].categories[] with list = "DeRE indIdentifAdq"
D-2251Place of sale (cMunOper), for capitalization without buyer identificationbuyer.physical_address.municipality_code
D-2251, D-3201Contract type (tpContrato)items[].categories[] with list = "DeRE tpContrato"
D-2251, D-2252, D-4201Point of sale (CPF/CNPJ)senders[].company, with role_external = point_of_sale
D-3201Primary beneficiaries (CPF, birth date) and amount per primary beneficiary (vTitularDep)beneficiaries[].company, with role_external = policyholder and date_of_birth, and beneficiaries[].amount
D-3201Dependents (birth date)beneficiaries[].company.participants[], with role_external = dependent and date_of_birth
D-3201Contract number (idContrato)items[].external_item_id
D-3201Related entity CNPJ (CNPJEntidRelac), for group contracts with a benefits administratorsenders[].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

ValueWhen to useWhat Brinta does
falseThe client already has the tax base and IBS/CBS calculatedStores the taxes exactly as sent. Nothing is recalculated.
true or omittedThe client sends the operation without IBS/CBS, or wants Brinta to calculate itBrinta 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 POST returns {id, status: "in_process"} and the result comes from GET /tax-id-validations/{id} or a webhook.
  • If the buyer is already a company in Brinta, validate with company_id (or company_external_id) and "update_company": true: the official data is stored and can be referenced as buyer in transactions.
  • You can also validate inside the transaction itself by sending "tax_id_validation": true on buyer. 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.json

The 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 = DeRE and codBC = the operation's codBC on every item.

  • IBS in two lines (state and municipality) and CBS in country. If you send code on those lines, it must match the codBC category.

  • use_tax_engine decided (false if 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 when refunded (service already rendered).

More on the Batch API: https://docs.brinta.com/docs/batch-transactions


Did this page help you?