TF Fiscal

Other fiscal documents

DC-e Content Declaration

5 endpoints

The DC-e API (model 99, layout 1.00) lets you issue, consult, cancel and obtain the PDF (DACE) of electronic content declarations. The DC-e is the fiscal document that covers the transport of goods or merchandise when there is no obligation to issue an invoice — for example, shipments involving ICMS non-taxpayers. The issuer is always a legal entity (CNPJ); the recipient may be a legal entity (CNPJ) or an individual (CPF). The business data goes in the /create body; the technical access-key fields (cDC, cDV, cUF, dhEmi, mod) are calculated automatically by the server.

EndpointMethodDescription
/api/dce/createPOSTIssue DC-e
/api/dce/consultPOSTConsult the status of the DC-e
/api/dce/cancelPOSTCancel an authorized DC-e
/api/dce/pdfPOSTObtain the DACE (PDF) of the DC-e

The DC-e is routed to the authorizer of the issuer's state (UF). The ide.cUF field must be consistent with the UF informed in emit.enderEmit.UF — tax authority rejects with cStat=220 when they diverge; if omitted, cUF is derived from that UF.

POST/api/dce/create

Issue DC-e

Issues a DC-e from the submitted body. The client sends only the business data; the technical access-key identification fields are calculated by the server (see the note below the ide table). Credit is debited only in production (tpAmb=1) and when the DC-e is authorized.

Required headers

HeaderTypeDescription
tokenstringToken of the issuing company
signstringMD5 signature: MD5(token + path + body + timestamp)
timestampstringUnix timestamp in seconds (5-minute window)

Body — root

FieldTypeDescription
ide *objectDC-e identification
emit *objectIssuer/sender data (CNPJ; or CPF via Marketplace — see below)
dest *objectRecipient data
det *arrayDeclared items/goods — minimum 1
total *objectDeclaration totalizer
transpobjectTransport data
marketplaceobjectMarketplace data (only when ide.tpEmit=1)
fiscoobjectTax authority body data (only when ide.tpEmit=0)
autXMLarrayCNPJs/CPFs authorized to access the XML
infAdicobjectAdditional information
Required fields in the request: ide.tpAmb; emit.CNPJ (14 digits) or emit.CPF (11 digits, individual sender via Marketplace — see the note under emit), emit.xNome and emit.enderEmit (xLgr, nro, xBairro, cMun, xMun, CEP with 8 digits, UF); dest with CNPJ or CPF, dest.xNome and dest.enderDest (same address fields); at least 1 item in det with xProd, NCM (2 or 8 digits), qCom > 0 and vProd > 0; and total.vDC > 0. All other fields are optional.

ide — Identification

FieldTypeDescription
tpAmb *intEnvironment: 1=production, 2=staging. The only truly required field of ide.
tpEmitintIssuer type: 0=Tax Authority Application, 1=Marketplace, 2=Own issuer. Optional — default: 2
cUFintIBGE code of the issuer's UF (2 digits). Optional — derived from emit.enderEmit.UF when omitted. If sent, it must be consistent with that UF (tax authority rejects with cStat=220 in case of divergence)
serieintFiscal document series (3 digits of the access key) — identifies the DC-e numbering set. Optional — default: DC-e series registered for the company
nDClongSequential DC-e number (part of the access key). Optional — auto-incremented by the server when omitted or 0
nSiteAutorizintIdentification of the authorizer site that processed the DC-e (1 digit of the access key). Usually 0 (primary site). Optional — default: 0
tpEmisintIssuance method: 1=Normal, 9=Contingency. Optional — default: 1

Filled in automatically by the server — you do not need to send them: mod (fixed at 99) and cDV (key check digit) are always set by the server; cDC (6-digit numeric code), dhEmi (issuance date/time) and verProc (process version) are generated when omitted. The serie, nDC and cUF fields in the table above are also filled in automatically when omitted.

emit — Issuer / Sender

FieldTypeDescription
CNPJ ⚠stringIssuer's CNPJ (14 digits). Filled in with the CNPJ of the token's company when omitted
CPF ⚠stringCPF of the individual sender (11 digits). Only allowed for issuance via Marketplace — see note below
xNome *stringIssuer's/sender's name or company name
enderEmit *objectIssuer's address (see structure below)
Individual sender (CPF): by the tax authority rules, a CPF cannot be its own issuer (tpEmit=2 requires a CNPJ). To issue with a CPF as the sender, just send emit.CPF (without emit.CNPJ): the server automatically sets tpEmit=1 (Marketplace), uses your company's CNPJ (from the token) as the authorized issuer in the access key, and fills the marketplace block with the company's data. The CPF you provide appears as the sender in emit.

dest — Recipient

