Skip to main content
TMTX is a management system for sales, inventory and logistics. Its integration API gives read-only access to the sales orders, returns, inventory position, stock movements and transfers of the companies your integration token is authorized for. The Nekt connector extracts that data into your Catalog, so you can analyze sales, returns and stock together with the rest of your data.

Before you start

You need the integration token that TMTX provides in its integration guide (“API TMTX - Guia de integração e acesso”). The token is read-only and decides which companies’ data the connector can see. It does not expire on its own, but TMTX can revoke or replace it; if that happens, update it in the source configuration.

Use two TMTX sources

Create the connector twice with the same token:
  1. Main source: every stream except Inventory history. This is the source where the weekly full sync recommended below runs.
  2. Inventory history source: only the Inventory history (estoque_historico) stream, running every few hours, with no Additional Full Sync.
Both sources use the same token and share TMTX’s limit of 5 requests per second per IP, so stagger their schedules so that they never run at the same time (for example, the inventory history source at a different minute of the hour than the main source). A full sync always applies to every stream of a source. On the inventory history table it replaces all the positions saved so far with the current one, and TMTX cannot send the old positions again. Keeping that stream in a source of its own is the only way to run full syncs on the other tables without losing the history.

Configuring TMTX as a Source

In the Sources tab, click on the “Add source” button located on the top right of your screen. Then, select the TMTX option from the list of connectors. Click Next and you’ll be prompted to add your access.

1. Add account access

The following configuration is available:
  • API Token: The integration token provided by TMTX. Paste only the token, without quotes and without the word Bearer.
Once you’re done, click Next.

2. Select streams

Choose which data streams you want to sync. For faster extractions, select only the streams that are relevant to your analysis.
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 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: you can choose between INCREMENTAL and FULL_TABLE.
    • Incremental: every time the extraction happens, we’ll get only the new and changed data, which is good if, for example, you want to keep every record ever fetched.
    • Full table: every time the extraction happens, we’ll get the current state of the data, which is good if, for example, you don’t want to have deleted data in your catalog.
Select the Inventory history (estoque_historico) stream only in its own source (see Use two TMTX sources) and keep it as INCREMENTAL. TMTX only publishes the current inventory position, so this table is the only place where past positions are kept. Never schedule an Additional Full Sync on that source and never click Full sync on it: a full sync deletes the saved history for good and leaves only the current position. In FULL_TABLE mode the table also keeps only the current position.
Once you are done configuring, click Next.

4. Configure data source

Describe your data source for easy identification within your organization, not exceeding 140 characters. To define your Trigger, consider how often you want data to be extracted from this source. TMTX refreshes orders, returns and transfers about every 5 minutes, stock movements about every 15 minutes and the inventory position about once a day. Run the inventory history source every few hours, at times that do not overlap with the main source (both share TMTX’s rate limit): each run first checks whether TMTX published a new position and only downloads it when it did, so frequent runs are cheap, while a single daily run can miss a publication. Optionally, you can define some additional settings:
  • 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. This will complement the incremental data extractions, ensuring that your data is completely synchronized with your source every once in a while. On the main source we recommend a weekly full sync: records deleted in TMTX are not reported by its API, so they only leave your incremental tables on a full sync. On the inventory history source, leave it off: a full sync there deletes the saved history.
Once you are ready, click Next to finalize the setup.

5. Check your new source

You can view your new source on the Sources page. If needed, manually trigger the source extraction by clicking on the arrow button. Once executed, your data will appear in your Catalog.
For you to be able to see it on your Catalog, you need at least one successful source run.

Streams and Fields

Available streams

The table below lists every stream, its slug (the exact identifier to pass when creating the source via API) and a short description. Lists of invoices (notas_fiscais, notas_devolucao, notas_venda_original) are stored as JSON text, for example json_extract_scalar(notas_fiscais, '$[0].numero').

Fields by stream

Stream name: pedidos. One row per item of a sales order (Pedido Venda documents).Sync Strategy:
  • Incremental on data_atualizacao (the API’s change marker)
  • Primary key(s): id
Stream name: devolucoes. One row per returned item, with the reference to the original document (which can be a sale or a shipment/resale).Sync Strategy:
  • Incremental on data_atualizacao (the API’s change marker)
  • Primary key(s): id
Stream name: estoque. The latest published inventory position: one row per product and stock location. The table is replaced on every run.Sync Strategy:
  • Full table
  • Primary key(s): id
Stream name: estoque_historico. Every published inventory position, accumulated: one row per product, stock location and position date.Sync Strategy:
  • Incremental on data_posicao (each new position is appended once)
  • Primary key(s): id, data_posicao
Stream name: movimentacoes. One row per stock movement recorded in TMTX (entries, outflows, transfers, returns and adjustments).Sync Strategy:
  • Incremental on data_atualizacao (the API’s change marker)
  • Primary key(s): id
Stream name: transferencias. One row per item of a transfer order between branches and distribution centers. Not a stock posting nor a sale.Sync Strategy:
  • Incremental on data_atualizacao (the API’s change marker)
  • Primary key(s): id

Implementation Notes

Data Quality Considerations

  • Deleted records: records deleted in TMTX simply stop being returned by its API; there is no deletion notice, and the excluido column is always false. Incremental tables keep them until the next full sync (see the weekly full sync recommendation above). The Inventory (current position) table is replaced on every run, so deleted items leave it on the next run.
  • Inventory history: TMTX keeps no past inventory positions, so the history starts on the first extraction and has one copy of each position published between your runs. Each run first reads a single record to check the position date; when it is the same as the last saved one, nothing is downloaded or added. When the table starts without a saved position (its first extraction, or a full sync), the run log warns that the table is replaced by the current position.
  • Empty inventory: if TMTX returns an empty inventory position after an extraction that had rows, the inventory table fails for that run and keeps its previous content, because TMTX keeps the last published position available. An empty position is accepted, with a warning in the run log, only when there is no earlier extraction to compare with: the very first extraction, or a full sync of the source (which runs without the saved state). An accepted empty extraction does not reset that comparison, so the next regular runs are still protected. The inventory cost is the current accounting cost, not the historical cost of each sale.
  • Fields not available yet: in the current TMTX API version, linha, tamanho and quantidade_em_transito (inventory) and local_destino (stock movements) are always empty. They are kept so they fill in automatically when TMTX starts sending them.
  • Freight: valor_frete is the order’s freight split across its items. Do not add it again if your revenue already includes freight.
  • Returns: a return can point to a shipment or resale document that is not in the orders table. Use the identifiers on the return row (contrato_documento_original, id_item_documento_original, pedido_omie) instead of matching by product.
  • Delivery dates: data_remessa, data_entrega_informada and data_previsao_entrega are informed or planned dates; TMTX does not confirm physical delivery.
  • Identifiers and codes are text, and an id is only unique within its own table. pedido_omie must be matched within the right company/Omie account.
  • Every row has sincronizado_em, the moment TMTX last refreshed that data from its own system.

API Limits & Performance

  • The connector reads 500 records per request and stays under TMTX’s limit of 5 requests per second. When TMTX asks it to slow down or is temporarily unavailable, it waits and retries automatically.
  • Each table is saved only after all of its pages were read and the record count matches the total reported by TMTX. If TMTX’s read position expires during an extraction, the table is read again from the start (up to three times), so no record is duplicated or missed.
  • Incremental extractions continue from the change marker TMTX returns at the end of each extraction. If an extraction fails, the next one starts again from the last successful point.

Troubleshooting