Invalidating NF-e numbers at the SEFAZ: when and how
When the NF-e sequence skips numbers, the issuer must invalidate the range at the SEFAZ by the 10th of the following month. The deadline, the rules and how it differs from cancellation.

Invalidating an NF-e number (inutilização de numeração) means telling the SEFAZ that a number, or a range of numbers, was not and will not be used. NF-e numbering is sequential, from 1 to 999,999,999, per establishment and per series. When that sequence breaks, Ajuste SINIEF 07/05 requires the taxpayer to request the invalidation of the unused numbers by the 10th day of the following month.
How to request the invalidation
The request goes to the authorizing SEFAZ through the NfeInutilizacao web service, which answers in the same call. It carries the year, the issuer's CNPJ, the model (55 or 65), the series, the first number, the last number and a justification of 15 to 255 characters. It must be signed with an ICP-Brasil digital certificate. When accepted, the SEFAZ returns status 102 — Inutilização de número homologado and a protocol number.
The MOC sets some limits on the range. Each request covers at most 10,000 numbers (rejection 201). The first number cannot be greater than the last (rejection 224). The invalidation year cannot be later than the current year (rejection 453) or earlier than 2006 (rejection 454).
When a range cannot be invalidated
Invalidation only applies to numbers that never became an invoice. If any number in the range has already been used, the whole request is refused with rejection 241 — Um número da faixa já foi utilizado (a number in the range has already been used). The same rejection applies when there is an authorized EPEC for a number in the range. A number that was already invalidated returns rejection 256, and a request identical to one already approved returns 563. In that last case, the response carries the protocol of the earlier invalidation.
Once approved, the invalidation closes that number. An NF-e sent later with the same number is rejected at authorization with rejection 206 — NF-e já está inutilizada na Base de Dados da SEFAZ (the NF-e is already invalidated in the SEFAZ database). Ajuste SINIEF 07/05 has one exception: when an NF-e issued in contingency, under its eleventh clause, is transmitted, the invalidation request already approved for that number is cancelled.
Invalidation or cancellation
Invalidation and cancellation are not the same thing. Cancellation applies to an NF-e that has already received its Authorization of Use. It can be requested within 24 hours of the authorization, provided the goods have not circulated, no service has been rendered and it has not been linked to a Duplicata Escritural. It is done by registering an event. Invalidation covers numbers that never became an authorized NF-e and uses a web service of its own. An authorized invoice gets cancelled. A number left without an invoice gets invalidated.
It pays to take care with the integration that sends these requests. The MOC lists a system stuck in a loop, resending the same invalidation request that is always rejected, as misuse of the environment. Anexo I provides rejection 656 — Consumo indevido (improper use), which can block the invalidation web service for up to one hour after more than 20 identical rejections. At the state's discretion, that block can become permanent. When a request is rejected, fix the range before sending it again.
In stackin, NF-e invalidation is the POST /api/v1/invoices/invalidations route. You send series, number_start, number_end and reason (15 to 255 characters). The response carries the status and, once the SEFAZ approves it, the protocol. If the SEFAZ refuses, its own message comes back in the error, not a generic one.