FieldTypeDescription
CNPJ ⚠stringRecipient's CNPJ (14 digits)
CPF ⚠stringRecipient's CPF (11 digits)
xNome *stringRecipient's name or company name
enderDest *objectRecipient's address (see structure below)

enderEmit / enderDest — Address

FieldTypeDescription
xLgr *stringStreet
nro *stringNumber
xCplstringComplement
xBairro *stringNeighborhood
cMun *longIBGE municipality code (7 digits)
xMun *stringMunicipality name
CEP *stringPostal code (8 digits)
UF *stringState abbreviation (2 letters)
cPaisintCountry code. Default: 1058 (Brazil)
xPaisstringCountry name. Default: BRASIL
fonestringPhone
emailstringE-mail

det[] — Declared items

FieldTypeDescription
nItemintSequential item number
xProd *stringDescription of the declared good/merchandise
NCM *stringNCM code (2 or 8 digits)
qCom *decimalQuantity (> 0)
vUnComdecimalUnit value
vProd *decimalTotal item value (> 0)
infAdProdstringAdditional item information

total — Totalizer

FieldTypeDescription
vDC *decimalTotal declared value (> 0)

transp — Transport

FieldTypeDescription
modTransintTransport mode: 0=Postal service, 1=own, 2=carrier. Default: 2
CNPJTranspstringCarrier's CNPJ

marketplace — Marketplace (only tpEmit=1)

FieldTypeDescription
CNPJstringMarketplace's CNPJ
xNomestringMarketplace name
SitestringMarketplace website

fisco — Tax authority body (only tpEmit=0)

FieldTypeDescription
CNPJstringBody's CNPJ
xOrgaostringBody name
UFstringBody's UF

autXML[] — Authorized for XML

FieldTypeDescription
CNPJstringCNPJ authorized to consult/download the XML
CPFstringCPF authorized to consult/download the XML

infAdic — Additional information

FieldTypeDescription
infAdFiscostringInformation of interest to the tax authority
infCplstringSupplementary information of interest to the taxpayer
infAdMarketPlacestringAdditional marketplace information

* Required field. ⚠ In the issuer and in the recipient, at least one of CNPJ or CPF is required.

POST/api/dce/consult

Consult the status of the DC-e

Consults the current status of the DC-e at the tax authority from the access key. When the DC-e is canceled, the response reflects the cancellation data (the local database is the source of truth about cancellation).

Required headers

HeaderTypeDescription
tokenstringToken of the issuing company
signstringMD5 signature
timestampstringUnix timestamp in seconds

Body

FieldTypeDescription
chDCe *stringDC-e access key (44 digits)

* Required field.

POST/api/dce/cancel

Cancel DC-e

Cancels an authorized DC-e (event 110111). Requires that the DC-e has been authorized (has a protocol) and is not yet canceled. Each DC-e allows a single cancellation.

Required headers

HeaderTypeDescription
tokenstringToken of the issuing company
signstringMD5 signature
timestampstringUnix timestamp in seconds

Body

FieldTypeDescription
chDCe *stringDC-e access key (44 digits)
xJust *stringCancellation justification (minimum 15 characters as required by the tax authority)
nProtstringAuthorization protocol. Optional: when omitted, uses the protocol registered at issuance

* Required field.

In case of rejection, the response returns success=false, the cStat/xMotivo of the refusal and an additional field xmlEnviadoDebug with the XML that was sent, for diagnosis.

POST/api/dce/pdf

Get DC-e PDF

Returns the URL of the DACE — the PDF representation of the DC-e. When the PDF does not yet exist in storage, it is generated on demand and uploaded. If storage is unavailable, the PDF is returned as base64 in the response body itself.

Required headers

HeaderTypeDescription
tokenstringToken of the issuing company
signstringMD5 signature
timestampstringUnix timestamp in seconds

Body

FieldTypeDescription
chDCe *stringDC-e access key (44 digits)

* Required field.

GET/api/dce/get_list

List DC-e (paginated)

Lists the company's DC-e with pagination. Parameters are passed via query string (not in the body). The time filter is optional, but if used, both start_create_time and end_create_time are required.

Required headers

HeaderTypeDescription
tokenstringIssuing company token
signstringMD5 signature (path includes the query string)
timestampstringUnix timestamp in seconds

Query string

ParameterTypeDescription
page *intPage number (≥ 1)
page_size *intPage size (1–50)
start_create_timelongUnix timestamp in milliseconds — start (requires end_create_time)
end_create_timelongUnix timestamp in milliseconds — end
statusstringFilter by status. Values: "Success" (authorized), "Canceled" (canceled), "Processing" (processing), "Failed" (failed), "Unknown" (unknown)

* Required field.