TF Fiscal
Documentation

Offline NFC-e

Generate pairing code

Generates the single-use code a till pairs with; the first call enables offline issuing for the company.

POST/openapi/v2/empresas/{empresaId}/nfce-offline/codigos-ativacao
Requires the token, timestamp and sign signature headers, see Authentication.

One code per till. The code already carries the platform address, the company and the environment; at the store it is enough to enter it together with the A1 certificate. The company must be active and have NFC-e enabled in the environment (the emissaoNFeConsumidor block of the registration); Producao also needs a valid A1 certificate. There is no limit on devices per company: as long as a series is available, more tills can be added. Each device has an NFC-e series of its own, used online and offline with continuous numbering; serie and numeroInicial set that series and the first number, and when omitted the platform assigns the series and starts at 1. NFC-e issued through the cloud API keeps using the company profile series.

Path parameters

empresaId*
stringCompany identifier

* Required field

Request body

nomeDispositivo
stringDevice name
ambiente
stringIssuing environment
formaPermitida
stringAllowed form
serie
intDevice series
numeroInicial
intStart number

* Required field

200
Code generated. Hand codigoAtivacao to the store.
success
boolCall outcome
message
stringResult text
objectGenerated pairing code

Business errors come back with HTTP 200 and success = false; a missing resource comes back with HTTP 404 and field validation with HTTP 400. Always branch on code.

Hand the code to the store as text or as a .tfa file: the file is the code text itself, UTF-8 on a single line. The code works once and expires in 72 hours; if lost, generate another. A company accepts at most 20 pending codes (unused and not expired).

First code, no body

Empty body {} (or no body): default name, company current environment and any form. The first call enables offline issuing for the company; there is no separate step. nomeDispositivo, ambiente and formaPermitida not sent.

json
{
"success": true,
"message": "OK",
"data": {
"codigoAtivacaoId": "1950000000000000101",
"codigoAtivacao": "TFA1.eyJhbWIiOjIsImV4cCI6MTc2MzA0NjAwMCwiZm9ybWEiOjB9.Mx3K9qVbT2nWc8yLr0aZpE4sHdUfGj7i",
"expiraEm": "2026-11-14T13:10:00Z",
"nomeDispositivo": "Dispositivo 1",
"ambiente": "Homologacao",
"formaPermitida": "Qualquer",
"serie": null,
"numeroInicial": null
}
}

Till with the SDK, named

Code only for the POS with the Embedded SDK. nomeDispositivo and formaPermitida = Sdk optional and sent; ambiente not sent, means the company current environment. The request is the example at the top of the page.

nomeDispositivo
stringDevice name
formaPermitida
stringAllowed form

* Required field

Response: code for the SDK

Store or hand over codigoAtivacao now; it never comes back in any other query.

json
{
"success": true,
"message": "OK",
"data": {
"codigoAtivacaoId": "1950000000000000101",
"codigoAtivacao": "TFA1.eyJhbWIiOjIsImV4cCI6MTc2MzA0NjAwMCwiZm9ybWEiOjB9.Mx3K9qVbT2nWc8yLr0aZpE4sHdUfGj7i",
"expiraEm": "2026-11-14T13:10:00Z",
"nomeDispositivo": "Caixa 01",
"ambiente": "Homologacao",
"formaPermitida": "Sdk",
"serie": null,
"numeroInicial": null
}
}

Series and start number set

For the till to use a series agreed with the store. serie and numeroInicial optional and sent; the first invoice of the device, online or offline, gets number 1 of series 21, and the next ones follow in sequence. The series is checked again at pairing; if it stopped being free in the meantime, pairing returns the same error code and a new code is needed.

json
{
"nomeDispositivo": "Caixa 03",
"serie": 21,
"numeroInicial": 1
}
serie
intDevice series
numeroInicial
intStart number

* Required field

Replace the computer keeping the series

The old till was deactivated and has already uploaded all offline invoices (pendentesTransmissao = 0). Send the same serie without numeroInicial: the platform continues after the highest number already known on the series and returns the effective number in numeroInicial. If the old till still has invoices to upload, the response is 10029225.

json
{
"success": true,
"message": "OK",
"data": {
"codigoAtivacaoId": "1950000000000000101",
"codigoAtivacao": "TFA1.eyJhbWIiOjIsImV4cCI6MTc2MzA0NjAwMCwiZm9ybWEiOjB9.Mx3K9qVbT2nWc8yLr0aZpE4sHdUfGj7i",
"expiraEm": "2026-11-14T13:10:00Z",
"nomeDispositivo": "Caixa 01",
"ambiente": "Homologacao",
"formaPermitida": "Qualquer",
"serie": 2,
"numeroInicial": 422
}
}