Generate NFS-e Padrão Nacional (DPS → NFS-e) XML
Skill: Convert a service invoice into the national-standard NFS-e via the DPS sent to the ADN
Region: Brazil (Brasil) Category: E-Invoicing — Nota Fiscal de Serviço eletrônica (NFS-e) Does: Takes ordinary service-invoice data and produces the DPS (Declaração de Prestação de Serviços) XML in the NFS-e Padrão Nacional layout (ABRASF-derived national standard, ISSQN), submitted to the Ambiente de Dados Nacional (ADN), which returns the authorized NFS-e XML. Standard: NFS-e Padrão Nacional — layout do Sistema Nacional NFS-e (Reforma/Convênio NFS-e)
Under the national standard, the taxpayer emits a DPS which the ADN converts into an authorized NFS-e carrying a 50-digit chave de acesso (
Id="NFS<50 digits>"). The DPS is signed with a certificado ICP-Brasil. Municipalities that have adhered (conveniados) route through the ADN; some still run their own ABRASF/proprietary webservices. Confirm the active leiaute (versão XSD) and whether the destination município is integrated before use.
When this applies
- Provision of services (ISSQN / ISS) that require an NFS-e, for municípios adhering to the Padrão Nacional (emission via portal web, app, or API of the Sistema Nacional NFS-e).
- ISSQN is a municipal tax; the município of incidence depends on the service item (Lista de Serviços da LC 116/2003) and the local-vs-establishment rule.
Input data required
| Group | DPS fields |
|---|---|
| Identificação DPS | tpAmb, dhEmi, verAplic, serie, nDPS, dCompet (competência), tpEmit |
Prestador (prest) |
CNPJ/CPF, IM (inscrição municipal), xNome, regime (regTrib/opSimpNac) |
Tomador (toma) |
CNPJ/CPF/NIF, xNome, endereço, email |
Serviço (serv) |
cTribNac (código de tributação nacional), cServ municipal, xDescServ, cLocIncid (município de incidência) |
Valores (valores) |
vServPrest/vServ, vDescIncond, deduções, pAliqAplic, vISSQN |
ISSQN (tribMun) |
tribISSQN, tpRetISSQN (retido na fonte ou não), cLocIncid |
| Retenções federais | IRRF, PIS, COFINS, CSLL, INSS quando aplicável |
Document structure (DPS / NFS-e)
DPS versao="1.00"
└── infDPS Id="DPS<...>"
├── tpAmb, dhEmi, verAplic, serie, nDPS, dCompet, tpEmit
├── prest (CNPJ/CPF, IM, xNome, regTrib)
├── toma (CNPJ/CPF/NIF, xNome, end)
├── serv
│ ├── locPrest/cLocIncid
│ ├── cServ (cTribNac, cTribMun, xDescServ)
│ └── valores (vServPrest, trib/tribMun/tribFed)
└── (Signature ICP-Brasil)
NFS-e versao="1.00" ← authorized result from the ADN
└── infNFSe Id="NFS<50 digits>"
├── chave de acesso (50), nNFSe, dhProc, emit (ADN/município)
└── DPS (the submitted infDPS) + valores/trib computed
Calculation rules
- Base de cálculo do ISSQN =
vServ− deduções permitidas − descontos incondicionados. vISSQN= base ×pAliqAplic(municipal rate, typically 2% to 5% per LC 116; floor of 2%).- ISS retido na fonte: when
tpRetISSQNindicates retention, the tomador withholds and recolhe; the prestador's líquido is reduced accordingly. - Simples Nacional prestadores: ISS is collected within the DAS; set the regime flag (
opSimpNac) so the layout suppresses separate ISS calculation when applicable. - Federal withholdings (IRRF, PIS/COFINS/CSLL, INSS) computed per the corresponding rules and reported in
tribFed.
Worked example (one service, outline)
<?xml version="1.0" encoding="UTF-8"?>
<DPS xmlns="http://www.sped.fazenda.gov.br/nfse" versao="1.00">
<infDPS Id="DPS3550308212345678000195000000000000123">
<tpAmb>1</tpAmb>
<dhEmi>2026-06-04T11:00:00-03:00</dhEmi>
<verAplic>NFSe-PadraoNacional-1.00</verAplic>
<serie>00001</serie><nDPS>123</nDPS>
<dCompet>2026-06-01</dCompet><tpEmit>1</tpEmit>
<cLocEmi>3550308</cLocEmi>
<prest>
<CNPJ>12345678000195</CNPJ><IM>123456</IM>
<xNome>Consultoria Exemplo LTDA</xNome>
<regTrib><opSimpNac>1</opSimpNac><regEspTrib>0</regEspTrib></regTrib>
</prest>
<toma>
<CNPJ>98765432000110</CNPJ><xNome>Cliente Servicos SA</xNome>
<end><endNac><cMun>3509502</cMun><CEP>13010000</CEP></endNac><xLgr>Rua Comercio</xLgr><nro>50</nro></end>
</toma>
<serv>
<locPrest><cLocPrestacao>3550308</cLocPrestacao></locPrest>
<cServ>
<cTribNac>010201</cTribNac>
<cTribMun>0102</cTribMun>
<xDescServ>Servicos de consultoria em gestao empresarial</xDescServ>
</cServ>
</serv>
<valores>
<vServPrest><vServ>10000.00</vServ></vServPrest>
<trib>
<tribMun>
<tribISSQN>1</tribISSQN><cLocIncid>3550308</cLocIncid>
<pAliq>5.00</pAliq><tpRetISSQN>1</tpRetISSQN>
</tribMun>
<totTrib><indTotTrib>0</indTotTrib></totTrib>
</trib>
</valores>
</infDPS>
<!-- Signature ICP-Brasil -->
</DPS>
The ADN returns an authorized NFSe with infNFSe Id="NFS<50 digits>", the computed vISSQN (10000.00 × 5% = 500.00) and the national chave de acesso.
Validation checklist
- Current NFS-e Padrão Nacional leiaute/versão used;
tpAmbcorrect (produção/homologação) - Destination município is conveniado (integrated with the ADN), or the proprietary municipal webservice is used instead
-
prestCNPJ/CPF + IM and regime (Simples Nacional flag) correct;tomaidentified - Service classified by
cTribNac(national code) andcTribMun;cLocIncid= município de incidência per LC 116 -
vISSQN= base × alíquota (2–5%); ISS retido na fonte flagged correctly; federal withholdings intribFedif any - DPS signed with certificado ICP-Brasil; schema-valid against the layout XSD
- Authorized NFS-e returned by the ADN with 50-digit chave de acesso (
infNFSe@Id)
Last updated: 2026-06-04 — confirm the active layout version, field codes, and SEFAZ/Receita Federal requirements against the current specifications before use.