Configuring SIEG as a Source
In the Sources tab, click on the “Add source” button located on the top right of your screen. Then, select the SIEG option from the list of connectors. Click Next and you’ll be prompted to add your access.1. Add account access
You’ll need a SIEG API Key. It must be created by an administrator user of your SIEG account:1
Open the API settings
Sign in to app.sieg.com and go to Minha Conta > Integrações API SIEG.
2
Generate a new key
Click Gerar nova chave API, give it an identification name, choose an expiration date (minimum 3 months, maximum 5 years) and select the read access level.
3
Copy the key
Copy the value of the Chave API field and paste it into the API Key field in Nekt.
- Which date should the extraction follow?: choose between the upload date (when the document arrived in the SIEG vault) and the issue date (the date printed on the document). Upload date is recommended, because documents are frequently captured days or weeks after being issued and only the upload date guarantees they are picked up.
- Window Size (days): how many days are requested per API call. Increasing it makes a long historical load faster, but the incremental replication key becomes as coarse as the window.
- Include document events: also extracts the events attached to each document, such as cancellations, correction letters, and operation manifestations.
2. Select streams
Choose which document types you want to sync. Each stream corresponds to one type of fiscal document.Tip: The stream can be found more easily by typing its name.Select the streams and click Next.
3. Configure data streams
Customize how you want your data to appear in your catalog. Select a name for each table and the type of sync.- Table name: we suggest a name, but feel free to customize it. You have the option to add a prefix and make this process faster.
- Sync Type: we recommend INCREMENTAL for all SIEG streams. Each run resumes from the last time window that returned documents, so only new documents are fetched. Read more about Sync Types here.
4. Configure data source
Describe your data source for easy identification within your organization, and define a Trigger to determine how often data is extracted.Check your new source!
Click Next to finalize the setup. You can view your new source on the Sources page. Once the pipeline runs, your new tables will appear in the Catalog.How the data is structured
Fiscal XML layouts change with every schema version, and NFS-e has no national standard — each municipality publishes its own. A fixed set of typed columns would break every time a layout changes, so SIEG documents follow the same model Nekt uses for NoSQL sources: the whole document lands in a single column, next to the metadata needed to identify it. Every stream has the same schema:
To read a field out of the
document column, parse it in a Query or Notebook. For example, in a Query:
Available streams
NF-e
NF-e
Nota Fiscal Eletrônica (model 55) — the invoice used for goods transactions between companies.Delivered with
document_type set to NFe.NFC-e
NFC-e
Nota Fiscal de Consumidor Eletrônica (model 65) — the invoice used for retail sales to end consumers.Delivered with
document_type set to NFCe.CT-e
CT-e
Conhecimento de Transporte Eletrônico — the document that covers freight and transport services.Delivered with
document_type set to CTe.NFS-e
NFS-e
Nota Fiscal de Serviço Eletrônica — the invoice used for services.Delivered with
NFS-e has no national standard: each municipality defines its own XML layout, and many of them carry no access key. For those documents the
id field is a hash of the XML content, and access_key is empty.document_type set to NFSe.CF-e
CF-e
Cupom Fiscal Eletrônico — the electronic sales receipt issued by SAT and MFE devices.Delivered with
document_type set to CFe.document_type set to Evento. Events cover cancellations, correction letters (CC-e), and operation manifestations.
Things to keep in mind
- The API does not expose a per-document upload timestamp, so
updated_athas the granularity of the configured window size (one day by default). - Each run re-reads the last window that returned documents, so documents filed after the previous run are still picked up. Duplicates are resolved by
id. - Only the document types listed above are available. Fiscal reports, certificate management, and document manifestation are not part of this source.