Skip to content
Response format
API · Fundamentals

Response format

How to read CNPJá API responses: JSON structure, status codes and headers, missing and empty values, language, cursor pagination and file responses.

Tip: Concepts on this page: Data formats and Company phones and e-mails.

API responses are JSON, except for the operations that return files: PDF certificates and map and street view images. All of them follow the same conventions for structure, status, missing values, language and pagination, described on this page. The fields of each operation are in the Reference, and errors are in Limits and errors.

Response structure

A JSON response is made of named fields with values, which can hold other fields or lists. Excerpt of a Lookup CNPJ response for CNPJ 37335118000180, with no optional resources:

{
  "updatedAt": "2026-01-27T03:00:00.000Z",
  "taxId": "37335118000180",
  "incorporationDate": "2020-06-05",
  "company": {
    "id": "37335118",
    "legalName": "CNPJA TECNOLOGIA LTDA",
    "shareCapital": 99999.99,
    "legalNature": { "code": "2062", "label": "Sociedade Empresária Limitada" },
    "size": { "code": "SMALL", "label": "Empresa de Pequeno Porte" }
  },
  "type": { "code": "HEAD", "label": "Matriz" },
  "tradeName": "Cnpja",
  "status": { "code": "ACTIVE", "label": "Ativa" },
  "address": {
    "street": "Avenida Brigadeiro Faria Lima",
    "number": "2369",
    "city": "São Paulo",
    "state": "SP",
    "postalCode": "01452922",
    "municipality": "3550308",
    "country": { "code": "BR", "label": "Brasil" }
  },
  "phones": [{ "number": "+5511971564144", "type": { "code": "MOBILE", "label": "Celular" } }],
  "primaryActivity": { "code": "6311900", "label": "Tratamento de dados, provedores de serviços de aplicação e serviços de hospedagem na internet" }
}

updatedAt is the last update from the Receita Federal, as explained in Max age and partial success. company holds the company data, shared by the head office and every branch. Objects with code and label, such as status, follow Codes and labels: base your logic on code, because label is for display only and changes with the language. The formats of dates, amounts, identifiers and addresses are in Data formats.

Field names are in English, in camelCase, and do not change with the language. The documentation refers to a field by its path, separated by dots: company.legalName is the legalName inside company. In lists, [] stands for each item, as in company.partners[].person.id.

Status and headers

StatusOperationsBody
200Lookups, searches, file operations and Update listJSON or file
201Create listJSON with the created list
204Delete listEmpty
206Lookup CNPJ, Lookup CPF and the certificate operations, when a live query fails or times out (partial success, described in Max age and partial success)Same format as a 200. Treat it as success
4xx and 5xxAllJSON with status, code, message and traceId, as described in Limits and errors

Responses with a body carry Content-Type, with application/json or the file type. Every response carries trace-id, the request identifier, repeated in traceId in error responses. There are no usage limit headers, no Retry-After and no balance or cost headers, as described in Limits and errors and Queries and quota.

The API compresses JSON responses when the request lists the accepted encodings in Accept-Encoding: zstd, br, gzip or deflate. The chosen one comes in Content-Encoding. Very small responses, such as most error responses, are sent uncompressed, and so are file responses. Many HTTP clients decompress automatically; curl requires the --compressed option. The rules are in Compression, in the Reference.

Missing and empty values

SituationMeaningExample
nullThe field exists, but no value is registeredtradeName of an establishment with no trade name
Empty list []No items were foundphones of an establishment with no phones
Missing fieldThe field appears only under certain conditions, or was not requestedstatusReason of an active establishment
FieldBehavior
tradeName, street, number, details and districtnull when they are not in the registration
person.taxId of partnersnull for FOREIGNER (foreign) and UNKNOWN (known only by name) persons, as explained in Partners and people in the API
admissionDate of partnersnull when the admission date is not registered
address.coordinates.latitude and longitudenull when the address cannot be located
nextCursornull when there are no more pages
company.taxRegime.simplesNacionalStartDate, simeiStartDate, regularIbsStartDate and regularCbsStartDatePresent only when they apply: simplesNacionalStartDate when type.code is SIMPLES_NACIONAL, SIMPLES_NACIONAL_HYBRID or SIMPLES_NACIONAL_SIMEI, simeiStartDate when it is SIMPLES_NACIONAL_SIMEI, and regularIbsStartDate and regularCbsStartDate when it is SIMPLES_NACIONAL_HYBRID, only in Lookup CNPJ with company.taxRegime.view=DETAILED. When present, simplesNacionalStartDate and simeiStartDate are null if the date is not known, and regularIbsStartDate or regularCbsStartDate is null when the company opted into the regular regime of the other tax only
statusReasonPresent only when the establishment is not active
specialStatus and specialStatusDatePresent only when the establishment is active and falls under a specific legal regime, such as judicial recovery
company.federativeEntityPresent only when the legal nature belongs to public administration
company.partners[].legalRepresentativePresent only when the partner has a legal representative
ageGroupPresent only when the person is a natural person (INDIVIDUAL)

Optional resources, such as company.taxRegime, stateRegistry and suframa in Lookup CNPJ, stay out of the response until they are requested in expand, as shown in CNPJ lookup in the API. A requested resource is present even with no data, for example with an empty registrations.

Language (Accept-Language)

Labels and error messages are in Portuguese by default. To get them in English, send the Accept-Language header with en-US, as described in Language, in the Reference:

GET /v2/establishments/37335118000180 HTTP/1.1
Host: api.cnpja.com
Authorization: YOUR_API_KEY
Accept-Language: en-US

