FinchContext
Run with

Build EFD-Reinf Event XML (R-2010 Retenção de Contribuição Previdenciária)

Skill: Convert withholding/service data into an EFD-Reinf event XML

Region: Brazil (Brasil) Category: Payroll/Tax — EFD-Reinf (Escrituração Fiscal Digital de Retenções e Outras Informações Fiscais) Does: Takes service-taking / withholding data and produces an EFD-Reinf event XML — e.g. R-2010 (Retenção de contribuição previdenciária — serviços tomados / cessão de mão de obra, 11%) or R-4020 (Retenções na fonte — IR/CSLL/PIS/COFINS — beneficiário pessoa jurídica) — per the leiaute do EFD-Reinf, signed with certificado ICP-Brasil and transmitted to the EFD-Reinf web service, returning a recibo. Standard: EFD-Reinf — leiaute vigente (Schemas XSD do EFD-Reinf, MOS)

EFD-Reinf reports retentions and other fiscal information not covered by eSocial. Each event is an individual signed XML, identified by a 36-character Id. The período events (R-2010/R-2020/R-2098 → R-2099 fechamento, and the R-4000 série) must be closed by the respective evento de fechamento so the apurado feeds the DCTFWeb. Confirm the active leiaute version and the correct event before use.


When this applies


Input data required

Group Fields
Identificação do evento (ideEvento) indRetif, perApur (AAAA-MM), tpAmb, procEmi, verProc
Contribuinte (ideContri) tpInsc (1 CNPJ), nrInsc (CNPJ raiz, 8 dígitos)
Estabelecimento (ideEstabObra) tpInscEstab, nrInscEstab (CNPJ completo do tomador)
Prestador (idedPrest) tpInscPrest, nrInscPrest (CNPJ do prestador)
Nota fiscal (nfs) serie, numDocto, dtEmissaoNF, vlrBruto
Retenção (infoTpServ) tpServico, vlrBaseRet, vlrRetencao (11%), vlrRetSub, adicionais/destacadas

Document structure (R-2010)

Reinf (xmlns="http://www.reinf.esocial.gov.br/schemas/evt2010PrestadorServicos/v_..._00")
└── evtServTom Id="ID1<CNPJ8><...><seq>"
    ├── ideEvento  (indRetif, perApur, tpAmb, procEmi, verProc)
    ├── ideContri  (tpInsc=1, nrInsc = CNPJ raiz 8 dígitos)
    └── infoServTom
        └── ideEstabObra (tpInscEstab, nrInscEstab — CNPJ completo do tomador)
            └── ideePrestServ (cnpjPrestador, vlrTotalBruto, vlrTotalBaseRet, vlrTotalRetPrinc)
                └── nfs (serie, numDocto, dtEmissaoNF, vlrBruto)
                    └── infoTpServ (tpServico, vlrBaseRet, vlrRetencao, ...)
    └── Signature (ds:Signature, ICP-Brasil)

R-4020 (evtRetPJ) carries ideEstab/ideBenef with infoRetPagtoPJ for IR/CSLL/PIS/COFINS.


Calculation rules


Worked example (R-2010, one nota, outline)

<?xml version="1.0" encoding="UTF-8"?>
<Reinf xmlns="http://www.reinf.esocial.gov.br/schemas/evt2010PrestadorServicos/v2_01_02">
  <evtServTom Id="ID1123456780000002026060411000000001">
    <ideEvento>
      <indRetif>1</indRetif>
      <perApur>2026-05</perApur>
      <tpAmb>1</tpAmb>
      <procEmi>1</procEmi>
      <verProc>ReinfExemplo-1.0</verProc>
    </ideEvento>
    <ideContri>
      <tpInsc>1</tpInsc>
      <nrInsc>12345678</nrInsc>
    </ideContri>
    <infoServTom>
      <ideEstabObra>
        <tpInscEstab>1</tpInscEstab>
        <nrInscEstab>12345678000195</nrInscEstab>
        <ideePrestServ>
          <cnpjPrestador>98765432000110</cnpjPrestador>
          <vlrTotalBruto>10000.00</vlrTotalBruto>
          <vlrTotalBaseRet>10000.00</vlrTotalBaseRet>
          <vlrTotalRetPrinc>1100.00</vlrTotalRetPrinc>
          <nfs>
            <serie>1</serie>
            <numDocto>456</numDocto>
            <dtEmissaoNF>2026-05-20</dtEmissaoNF>
            <vlrBruto>10000.00</vlrBruto>
            <infoTpServ>
              <tpServico>100000001</tpServico>
              <vlrBaseRet>10000.00</vlrBaseRet>
              <vlrRetencao>1100.00</vlrRetencao>
            </infoTpServ>
          </nfs>
        </ideePrestServ>
      </ideEstabObra>
    </infoServTom>
  </evtServTom>
  <!-- Signature ICP-Brasil -->
</Reinf>

The signed event is transmitted to the EFD-Reinf web service, returning the recibo; after R-2099 the retentions feed the DCTFWeb.


Validation checklist


Last updated: 2026-06-04 — confirm the active layout version, field codes, and SEFAZ/Receita Federal requirements against the current specifications before use.