Skip to main content
SIEG is a Brazilian fiscal document platform used by accounting firms and finance teams. It automatically captures every electronic fiscal document issued by or against a company and stores it in the Cofre SIEG. This source brings those documents — the original XML files — into your Lakehouse.

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.
SIEG shows the API key only once, at creation time. Store it safely — if it is lost, a new key has to be generated.
You also need to set an Initial sync date, the earliest date from which documents should be extracted. Advanced configurations
  • 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.
Add the account access and click Next.

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.
Once you are done configuring, click Next.

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

Nota Fiscal Eletrônica (model 55) — the invoice used for goods transactions between companies.Delivered with document_type set to NFe.
Nota Fiscal de Consumidor Eletrônica (model 65) — the invoice used for retail sales to end consumers.Delivered with document_type set to NFCe.
Conhecimento de Transporte Eletrônico — the document that covers freight and transport services.Delivered with document_type set to CTe.
Nota Fiscal de Serviço Eletrônica — the invoice used for services.
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.
Delivered with document_type set to NFSe.
Cupom Fiscal Eletrônico — the electronic sales receipt issued by SAT and MFE devices.Delivered with document_type set to CFe.
When Include document events is enabled, the events attached to a document are delivered in the same stream as the document they belong to, identified by document_type set to Evento. Events cover cancellations, correction letters (CC-e), and operation manifestations.

Things to keep in mind

The SIEG API allows 30 requests per minute per API key, and returns at most 50 documents per request. The extraction respects this limit, which caps it at roughly 1,500 documents per minute. Loading several years of history can take hours, so set the Initial sync date to the oldest date you actually need.
  • The API does not expose a per-document upload timestamp, so updated_at has 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.