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 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.

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.

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",
      "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

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 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

Em 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

Tributonametypelevelcode
IBS estadualIBSVATstatecodBC
IBS municipalIBSVATmunicipality (ou city)codBC
CBSCBSVATcountrycodBC
  • 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: 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.

4.4 Do JSON ao evento DeRE

Campo DeRECampo na API
codBCitems[].taxes[].code (IBS e CBS)
CPF / CNPJbuyer.tax_registrations[].number, com type CPF ou CNPJ
cMunbuyer.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_OPERACAOtransaction_external_id
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.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.

EventoDados adicionaisEnvio na API
D-2202Município do estabelecimento onde o serviço foi prestado (cMunOper)buyer.physical_address.municipal_code
D-2202Serviço fruído presencialmente por pessoa física (indPresenc)Definido na implementação
D-2211, D-2221Contrato referenciado em moeda estrangeira (indMoedaEstr)Derivado de currency (diferente de BRL), com exchange_rate
D-2231Parcela recebida do arrendamento, incluindo tarifa (vOper)items[].amount
D-2241Destinatá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-2242Tipo de participação no arranjo (tpParticip)company.role_external
D-2251Lista de segurados (CPF/CNPJ, município, NIF/país)beneficiaries[].company
D-2251Indicador 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-4201Ponto de venda (CPF/CNPJ)senders[].company, com role_external
D-3201Beneficiários titulares e dependentes (CPF, data de nascimento)beneficiaries[].company, com role_external (titular ou dependente) e date_of_birth
D-3201Contrato (idContrato, tpContrato), CNPJ da entidade relacionada e valor por titularDefinido na implementação
D-3201Valor total recebido (vOper)items[].amount
D-4201Município das apostas presenciais (cMunOper)buyer.physical_address.municipal_code
D-4201Aposta 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

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 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 = 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.
  • 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.

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 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.

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.

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 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

On 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

Taxnametypelevelcode
State IBSIBSVATstatecodBC
Municipal IBSIBSVATmunicipality (or city)codBC
CBSCBSVATcountrycodBC
  • code is 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: 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.

4.4 From JSON to DeRE event

DeRE fieldAPI field
codBCitems[].taxes[].code (IBS and CBS)
CPF / CNPJbuyer.tax_registrations[].number, with type CPF or CNPJ
cMunbuyer.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_OPERACAOtransaction_external_id
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.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.

EventAdditional dataAPI field
D-2202Municipality of the establishment where the service was provided (cMunOper)buyer.physical_address.municipal_code
D-2202Service used in person by an individual (indPresenc)Defined during implementation
D-2211, D-2221Contract referenced in foreign currency (indMoedaEstr)Derived from currency (other than BRL), with exchange_rate
D-2231Lease installment received, including fees (vOper)items[].amount
D-2241Service 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-2242Type of participation in the arrangement (tpParticip)Defined during implementation
D-2251List of insured persons (CPF/CNPJ, municipality, NIF/country)beneficiaries[].company
D-2251Buyer 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-4201Point of sale (CPF/CNPJ)senders[].company, with role_external
D-3201Primary beneficiaries and dependents (CPF, birth date)beneficiaries[].company, with role_external (primary or dependent) and date_of_birth
D-3201Contract (idContrato, tpContrato), related entity CNPJ and amount per primary beneficiaryDefined during implementation
D-3201Total amount received (vOper)items[].amount
D-4201Municipality of in-person bets (cMunOper)buyer.physical_address.municipal_code
D-4201In-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

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 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 type category = DeRE on every item.
  • IBS as two lines (state and municipality) and CBS as country, all with the codBC in code.
  • 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.
  • Test batch validated with dry_run: true.

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


Did this page help you?