Skip to main content
Fiscal Defender is a Brazilian fiscal-document automation platform. Using your companies’ A1 digital certificates, it captures the service invoices (NFS-e), goods invoices (NF-e), consumer invoices (NFC-e), and transport documents (CT-e) issued to or by your companies directly from SEFAZ and the national NFS-e environment.
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

  1. 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_).
  2. 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.
  3. 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.
  4. 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

  1. 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.
  2. Click Next.

3. Configure your Fiscal Defender data streams

  1. 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.
  2. Click Next.

4. Configure your Fiscal Defender data source

  1. 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.
  2. To define your Trigger, consider how often you want data to be extracted from this source.
  3. Optionally, you can define some additional settings (if available).
    • Configure Delta Log Retention and determine for how long we should store old states of this table as it gets updated. Read more about this resource here.
    • Determine when to execute an Additional Full Sync.

Check your new source!

  1. Click Next to finalize the setup. Once completed, you’ll receive confirmation that your new source is set up!
  2. 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 (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 Defender
  • cnpj: 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 account
  • createdAt: DateTime - Timestamp when the company was registered
  • updatedAt: DateTime - Timestamp of the last update to the company
  • syncInterval: String - How often documents are synced from SEFAZ (e.g. DAILY)
  • syncIsActive: Boolean - Whether automatic document sync is enabled for the company
  • syncLastSyncAt: DateTime - Timestamp of the last document sync
  • syncNextSyncAt: DateTime - Timestamp of the next scheduled document sync
  • syncLastNsu: String - Last NSU (distribution sequence number) read for NFS-e
  • syncNfeLastNsu: String - Last NSU read from the national NF-e distribution service
  • syncCteLastNsu: String - Last NSU read from the national CT-e distribution service
  • syncNfeEstadualLastNsu: String - Last NSU read from the state NF-e service
  • syncCteEstadualLastNsu: String - Last NSU read from the state CT-e service
  • syncNfceEstadualLastNsu: String - Last NSU read from the state NFC-e service
  • syncLastNsuEmitidas: String - Last NSU read for documents issued by the company
  • syncLastNsuRecebidas: String - Last NSU read for documents received by the company
  • certificateSerialNumber: String - Serial number of the company’s A1 digital certificate
  • certificateIssuer: String - Issuer (certificate authority) of the digital certificate
  • certificateValidFrom: DateTime - Start of the digital certificate’s validity
  • certificateValidUntil: DateTime - Expiration of the digital certificate
  • nfseCount: Integer - Number of NFS-e stored for the company
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 document
  • id: String - Internal identifier of the document in Fiscal Defender
  • tenantId: String - Fiscal Defender account (tenant) that owns the document
  • companyId: String - Identifier of the company (see companies stream) the document belongs to
  • tipo: String - Whether the company issued (EMITIDA) or received (RECEBIDA) the document
  • nsu: String - NSU (distribution sequence number) the document was read with
  • numero: String - NFS-e number
  • serie: String - DPS series
  • numeroDps: String - DPS (Declaração de Prestação de Serviço) number
  • dataEmissao: DateTime - Emission timestamp, used as the incremental replication key
  • competencia: DateTime - Accrual date (competência) of the service
  • dataProcessamento: DateTime - Timestamp the document was processed by the tax authority
  • situacao: String - Document status: NORMAL, CANCELADA or SUBSTITUIDA
  • canceladaEm: DateTime - Cancellation timestamp, when cancelled
  • prestadorCnpj: String - Service provider CNPJ
  • prestadorRazaoSocial: String - Service provider legal name
  • prestadorNomeFantasia: String - Service provider trade name
  • prestadorMunicipio: String - Service provider city (IBGE code)
  • prestadorUf: String - Service provider state (UF)
  • prestadorLogradouro: String - Service provider street
  • prestadorNumero: String - Service provider street number
  • prestadorComplemento: String - Service provider address complement
  • prestadorBairro: String - Service provider neighborhood
  • prestadorCep: String - Service provider postal code (CEP)
  • tomadorCnpj: String - Service taker CNPJ
  • tomadorRazaoSocial: String - Service taker legal name
  • tomadorMunicipio: String - Service taker city (IBGE code)
  • tomadorUf: String - Service taker state (UF)
  • tomadorLogradouro: String - Service taker street
  • tomadorNumero: String - Service taker street number
  • tomadorComplemento: String - Service taker address complement
  • tomadorBairro: String - Service taker neighborhood
  • tomadorCep: String - Service taker postal code (CEP)
  • tomadorEmail: String - Service taker email
  • municipioPrestacao: String - City where the service was provided (IBGE code)
  • descricaoServico: String - Description of the service provided
  • codigoServico: String - Service code (national service list)
  • cnae: String - CNAE activity code of the service
  • valorServico: Number - Gross service amount
  • valorDeducoes: Number - Deductions amount
  • valorDescIncond: Number - Unconditional discount amount
  • valorDescCond: Number - Conditional discount amount
  • baseCalculo: Number - ISS tax base
  • aliquotaIss: Number - ISS rate (percent)
  • valorIss: Number - ISS amount
  • issRetido: Boolean - Whether ISS was withheld by the service taker
  • valorPis: Number - PIS amount
  • valorCofins: Number - COFINS amount
  • valorCsll: Number - CSLL amount
  • valorIrrf: Number - Withheld income tax (IRRF) amount
  • valorInss: Number - INSS amount
  • valorLiquido: Number - Net amount of the NFS-e
  • verified: Boolean - Whether the document was marked as verified in Fiscal Defender
  • entryDate: DateTime - Bookkeeping entry date set in Fiscal Defender
  • xmlSize: Integer - Size of the stored XML, in bytes
  • xmlReprocessadoEm: DateTime - Timestamp the XML was last reprocessed
  • danfseStatus: String - Generation status of the DANFSe (PDF)
  • danfseGeneratedAt: DateTime - Timestamp the DANFSe (PDF) was generated
  • danfseAttempts: Integer - Number of DANFSe generation attempts
  • danfseLastError: String - Last DANFSe generation error
  • downloadedAt: DateTime - First time the document was downloaded in Fiscal Defender
  • lastDownloadedAt: DateTime - Last time the document was downloaded in Fiscal Defender
  • xmlDownloadedAt: DateTime - Last time the XML was downloaded
  • danfseDownloadedAt: DateTime - Last time the DANFSe (PDF) was downloaded
  • createdAt: DateTime - Timestamp the document entered Fiscal Defender
  • updatedAt: DateTime - Timestamp of the last update to the document in Fiscal Defender
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 document
  • id: String - Internal identifier of the document in Fiscal Defender
  • nsu: String - NSU (distribution sequence number) the document was read with
  • nProt: String - SEFAZ authorization protocol number
  • numero: String - Document number
  • serie: String - Document series
  • tpAmb: Integer - SEFAZ environment: 1 = production, 2 = homologation
  • tpNF: Integer - Operation type: 0 = inbound, 1 = outbound
  • natOp: String - Nature of the operation (natureza da operação)
  • dataEmissao: DateTime - Emission timestamp, used as the incremental replication key
  • dataProcessamento: DateTime - Timestamp the document was authorized by SEFAZ
  • situacao: String - Document status: NORMAL, CANCELADA or DENEGADA
  • canceladaEm: DateTime - Cancellation timestamp, when cancelled
  • papelEmpresa: 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 pending
  • emitenteCnpj: String - Issuer CNPJ
  • emitenteNome: String - Issuer name
  • emitenteMunicipio: String - Issuer city
  • emitenteUf: String - Issuer state (UF)
  • destinatarioCnpj: String - Recipient CNPJ
  • destinatarioCpf: String - Recipient CPF, when the recipient is a person
  • destinatarioNome: String - Recipient name
  • transportada: Boolean - Whether the document has a carrier
  • transportadorCnpj: String - Carrier CNPJ
  • transportadorCpf: String - Carrier CPF
  • transportadorNome: String - Carrier name
  • transportadorIe: String - Carrier state registration (IE)
  • valorTotal: Number - Total amount of the document
  • valorDesconto: Number - Discount amount
  • valorFrete: Number - Freight amount
  • valorSeguro: Number - Insurance amount
  • valorOutros: Number - Other expenses amount
  • bcIcms: Number - ICMS tax base
  • valorIcms: Number - ICMS amount
  • valorIcmsDeson: Number - Relieved ICMS (ICMS desonerado) amount
  • valorIpi: Number - IPI amount
  • valorPis: Number - PIS amount
  • valorCofins: Number - COFINS amount
  • eventos: String - Events registered for the document (cancellation, correction letter, recipient manifestation…), as a JSON array of objects with tipoEvento, descricao, codigoMotivo, dataEvento and protocolo
  • verified: Boolean - Whether the document was marked as verified in Fiscal Defender
  • entryDate: DateTime - Bookkeeping entry date set in Fiscal Defender
  • xmlSize: Integer - Size of the stored XML, in bytes
  • createdAt: DateTime - Timestamp the document entered Fiscal Defender
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 document
  • id: String - Internal identifier of the document in Fiscal Defender
  • nsu: String - NSU (distribution sequence number) the document was read with
  • nProt: String - SEFAZ authorization protocol number
  • numero: String - Document number
  • serie: String - Document series
  • tpAmb: Integer - SEFAZ environment: 1 = production, 2 = homologation
  • tpNF: Integer - Operation type: 0 = inbound, 1 = outbound
  • natOp: String - Nature of the operation (natureza da operação)
  • dataEmissao: DateTime - Emission timestamp, used as the incremental replication key
  • dataProcessamento: DateTime - Timestamp the document was authorized by SEFAZ
  • situacao: String - Document status: NORMAL, CANCELADA or DENEGADA
  • canceladaEm: DateTime - Cancellation timestamp, when cancelled
  • papelEmpresa: 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 pending
  • emitenteCnpj: String - Issuer CNPJ
  • emitenteNome: String - Issuer name
  • emitenteMunicipio: String - Issuer city
  • emitenteUf: String - Issuer state (UF)
  • destinatarioCnpj: String - Recipient CNPJ
  • destinatarioCpf: String - Recipient CPF, when the recipient is a person
  • destinatarioNome: String - Recipient name
  • transportada: Boolean - Whether the document has a carrier
  • transportadorCnpj: String - Carrier CNPJ
  • transportadorCpf: String - Carrier CPF
  • transportadorNome: String - Carrier name
  • transportadorIe: String - Carrier state registration (IE)
  • valorTotal: Number - Total amount of the document
  • valorDesconto: Number - Discount amount
  • valorFrete: Number - Freight amount
  • valorSeguro: Number - Insurance amount
  • valorOutros: Number - Other expenses amount
  • bcIcms: Number - ICMS tax base
  • valorIcms: Number - ICMS amount
  • valorIcmsDeson: Number - Relieved ICMS (ICMS desonerado) amount
  • valorIpi: Number - IPI amount
  • valorPis: Number - PIS amount
  • valorCofins: Number - COFINS amount
  • eventos: String - Events registered for the document (cancellation, correction letter, recipient manifestation…), as a JSON array of objects with tipoEvento, descricao, codigoMotivo, dataEvento and protocolo
  • verified: Boolean - Whether the document was marked as verified in Fiscal Defender
  • entryDate: DateTime - Bookkeeping entry date set in Fiscal Defender
  • xmlSize: Integer - Size of the stored XML, in bytes
  • createdAt: DateTime - Timestamp the document entered Fiscal Defender
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 document
  • id: String - Internal identifier of the document in Fiscal Defender
  • nProt: String - SEFAZ authorization protocol number
  • nsu: String - NSU (distribution sequence number) the document was read with
  • numero: String - CT-e number
  • serie: String - CT-e series
  • modeloFiscal: Integer - Fiscal model: 57 = CT-e, 67 = CT-e OS
  • modal: Integer - Transport mode: 1 = road, 2 = air, 3 = water, 4 = rail, 5 = pipeline, 6 = multimodal
  • tpCTe: Integer - CT-e type: 0 = normal, 1 = complementary, 2 = cancellation, 3 = replacement
  • natOp: String - Nature of the operation (natureza da operação)
  • cfop: String - CFOP code of the operation
  • dataEmissao: DateTime - Emission timestamp, used as the incremental replication key
  • dataEmissaoLocal: Date - Emission date in Brazil time (UTC-03)
  • dataProcessamento: DateTime - Timestamp the document was processed by Fiscal Defender
  • situacao: String - Document status: NORMAL, DESACORDO, CANCELADA or DENEGADA
  • canceladaEm: DateTime - Cancellation timestamp, when cancelled
  • cStat: String - SEFAZ status code
  • xMotivo: String - SEFAZ status description
  • emitenteCnpj: String - Issuer (carrier) CNPJ
  • emitenteNome: String - Issuer (carrier) name
  • emitenteMunicipio: String - Issuer city
  • emitenteUf: String - Issuer state (UF)
  • remetenteCnpj: String - Sender CNPJ
  • remetenteCpf: String - Sender CPF
  • remetenteNome: String - Sender name
  • remetenteMunicipio: String - Sender city
  • remetenteUf: String - Sender state (UF)
  • destinatarioCnpj: String - Recipient CNPJ
  • destinatarioCpf: String - Recipient CPF
  • destinatarioNome: String - Recipient name
  • destinatarioMunicipio: String - Recipient city
  • destinatarioUf: String - Recipient state (UF)
  • expedidorMunicipio: String - Shipper (expedidor) city
  • expedidorUf: String - Shipper (expedidor) state (UF)
  • recebedorMunicipio: String - Receiver (recebedor) city
  • recebedorUf: String - Receiver (recebedor) state (UF)
  • tomadorCnpj: String - Service taker (tomador) CNPJ
  • tomadorCpf: String - Service taker (tomador) CPF
  • tomadorNome: String - Service taker (tomador) name
  • tomadorMunicipio: String - Service taker city
  • tomadorUf: String - Service taker state (UF)
  • valorPrestacao: Number - Total amount of the transport service
  • valorReceber: Number - Amount receivable
  • bcIcms: Number - ICMS tax base
  • pIcms: Number - ICMS rate (percent)
  • valorIcms: Number - ICMS amount
  • vIcmsSt: Number - ICMS withheld by tax substitution (ICMS ST)
  • cst: String - ICMS tax situation code (CST)
  • vTotTrib: Number - Approximate total taxes amount
  • vCarga: Number - Declared cargo value
  • compFretePeso: Number - Freight component: weight-based freight
  • compFreteValor: Number - Freight component: value-based freight (ad valorem)
  • compPedagio: Number - Freight component: tolls
  • compSecCat: Number - Freight component: SEC/CAT fee
  • compOutras: Number - Freight component: other charges
  • compAdeme: Number - Freight component: ADEME fee
  • compGris: Number - Freight component: GRIS (risk management)
  • compTrt: Number - Freight component: TRT (difficult-access fee)
  • compTas: Number - Freight component: TAS fee
  • compDce: Number - Freight component: DCE fee
  • compEmex: Number - Freight component: EMEX fee
  • compDespacho: Number - Freight component: dispatch fee
  • infNFeChave: String - Access key of the NF-e transported
  • infNFeNum: String - Number of the NF-e transported
  • rntrc: String - Carrier’s RNTRC (national road cargo carrier registry)
  • observacao: String - Additional notes on the document
  • infAdFisco: String - Additional information of interest to the tax authority
  • verified: Boolean - Whether the document was marked as verified in Fiscal Defender
  • entryDate: DateTime - Bookkeeping entry date set in Fiscal Defender
  • xmlSize: Integer - Size of the stored XML, in bytes
  • createdAt: DateTime - Timestamp the document entered Fiscal Defender