The registration status text then comes as "label": "Active", and status.code stays ACTIVE.

AspectBehavior
Accepted valuesOnly the exact tags pt-BR and en-US. Tags without a region, such as pt or en, are ignored. Send a single tag
Defaultpt-BR, when the header is missing or has no recognized tag. An unrecognized tag does not cause an error
What changeslabel fields and the message of errors, including the items in errors. A message with no translation comes in English
Public accessAccept-Language is a header, not a query parameter, so it also works in requests without a key, as described in Public API access, no key

Codes, field names, dates and numbers do not change with the language, and neither does official-source data, as explained in Label language.

Paged responses

The four search operations return results in pages, always with the same fields:

FieldContent
recordsThe page’s records, in the order set by sort and order. The last page may hold fewer than limit
totalNumber of records that match the search, across all pages
limitPage size in effect, from 1 to 1000. The default is 10
nextCursorCursor for the next page, or null when there are no more

Each item in records has the format of the matching lookup: in Search CNPJ, that of Lookup CNPJ with no optional resources except company.taxRegime, which comes without regularIbsStartDate, regularCbsStartDate and its history (timeline); in Search people, that of Lookup person; in Search CEP, that of Lookup CEP; and in Search lists, that of Lookup list.

A search with no matches returns 200 with empty records, total set to 0 and nextCursor set to null, never 404.

Reading pages

The first request sets the filters, sort, order and limit. In the following ones, send each response’s nextCursor as cursor, with no other parameter, until nextCursor is null:

GET /v2/establishments?cursor=9ed11ce29dc14f9c78304c1a403e9f85 HTTP/1.1
Host: api.cnpja.com
Authorization: YOUR_API_KEY
RuleBehavior
FiltersThe cursor keeps the filters, sort, order and limit of the first request. To change any of them, start a new search
Parameterscursor must be the only parameter. Combined with any other, including limit, the request is rejected with 400 REQUEST_VALIDATION_FAILED
Validity15 minutes from the response that returned it, counted between one page and the next. Within that period, the cursor can be reused, for example to repeat a page after a network failure
ExpirationAn expired or unknown cursor returns 400 PAGE_CURSOR_INVALID and cannot be renewed: start again from the first request

Pagination does not freeze results. If the data changes while you read, a record may appear on two pages or on none, and total may vary. The number of pages is set by the first response, so a page may come with fewer records, or empty, before the end. Keep going until nextCursor is null and, if your process does not tolerate repeats, discard duplicates by identifier, such as taxId for establishments. The filters are in CNPJ search and lists in the API, and the full technical specification in Sorting and Pagination, in the Reference.

File responses

OperationContent-TypeContentGuide
Issue CNPJ dossier and Issue CPF dossierapplication/pdfA single PDF with the requested certificates, in the order given in certificatesCertificates in the API
Render CNPJ mapimage/png640 × 640 pixel imageLocation and maps in the API
Render CNPJ street viewimage/jpeg640 × 640 pixel imageLocation and maps in the API
  • Success: a 200 carries the file itself. For certificates, a 206 also carries the PDF, with the affected certificates in their cached version or left out.
  • Error: error responses are JSON, in the same format as other operations. Check the status, or the Content-Type, before saving or displaying the file.
  • Compression: files are sent uncompressed, even with Accept-Encoding.

With curl, the --fail option avoids saving an error response as if it were the PDF:

curl --fail -o certificates.pdf -H "Authorization: YOUR_API_KEY" \
  "https://api.cnpja.com/v2/establishments/37335118000180/dossier?certificates=RFB_REGISTRATION"

Best practices

  • Accept every success status. Treat 200, 201, 204 and 206 as success, not only 200.
  • Base logic on code. Use label and message for display only, and plan a default handling for codes your system does not know yet.
  • Follow the format conventions. Store identifiers and codes as text and convert time zones only when displaying instants, as explained in Data formats.
  • Tell null, empty lists and missing fields apart, without assuming that a conditional or optional field is always present.
  • Read searches until nextCursor is null, reading each page within 15 minutes.
  • Request compressed responses with Accept-Encoding, especially in searches with large pages.
  • Log the trace-id of each response, to give it to support.

Frequent errors

StatusCodeCauseAction
400PAGE_CURSOR_INVALIDCursor expired, after 15 minutes without reading the next page, or unknownStart the search again from the first request, with the same parameters
400REQUEST_VALIDATION_FAILEDcursor sent with other parameters, such as limit, sort or filtersSend only cursor on the following pages
400REQUEST_VALIDATION_FAILEDlimit outside the 1 to 1000 rangeSend a value within the range
400REQUEST_VALIDATION_FAILEDsort or order with a value the operation does not accept, such as order=asc, in lowercaseSend one of the values listed in the Reference

The error format and the other codes are in Limits and errors.

In the app

On the platform, the same data appears already formatted, with labels in the interface language, and can be downloaded as a spreadsheet without writing code. See The company record and Export to a spreadsheet.

Notes

  • The full list of fields, types and values of each operation is in the Reference, and registry and tax terms are in the Glossary.
  • Objects with the same name have the same format in every operation where they appear, including state registrations and SUFRAMA registrations: address, phones, emails, primaryActivity and partners follow the same rules. Only address.coordinates is exclusive to Lookup CNPJ.
  • The 204 of Delete list has no body: do not try to parse it as JSON.

Informational content that may change without notice. It is not tax, accounting or legal advice, and CNPJá's terms and policies prevail over this page.