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
- R-2010: a tomador de serviços com cessão de mão de obra / empreitada that retains 11% (INSS) on the nota fiscal de serviço — reports the prestador (CNPJ) and the retention.
- R-4020: retenções de IR, CSLL, PIS/Pasep and COFINS on payments to a beneficiário pessoa jurídica.
- Período events are consolidated by R-2099 (série R-2000) / R-4099 (série R-4000), which liberate the values to the DCTFWeb.
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
- R-2010:
vlrRetencao=vlrBaseRet× 11% (cessão de mão de obra / empreitada); retenção adicional de 2%/3%/4% when the activity has aposentadoria especial. vlrTotalBaseRetandvlrTotalRetPrincper prestador são a soma das notas (nfs/infoTpServ).- R-4020: apply the IRRF table/aliquot per natureza, CSLL/PIS/COFINS at the combined or separate alíquotas conforme o tipo de serviço (e.g. 1,5% IR, 1,0% CSLL, 0,65% PIS, 3,0% COFINS).
- Período events must be fechados by R-2099/R-4099; the consolidated retentions feed the DCTFWeb for the period.
- Retification:
indRetif=2with thenrReciboof the event being retificado.
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
- Correct event chosen (R-2010 retenção previdenciária / R-4020 IR-CSLL-PIS-COFINS) and current leiaute/versão namespace used;
tpAmbcorrect -
Idof 36 characters well-formed;perApur(AAAA-MM) correct;indRetif/nrReciboset when retificando -
ideContrinrInscis the CNPJ raiz (8 dígitos);nrInscEstabthe CNPJ completo do tomador;cnpjPrestadorvalid - R-2010:
vlrRetencao= base × 11% (+ adicional when aposentadoria especial); totais por prestador reconcile with the notas - R-4020: IR/CSLL/PIS/COFINS aliquots correct per natureza; bases e valores conferem
- Event signed with certificado ICP-Brasil; schema-valid against the EFD-Reinf XSD
- Sent and recibo obtained; R-2099/R-4099 fecha o período so the retentions flow to the DCTFWeb
Last updated: 2026-06-04 — confirm the active layout version, field codes, and SEFAZ/Receita Federal requirements against the current specifications before use.