SUFRAMA registration
Inscrição SUFRAMA, the number the Superintendência da Zona Franca de Manaus gives to companies with tax incentives. The NF-e carries it in the ISUF field.
Validate
Validates an Inscrição SUFRAMA: the layout SS.NNNN.LLD (sector, sequential number, locality of the SUFRAMA unit and check digit) and its modulus 11 check digit.
- The NF-e field is numeric, with 8 or 9 positions. The sector
SScan start with 0, and the number then loses that zero and has 8 digits. The sector can never be00. - An 8-digit value is validated with the zero put back on the left. So an 8-digit value that starts with 0 is rejected, because it becomes sector
00. The NF-e manual only says thatSScan start with 0: this reading of 8 digits is an inference of the library. - Check digit: modulus 11 over the first 8 digits, weights 2 to 9 from right to left. The digit is 0 when the remainder is 0 or 1.
- Accepts the mask characters whitespace,
.,-and/, alone or in a run, between the fields ofSS.NNNN.LLD(the check digit included, as in20.5678.10-6), and surrounding whitespace. Any other character, or a separator inside a field, makes the value invalid. - Sector and locality are not checked against a table: there is no complete official list. For that reason there is no
getSuframaInfo. - Rule E18-30 of the NF-e (recipient in AC, AM, RO, RR or Macapá/Santana-AP) is out of scope.
- The rule comes from the NF-e Manual de Orientação do Contribuinte (MOC 7.0, section 8.4, and field E18
ISUF, rule E18-20, rejection 235). SUFRAMA itself publishes no layout and no check digit. - Only a string is read. Any other type returns
false.
| Parameter | Type | Required |
|---|---|---|
suframa | string | yes |
| returns | boolean |
Check if an Inscrição SUFRAMA is valid. It is the registration number the Superintendência da Zona Franca de Manaus gives to companies with tax incentives, carried by the ISUF field of the NF-e recipient.
- The number is
SS.NNNN.LLD: sector of activity, sequential number, locality of the SUFRAMA unit and check digit. - Accepts 8 or 9 digits. The MOC only says the sector code "pode começar por '0'"; reading an 8 digit value as one whose sector code lost that zero is this library's inference.
- Returns
falsefor a sector code of00and for a wrong módulo 11 check digit. - The sector and locality codes are not checked against a table, since the manual lists them only as examples.
- The rule comes from the NF-e Manual de Orientação do Contribuinte (CONFAZ/ENCAT), not from the SUFRAMA, whose Resolução CAS nº 64/2021, art. 5º, only calls the inscrição "um número de identificação e controle" and gives no layout or check digit.
- Whitespace,
.,-and/are accepted between the fields, as inisValidCpf. Any other character makes the value invalid.
import { isValidSuframa } from '@brazilian-utils/brazilian-utils';
isValidSuframa('123456789'); // true
isValidSuframa('12.3456.789'); // true
isValidSuframa('10001018'); // true (same as '010001018')
isValidSuframa('123456780'); // false
isValidSuframa('001234560'); // false (sector 00)Try it with JavaScript isValidSuframa
Shared test cases (41) and the result in each library suframa.isValid
Format
Formats an Inscrição SUFRAMA with the mask 00.0000.000. Only the structure changes (use suframa.isValid to check the number).
- The mask is progressive: a partial value is masked as far as it goes. Characters that are not digits are dropped, and digits after the 9th are ignored.
options.padfirst left-pads the value with zeros to 9 digits. A value with no digits (empty, or only letters and symbols) gives an empty string, even withpad.- An 8-digit value is a number whose sector lost its leading zero. Without
pad, the mask groups it one position early (10001018gives10.0010.18). Use{ pad: true }to get the correct mask (01.0001.018). - A number is read only when it is a safe non-negative integer. A negative, fractional, non-finite or unsafe number returns an empty string.
| Parameter | Type | Required |
|---|---|---|
value | string | number | yes |
options | FormatSuframaOptions | no |
options.pad | boolean | no |
| returns | string |
Format an Inscrição SUFRAMA.
- Options (
FormatSuframaOptions):padleft-pads the value with zeros to the full 9 digits before masking (defaultfalse), which restores the leading zero of an 8 digit value. An empty value, or one without digits, gives''even withpad. - The mask is progressive, as in the other
formatutilities, so an 8 digit value withoutpadis grouped one position early: usepad: truefor a value read straight out of theISUFfield, which may be stored with 8 digits.
import { formatSuframa } from '@brazilian-utils/brazilian-utils';
formatSuframa('123456789'); // 12.3456.789
formatSuframa('10001018'); // 10.0010.18 (8 digits, the mask groups one position early)
formatSuframa('10001018', { pad: true }); // 01.0001.018Try it with JavaScript formatSuframa
Shared test cases (26) and the result in each library suframa.format
Parse
Removes Inscrição SUFRAMA formatting and keeps only digits, capped at 9, the way the ISUF field of the NF-e expects them.
- The function does not left-pad the value. An 8-digit value stays with 8 digits.
- A number is read only when it is a safe non-negative integer. A negative, fractional, non-finite or unsafe number returns an empty string.
| Parameter | Type | Required |
|---|---|---|
value | string | number | yes |
| returns | string |
Remove Inscrição SUFRAMA formatting, keep only digits, and cap the result to 9 digits.
import { parseSuframa } from '@brazilian-utils/brazilian-utils';
parseSuframa('12.3456.789'); // 123456789Try it with JavaScript parseSuframa
Shared test cases (11) and the result in each library suframa.parse
Generate
Generates a random Inscrição SUFRAMA with a valid check digit: always 9 digits, unformatted.
- The sector is never
00, the only structural rule the NF-e manual states. - Sector and locality are random. They need not match codes SUFRAMA uses.
| Parameter | Type | Required |
|---|---|---|
| returns | string |
Generate a valid random 9 digit Inscrição SUFRAMA.
- The check digit is valid and the sector code is never
00. The sector and locality codes are random.
import { generateSuframa } from '@brazilian-utils/brazilian-utils';
generateSuframa(); // '205678106'Source: NF-e Manual de Orientação do Contribuinte 7.0, Visão Geral (section 8.4), MOC 7.0, Anexo I (field 79, E18 ISUF, and rule E18-20).
Try it with JavaScript generateSuframa
Shared test cases (2) and the result in each library suframa.generate
Official sources
- confaz.fazenda.gov.br/legislacao/arquivo-manuais/…/moc7-visao-geral.pdf
- confaz.fazenda.gov.br/legislacao/arquivo-manuais/…/moc7-anexo-i-leiaute-e-rv.pdf
See also NF-e access key, State registration (IE), CNPJ
Last updated on
