This connector uses the Fiscal Defender REST API with an API token, sent as a Bearer token. Each token has its own read permissions (
company:read, nfse:read, nfe:read, nfce:read, cte:read). Streams whose permission is missing on the token are skipped, and their tables are not updated.1. Add your Fiscal Defender access
-
In Fiscal Defender, go to Configurações > Tokens API and click Gerar Token. Grant the read permissions of the documents you want to bring to Nekt and copy the token (it starts with
fd_). - In the Sources tab, click on the “Add source” button located on the top right of your screen. Then, select the Fiscal Defender option from the list of connectors.
-
Click Next and you’ll be prompted to fill the configuration.
- API Token: The Fiscal Defender API token you created.
- Start Date (advanced): The earliest emission date to sync on the first run. Defaults to full history.
- Lookback (days) (advanced): How many days before the last synced emission date every run looks again. Defaults to 7.
- Click Next.
Fiscal Defender only filters documents by emission date, but documents keep changing after they are emitted (cancellations, events) and can reach Fiscal Defender days later. On every run, the connector re-extracts the documents emitted within the lookback window, so these changes are reflected in your tables. Increase it if you need to catch older changes, at the cost of longer runs.
2. Select your Fiscal Defender streams
-
The next step is letting us know which streams you want to bring. You can select entire groups of streams or only a subset of them.
Tip: The stream can be found more easily by typing its name.
- Click Next.
3. Configure your Fiscal Defender data streams
-
Customize how you want your data to appear in your catalog. Select the desired layer where the data will be placed, a folder to organize it inside the layer, a name for each table (which will effectively contain the fetched data) and the type of sync.
- Layer: choose between the existing layers on your catalog. This is where you will find your new extracted tables as the extraction runs successfully.
- Folder: a folder can be created inside the selected layer to group all tables being created from this new data source.
- Table name: we suggest a name, but feel free to customize it. You have the option to add a prefix to all tables at once and make this process faster!
- Sync Type: depending on the data you are bringing to the lake, you can choose between INCREMENTAL and FULL_TABLE. Read more about Sync Types here.
- Click Next.
4. Configure your Fiscal Defender data source
- Describe your data source for easy identification within your organization. You can inform things like what data it brings, to which team it belongs, etc.
- To define your Trigger, consider how often you want data to be extracted from this source.
- Optionally, you can define some additional settings (if available).
Check your new source!
- Click Next to finalize the setup. Once completed, you’ll receive confirmation that your new source is set up!
- You can view your new source on the Sources page. Now, for you to be able to see it on your Catalog, you have to wait for the pipeline to run. If needed, manually trigger the pipeline by clicking on the refresh icon.
Fiscal Defender allows 120 API requests per minute, and the NFS-e, NF-e, and NFC-e streams make one request per document to load its full details. The first run over a long history can take a few hours; later runs only cover the documents in the lookback window.
If you encounter any issues, reach out to us, and we’ll gladly assist you!
Streams and Fields
Below you’ll find all available data streams from Fiscal Defender.Companies
Companies
Companies (CNPJs) registered in your Fiscal Defender account, with sync status and digital certificate validity. Synced as a full table on every run.Fields:
id:String- Unique identifier of the company in Fiscal Defendercnpj:String- Company CNPJ (digits only)razaoSocial:String- Company legal name (razão social)nomeFantasia:String- Company trade name (nome fantasia)isActive:Boolean- Whether the company is active in the accountcreatedAt:DateTime- Timestamp when the company was registeredupdatedAt:DateTime- Timestamp of the last update to the companysyncInterval:String- How often documents are synced from SEFAZ (e.g. DAILY)syncIsActive:Boolean- Whether automatic document sync is enabled for the companysyncLastSyncAt:DateTime- Timestamp of the last document syncsyncNextSyncAt:DateTime- Timestamp of the next scheduled document syncsyncLastNsu:String- Last NSU (distribution sequence number) read for NFS-esyncNfeLastNsu:String- Last NSU read from the national NF-e distribution servicesyncCteLastNsu:String- Last NSU read from the national CT-e distribution servicesyncNfeEstadualLastNsu:String- Last NSU read from the state NF-e servicesyncCteEstadualLastNsu:String- Last NSU read from the state CT-e servicesyncNfceEstadualLastNsu:String- Last NSU read from the state NFC-e servicesyncLastNsuEmitidas:String- Last NSU read for documents issued by the companysyncLastNsuRecebidas:String- Last NSU read for documents received by the companycertificateSerialNumber:String- Serial number of the company’s A1 digital certificatecertificateIssuer:String- Issuer (certificate authority) of the digital certificatecertificateValidFrom:DateTime- Start of the digital certificate’s validitycertificateValidUntil:DateTime- Expiration of the digital certificatenfseCount:Integer- Number of NFS-e stored for the company
NFS-e
NFS-e
Service invoices (NFS-e) issued or received by your companies, with the full tax breakdown, addresses, and cancellation date. Synced incrementally on the emission date, with the lookback window re-checking recent documents.Fields:
chaveAcesso:String- NFS-e access key, unique identifier of the documentid:String- Internal identifier of the document in Fiscal DefendertenantId:String- Fiscal Defender account (tenant) that owns the documentcompanyId:String- Identifier of the company (see companies stream) the document belongs totipo:String- Whether the company issued (EMITIDA) or received (RECEBIDA) the documentnsu:String- NSU (distribution sequence number) the document was read withnumero:String- NFS-e numberserie:String- DPS seriesnumeroDps:String- DPS (Declaração de Prestação de Serviço) numberdataEmissao:DateTime- Emission timestamp, used as the incremental replication keycompetencia:DateTime- Accrual date (competência) of the servicedataProcessamento:DateTime- Timestamp the document was processed by the tax authoritysituacao:String- Document status: NORMAL, CANCELADA or SUBSTITUIDAcanceladaEm:DateTime- Cancellation timestamp, when cancelledprestadorCnpj:String- Service provider CNPJprestadorRazaoSocial:String- Service provider legal nameprestadorNomeFantasia:String- Service provider trade nameprestadorMunicipio:String- Service provider city (IBGE code)prestadorUf:String- Service provider state (UF)prestadorLogradouro:String- Service provider streetprestadorNumero:String- Service provider street numberprestadorComplemento:String- Service provider address complementprestadorBairro:String- Service provider neighborhoodprestadorCep:String- Service provider postal code (CEP)tomadorCnpj:String- Service taker CNPJtomadorRazaoSocial:String- Service taker legal nametomadorMunicipio:String- Service taker city (IBGE code)tomadorUf:String- Service taker state (UF)tomadorLogradouro:String- Service taker streettomadorNumero:String- Service taker street numbertomadorComplemento:String- Service taker address complementtomadorBairro:String- Service taker neighborhoodtomadorCep:String- Service taker postal code (CEP)tomadorEmail:String- Service taker emailmunicipioPrestacao:String- City where the service was provided (IBGE code)descricaoServico:String- Description of the service providedcodigoServico:String- Service code (national service list)cnae:String- CNAE activity code of the servicevalorServico:Number- Gross service amountvalorDeducoes:Number- Deductions amountvalorDescIncond:Number- Unconditional discount amountvalorDescCond:Number- Conditional discount amountbaseCalculo:Number- ISS tax basealiquotaIss:Number- ISS rate (percent)valorIss:Number- ISS amountissRetido:Boolean- Whether ISS was withheld by the service takervalorPis:Number- PIS amountvalorCofins:Number- COFINS amountvalorCsll:Number- CSLL amountvalorIrrf:Number- Withheld income tax (IRRF) amountvalorInss:Number- INSS amountvalorLiquido:Number- Net amount of the NFS-everified:Boolean- Whether the document was marked as verified in Fiscal DefenderentryDate:DateTime- Bookkeeping entry date set in Fiscal DefenderxmlSize:Integer- Size of the stored XML, in bytesxmlReprocessadoEm:DateTime- Timestamp the XML was last reprocesseddanfseStatus:String- Generation status of the DANFSe (PDF)danfseGeneratedAt:DateTime- Timestamp the DANFSe (PDF) was generateddanfseAttempts:Integer- Number of DANFSe generation attemptsdanfseLastError:String- Last DANFSe generation errordownloadedAt:DateTime- First time the document was downloaded in Fiscal DefenderlastDownloadedAt:DateTime- Last time the document was downloaded in Fiscal DefenderxmlDownloadedAt:DateTime- Last time the XML was downloadeddanfseDownloadedAt:DateTime- Last time the DANFSe (PDF) was downloadedcreatedAt:DateTime- Timestamp the document entered Fiscal DefenderupdatedAt:DateTime- Timestamp of the last update to the document in Fiscal Defender
NF-e
NF-e
Goods invoices (NF-e, model 55) issued or received by your companies, with taxes, carrier, cancellation date, and events. Synced incrementally on the emission date, with the lookback window re-checking recent documents.Fields:
chaveAcesso:String- 44-digit access key, unique identifier of the documentid:String- Internal identifier of the document in Fiscal Defendernsu:String- NSU (distribution sequence number) the document was read withnProt:String- SEFAZ authorization protocol numbernumero:String- Document numberserie:String- Document seriestpAmb:Integer- SEFAZ environment: 1 = production, 2 = homologationtpNF:Integer- Operation type: 0 = inbound, 1 = outboundnatOp:String- Nature of the operation (natureza da operação)dataEmissao:DateTime- Emission timestamp, used as the incremental replication keydataProcessamento:DateTime- Timestamp the document was authorized by SEFAZsituacao:String- Document status: NORMAL, CANCELADA or DENEGADAcanceladaEm:DateTime- Cancellation timestamp, when cancelledpapelEmpresa:String- Role of the account’s company in the document: SAIDA (issuer) or ENTRADA (recipient)pendenteXml:Boolean- Whether only the summary is available and the full XML is still pendingemitenteCnpj:String- Issuer CNPJemitenteNome:String- Issuer nameemitenteMunicipio:String- Issuer cityemitenteUf:String- Issuer state (UF)destinatarioCnpj:String- Recipient CNPJdestinatarioCpf:String- Recipient CPF, when the recipient is a persondestinatarioNome:String- Recipient nametransportada:Boolean- Whether the document has a carriertransportadorCnpj:String- Carrier CNPJtransportadorCpf:String- Carrier CPFtransportadorNome:String- Carrier nametransportadorIe:String- Carrier state registration (IE)valorTotal:Number- Total amount of the documentvalorDesconto:Number- Discount amountvalorFrete:Number- Freight amountvalorSeguro:Number- Insurance amountvalorOutros:Number- Other expenses amountbcIcms:Number- ICMS tax basevalorIcms:Number- ICMS amountvalorIcmsDeson:Number- Relieved ICMS (ICMS desonerado) amountvalorIpi:Number- IPI amountvalorPis:Number- PIS amountvalorCofins:Number- COFINS amounteventos:String- Events registered for the document (cancellation, correction letter, recipient manifestation…), as a JSON array of objects with tipoEvento, descricao, codigoMotivo, dataEvento and protocoloverified:Boolean- Whether the document was marked as verified in Fiscal DefenderentryDate:DateTime- Bookkeeping entry date set in Fiscal DefenderxmlSize:Integer- Size of the stored XML, in bytescreatedAt:DateTime- Timestamp the document entered Fiscal Defender
NFC-e
NFC-e
Consumer invoices (NFC-e, model 65) issued by your companies, with the same fields as NF-e. Synced incrementally on the emission date, with the lookback window re-checking recent documents.Fields:
chaveAcesso:String- 44-digit access key, unique identifier of the documentid:String- Internal identifier of the document in Fiscal Defendernsu:String- NSU (distribution sequence number) the document was read withnProt:String- SEFAZ authorization protocol numbernumero:String- Document numberserie:String- Document seriestpAmb:Integer- SEFAZ environment: 1 = production, 2 = homologationtpNF:Integer- Operation type: 0 = inbound, 1 = outboundnatOp:String- Nature of the operation (natureza da operação)dataEmissao:DateTime- Emission timestamp, used as the incremental replication keydataProcessamento:DateTime- Timestamp the document was authorized by SEFAZsituacao:String- Document status: NORMAL, CANCELADA or DENEGADAcanceladaEm:DateTime- Cancellation timestamp, when cancelledpapelEmpresa:String- Role of the account’s company in the document: SAIDA (issuer) or ENTRADA (recipient)pendenteXml:Boolean- Whether only the summary is available and the full XML is still pendingemitenteCnpj:String- Issuer CNPJemitenteNome:String- Issuer nameemitenteMunicipio:String- Issuer cityemitenteUf:String- Issuer state (UF)destinatarioCnpj:String- Recipient CNPJdestinatarioCpf:String- Recipient CPF, when the recipient is a persondestinatarioNome:String- Recipient nametransportada:Boolean- Whether the document has a carriertransportadorCnpj:String- Carrier CNPJtransportadorCpf:String- Carrier CPFtransportadorNome:String- Carrier nametransportadorIe:String- Carrier state registration (IE)valorTotal:Number- Total amount of the documentvalorDesconto:Number- Discount amountvalorFrete:Number- Freight amountvalorSeguro:Number- Insurance amountvalorOutros:Number- Other expenses amountbcIcms:Number- ICMS tax basevalorIcms:Number- ICMS amountvalorIcmsDeson:Number- Relieved ICMS (ICMS desonerado) amountvalorIpi:Number- IPI amountvalorPis:Number- PIS amountvalorCofins:Number- COFINS amounteventos:String- Events registered for the document (cancellation, correction letter, recipient manifestation…), as a JSON array of objects with tipoEvento, descricao, codigoMotivo, dataEvento and protocoloverified:Boolean- Whether the document was marked as verified in Fiscal DefenderentryDate:DateTime- Bookkeeping entry date set in Fiscal DefenderxmlSize:Integer- Size of the stored XML, in bytescreatedAt:DateTime- Timestamp the document entered Fiscal Defender
CT-e
CT-e
Transport documents (CT-e and CT-e OS) involving your companies, with parties, amounts, ICMS, and freight components. Synced incrementally on the emission date, with the lookback window re-checking recent documents.Fields:
chaveAcesso:String- 44-digit access key, unique identifier of the documentid:String- Internal identifier of the document in Fiscal DefendernProt:String- SEFAZ authorization protocol numbernsu:String- NSU (distribution sequence number) the document was read withnumero:String- CT-e numberserie:String- CT-e seriesmodeloFiscal:Integer- Fiscal model: 57 = CT-e, 67 = CT-e OSmodal:Integer- Transport mode: 1 = road, 2 = air, 3 = water, 4 = rail, 5 = pipeline, 6 = multimodaltpCTe:Integer- CT-e type: 0 = normal, 1 = complementary, 2 = cancellation, 3 = replacementnatOp:String- Nature of the operation (natureza da operação)cfop:String- CFOP code of the operationdataEmissao:DateTime- Emission timestamp, used as the incremental replication keydataEmissaoLocal:Date- Emission date in Brazil time (UTC-03)dataProcessamento:DateTime- Timestamp the document was processed by Fiscal Defendersituacao:String- Document status: NORMAL, DESACORDO, CANCELADA or DENEGADAcanceladaEm:DateTime- Cancellation timestamp, when cancelledcStat:String- SEFAZ status codexMotivo:String- SEFAZ status descriptionemitenteCnpj:String- Issuer (carrier) CNPJemitenteNome:String- Issuer (carrier) nameemitenteMunicipio:String- Issuer cityemitenteUf:String- Issuer state (UF)remetenteCnpj:String- Sender CNPJremetenteCpf:String- Sender CPFremetenteNome:String- Sender nameremetenteMunicipio:String- Sender cityremetenteUf:String- Sender state (UF)destinatarioCnpj:String- Recipient CNPJdestinatarioCpf:String- Recipient CPFdestinatarioNome:String- Recipient namedestinatarioMunicipio:String- Recipient citydestinatarioUf:String- Recipient state (UF)expedidorMunicipio:String- Shipper (expedidor) cityexpedidorUf:String- Shipper (expedidor) state (UF)recebedorMunicipio:String- Receiver (recebedor) cityrecebedorUf:String- Receiver (recebedor) state (UF)tomadorCnpj:String- Service taker (tomador) CNPJtomadorCpf:String- Service taker (tomador) CPFtomadorNome:String- Service taker (tomador) nametomadorMunicipio:String- Service taker citytomadorUf:String- Service taker state (UF)valorPrestacao:Number- Total amount of the transport servicevalorReceber:Number- Amount receivablebcIcms:Number- ICMS tax basepIcms:Number- ICMS rate (percent)valorIcms:Number- ICMS amountvIcmsSt:Number- ICMS withheld by tax substitution (ICMS ST)cst:String- ICMS tax situation code (CST)vTotTrib:Number- Approximate total taxes amountvCarga:Number- Declared cargo valuecompFretePeso:Number- Freight component: weight-based freightcompFreteValor:Number- Freight component: value-based freight (ad valorem)compPedagio:Number- Freight component: tollscompSecCat:Number- Freight component: SEC/CAT feecompOutras:Number- Freight component: other chargescompAdeme:Number- Freight component: ADEME feecompGris:Number- Freight component: GRIS (risk management)compTrt:Number- Freight component: TRT (difficult-access fee)compTas:Number- Freight component: TAS feecompDce:Number- Freight component: DCE feecompEmex:Number- Freight component: EMEX feecompDespacho:Number- Freight component: dispatch feeinfNFeChave:String- Access key of the NF-e transportedinfNFeNum:String- Number of the NF-e transportedrntrc:String- Carrier’s RNTRC (national road cargo carrier registry)observacao:String- Additional notes on the documentinfAdFisco:String- Additional information of interest to the tax authorityverified:Boolean- Whether the document was marked as verified in Fiscal DefenderentryDate:DateTime- Bookkeeping entry date set in Fiscal DefenderxmlSize:Integer- Size of the stored XML, in bytescreatedAt:DateTime- Timestamp the document entered Fiscal Defender