Skip to content
Migrate from CNPJ.ws
API · Migration

Migrate from CNPJ.ws

How to replace the CNPJ.ws commercial API with the CNPJá API: CNPJ and CNPJ root lookups, company search, SUFRAMA and the equivalent of each field.

This guide moves an integration with the CNPJ.ws commercial API to the CNPJá API. It covers the CNPJ lookup, the CNPJ root lookup, the company search and the SUFRAMA registration check, with the equivalent of each parameter and each response field.

Overview

  • Authentication: the key goes alone in the Authorization header, with no Bearer. The x_api_token header and the token URL parameter no longer exist.
  • Response format: fields have English names, the establishment sits at the root of the response and the company under company. Classified values come as a stable code plus a display label, including the registration status, the establishment type and the partner type, which CNPJ.ws returns as text only.
  • Tax data on demand: tax regime, state registrations and SUFRAMA registrations are optional resources, requested in expand and billed separately.
  • Data age under your control: the maxAge parameter sets the maximum accepted age; older data is queried live at the official source during the request.
  • CNPJ root: Lookup company returns every establishment of the root in a single response, with a summary of each, without pagination.
  • Search: results carry each establishment’s registration data, not just CNPJs, with operator-based filters and forward-only cursor pagination.
  • SUFRAMA: checking a registration becomes expand=suframa on Lookup CNPJ.

Effort: medium. Switching authentication and URLs is straightforward; most of the work is in mapping the response fields and the search filters.

Prerequisites

  • Account and key: sign up and create a key in API keys. The walkthrough is in First request.
  • Authentication: send the key as the entire value of the Authorization header, with no prefix: Authorization: YOUR_API_KEY. With Bearer, the request is rejected with 401 API_KEY_INVALID. The key never goes in the URL. See Authentication.
  • Base URL: https://api.cnpja.com/v2.
  • What carries over: the 14-character CNPJ without punctuation, the 8-character root, dates as YYYY-MM-DD, the 7-digit CNAE, the municipality’s 7-digit IBGE code, the partners’ masked CPF in the same format (***650245**) and the 4-digit legal nature code.
  • What changes: the CNPJ.ws token, the field names, page-number pagination, the state, city and country id fields, the BACEN country code and text-only classified values.

Matching operations

CNPJ.wsCNPJáNotes
GET /cnpj/{cnpj}Lookup CNPJTax regime, state registrations and SUFRAMA are requested in expand.
GET /cnpj-raiz/{cnpj-raiz}Lookup companyEvery establishment in one response, with a summary of each in establishments[].
GET /v2/pesquisaSearch CNPJEach establishment’s registration data in records[]; operator-based filters.
GET /v2/pesquisa with socio_nome or socio_cpf_cnpjSearch peopleThe person found lists the companies in participations[]. See Partners and people.
POST /suframaLookup CNPJ with expand=suframaCompare the registration number in suframa.registrations[].number.
GET /consumoNo equivalent in the APITrack usage in Usage.
GET /auth/token/renewNo equivalent in the APICreate a key in API keys and revoke the old one.

Request example

CNPJ.ws:

GET /cnpj/37335118000180 HTTP/1.1
Host: comercial.cnpj.ws
x_api_token: YOUR_TOKEN

CNPJá:

GET /v2/establishments/37335118000180?expand=company.taxRegime,stateRegistry&stateRegistry.states=ALL HTTP/1.1
Host: api.cnpja.com
Authorization: YOUR_API_KEY

Without expand, the CNPJá response carries the registration, the company data and the partners. Request in expand only the resources your integration read from the CNPJ.ws response, as the tables below show. See CNPJ lookup.

Parameters

Authentication

CNPJ.wsCNPJá
x_api_token headerAuthorization header, with the key only
Authorization: Bearer headerAuthorization header, without Bearer
token URL parameterNo equivalent

CNPJ and root lookups

CNPJ.wsCNPJáNotes
cnpj in the pathtaxId in the Lookup CNPJ path14 characters; CNPJá also accepts the alphanumeric CNPJ, in uppercase.
cnpj-raiz in the pathid in the Lookup company path8 characters.
page on /cnpj-raizNo equivalentLookup company returns every establishment at once.
/cnpj-raiz filters named in filtros_disponiveis and filtros_aplicados: nome_fantasia, pais_id, estado_id, cidade_id, atividade_principal_id, tipoNo equivalentFilter establishments[] by tradeName, address.country.code, address.state, address.municipality, primaryActivity.code and type.code.
No equivalentmaxAgeMaximum data age, default 45d. See Max age and partial success.
No equivalentexpandcompany.taxRegime, stateRegistry, suframa and address.coordinates.
CNPJ.wsCNPJáNotes
cursorcursorSend nextCursor alone, with no other parameter.
limite or limitlimitFrom 1 to 1000, default 10.
atividade_principal_idprimaryActivity.code.in7-digit CNAE.
atividade_secundaria_idsecondaryActivities.code.some7-digit CNAE.
atividade_ideconomicActivities.code.somePrimary or secondary activity.
natureza_juridica_idcompany.legalNature.code.in4 digits.
razao_socialcompany.legalName.someEach word counts on its own; to require every word, use search.
nome_fantasiatradeName.somenames.some searches the legal name or the trade name.
pais_idaddress.country.code.inAlpha-2 code, such as BR, instead of the BACEN code.
estado_idaddress.state.inUF abbreviation, such as SP, instead of the state’s IBGE code.
cidade_idaddress.municipality.in7-digit IBGE code.
cepaddress.postalCode.in8 digits; address.postalCode.gte and .lte form a range.
situacao_cadastralstatus.code.inACTIVE, CLOSED, NONCOMPLIANT, VOID, SUSPENDED.
data_situacao_cadastral_de and _atestatusDate.gte and statusDate.lteClosed range.
porte_idcompany.size.code.in01 becomes MICRO and 03 becomes SMALL; 00 and 05 fall under OTHER.
socio_nomeNo equivalent in Search CNPJUse search or legalName.in in Search people.
socio_cpf_cnpjNo equivalent in Search CNPJUse taxId.in in Search people. A CPF is matched on its fourth to ninth digits and can match other people with the same digits.
data_inicio_atividade_de and _ateincorporationDate.gte and incorporationDate.lteClosed range.
tokenNo equivalentThe key goes in the header.
No equivalentsort and orderrelevance by default, or taxId, incorporationDate, company.shareCapital or company.legalName, in ASC or DESC order. See Sorting.

CNPJá has more filters, such as share capital, tax regime, phones, emails and CNPJ lists. See CNPJ search and lists and Search filters.

SUFRAMA check

CNPJ.wsCNPJá
cnpj in the bodytaxId in the Lookup CNPJ path, with expand=suframa
inscricao in the bodyNo equivalent: look for the number in suframa.registrations[].number

Response fields

CNPJ.ws paths starting with estabelecimento. come from inside the estabelecimento object. In CNPJá, the establishment sits at the root of the Lookup CNPJ response.

Identification and status

CNPJ.wsCNPJáNotes
estabelecimento.cnpjtaxId
cnpj_raiz, estabelecimento.cnpj_raizcompany.id
estabelecimento.cnpj_ordemNo equivalentCharacters 9 to 12 of taxId.
estabelecimento.cnpj_digito_verificadorNo equivalentCharacters 13 and 14 of taxId.
estabelecimento.tipotype.code and type.labelHEAD head office, BRANCH branch.
estabelecimento.nome_fantasiatradeName
estabelecimento.data_inicio_atividadeincorporationDate
estabelecimento.situacao_cadastralstatus.code and status.labelAtiva becomes ACTIVE, Baixada becomes CLOSED, Inapta becomes NONCOMPLIANT, Nula becomes VOID, Suspensa becomes SUSPENDED.
estabelecimento.data_situacao_cadastralstatusDate
estabelecimento.motivo_situacao_cadastralstatusReason.code and statusReason.label2-digit code; present only when not active.
estabelecimento.situacao_especialspecialStatus.code and specialStatus.label3-digit code; present only for active establishments with a special status.
estabelecimento.data_situacao_especialspecialStatusDateSame condition as specialStatus.
estabelecimento.atualizado_emupdatedAtLast update from the Receita Federal.

Address and contacts

CNPJ.wsCNPJáNotes
estabelecimento.tipo_logradouro and estabelecimento.logradouroaddress.streetThe street type comes with the name, as in Avenida Brigadeiro Faria Lima.
estabelecimento.numeroaddress.number
estabelecimento.complementoaddress.details
estabelecimento.bairroaddress.district
estabelecimento.cepaddress.postalCode8 digits.
estabelecimento.cidade.nomeaddress.city
estabelecimento.cidade.ibge_idaddress.municipality7-digit string, not a number.
estabelecimento.cidade.id, estabelecimento.cidade.siafi_idNo equivalent
estabelecimento.nome_cidade_exterioraddress.cityFor establishments abroad.
estabelecimento.estado.siglaaddress.state
estabelecimento.estado.nome, estabelecimento.estado.id, estabelecimento.estado.ibge_idNo equivalent
estabelecimento.pais.iso2address.country.code
estabelecimento.pais.nomeaddress.country.label
estabelecimento.pais.id, estabelecimento.pais.iso3, estabelecimento.pais.comex_idNo equivalent
estabelecimento.ddd1 and estabelecimento.telefone1, estabelecimento.ddd2 and estabelecimento.telefone2phones[].numberOne item per phone, in E.164 with the area code: +5511900000000. The type is in phones[].type: LANDLINE or MOBILE.
estabelecimento.ddd_fax and estabelecimento.faxNo equivalent
estabelecimento.emailemails[].addressA list of emails, each with its type in emails[].type.
No equivalentaddress.coordinatesLatitude and longitude with expand=address.coordinates. See Location and maps.

Activities

CNPJ.wsCNPJáNotes
estabelecimento.atividade_principal.idprimaryActivity.code7-digit CNAE.
estabelecimento.atividade_principal.descricaoprimaryActivity.label
estabelecimento.atividades_secundarias[].idsecondaryActivities[].code
estabelecimento.atividades_secundarias[].descricaosecondaryActivities[].label
Activity secao, divisao, grupo, classe and subclasseNo equivalent

Company and partners

CNPJ.wsCNPJáNotes
razao_socialcompany.legalName
capital_socialcompany.shareCapitalA number, not a string: 99999.99.
porte.id and porte.descricaocompany.size.code and company.size.label01 becomes MICRO, 03 becomes SMALL, the rest become OTHER.
natureza_juridica.id and natureza_juridica.descricaocompany.legalNature.code and company.legalNature.labelSame 4-digit code.
responsavel_federativocompany.federativeEntity.code and company.federativeEntity.labelObject present only for public-administration legal natures: BR for the federal government, the UF abbreviation or the municipality’s IBGE code.
qualificacao_do_responsavelNo equivalent
atualizado_emupdatedAtCNPJá has an update date for the establishment, not for the company.
socios[]company.partners[]Details in Partners and people.
socios[].nomecompany.partners[].person.legalName
socios[].cpf_cnpj_sociocompany.partners[].person.taxIdMasked CPF or CNPJ; null for foreigners and for partners known only by name.
socios[].tipocompany.partners[].person.type.code and .labelPessoa Física becomes INDIVIDUAL; also ESTABLISHMENT, FOREIGNER and UNKNOWN.
socios[].data_entradacompany.partners[].admissionDate
socios[].faixa_etariacompany.partners[].person.ageGroup41 a 50 anos becomes 41-50; no label.
socios[].qualificacao_socio.idcompany.partners[].role.codeA 2-digit string, not a number: 5 becomes 05.
socios[].qualificacao_socio.descricaocompany.partners[].role.label
socios[].pais.iso2company.partners[].person.domicileCountry.code
socios[].pais.nomecompany.partners[].person.domicileCountry.label
socios[].pais_id, socios[].pais.id, socios[].pais.iso3, socios[].pais.comex_idNo equivalent
socios[].cpf_representante_legalcompany.partners[].legalRepresentative.person.taxIdIn CNPJá, legalRepresentative appears only when there is a representative.
socios[].nome_representantecompany.partners[].legalRepresentative.person.legalName
socios[].qualificacao_representantecompany.partners[].legalRepresentative.role.code and .label
socios[].atualizado_emNo equivalent
No equivalentcompany.partners[].person.idThe person’s CNPJá ID, used in Lookup person.

Tax data

These fields require expand. The tax regime comes with expand=company.taxRegime, state registrations with expand=stateRegistry and SUFRAMA registrations with expand=suframa. See Tax regime, State registrations and SUFRAMA.

CNPJ.wsCNPJáNotes
simples.simplescompany.taxRegime.type.codeSimples Nacional optants come as SIMPLES_NACIONAL, as SIMPLES_NACIONAL_HYBRID when they also opt into the IBS or CBS regular regime or, for MEIs, as SIMPLES_NACIONAL_SIMEI.
simples.data_opcao_simplescompany.taxRegime.simplesNacionalStartDateStart of the current Simples Nacional period. Present only when type.code is SIMPLES_NACIONAL, SIMPLES_NACIONAL_HYBRID or SIMPLES_NACIONAL_SIMEI, and may be null.
simples.meicompany.taxRegime.type.codeMEIs come as SIMPLES_NACIONAL_SIMEI.
simples.data_opcao_meicompany.taxRegime.simeiStartDateStart of the current SIMEI period. Present only when type.code is SIMPLES_NACIONAL_SIMEI, and may be null.
simples.data_exclusao_simples, simples.data_exclusao_meicompany.taxRegime.timeline[].endDateWith company.taxRegime.view=DETAILED, in the SIMPLES_NACIONAL_PERIOD and SIMEI_PERIOD items. An exclusion with a future date comes in startDate, in the SIMPLES_NACIONAL_EXCLUSION and SIMEI_EXCLUSION items.
simples.atualizado_emcompany.taxRegime.updatedAt
estabelecimento.regimes_tributarios[]company.taxRegime.timeline[]With company.taxRegime.view=DETAILED on Lookup CNPJ. CNPJ.ws returns one row per year; CNPJá returns periods with a start and an end. Actual, presumed and arbitrated profit have one period per calendar year declared in the ECF, and Simples Nacional, SIMEI and the IBS and CBS regular regime have periods of any length. See Regime history.
estabelecimento.regimes_tributarios[].anocompany.taxRegime.timeline[].startDate and company.taxRegime.timeline[].endDateIn ECF periods, from January 1 to December 31 of the calendar year.
estabelecimento.regimes_tributarios[].regime_tributariocompany.taxRegime.timeline[].type.codeLUCRO REAL becomes ACTUAL_PROFIT_PERIOD; also PRESUMED_PROFIT_PERIOD, ARBITRATED_PROFIT_PERIOD, SIMPLES_NACIONAL_PERIOD, SIMEI_PERIOD, REGULAR_IBS_PERIOD and REGULAR_CBS_PERIOD. IMUNES E ISENTAS has no equivalent. The current regime is in company.taxRegime.type.code: ACTUAL_PROFIT, PRESUMED_PROFIT, ARBITRATED_PROFIT, SIMPLES_NACIONAL, SIMPLES_NACIONAL_HYBRID, SIMPLES_NACIONAL_SIMEI or NOT_APPLICABLE.
estabelecimento.regimes_tributarios[].forma_de_tributacaocompany.taxRegime.timeline[].type.codeThe period type already states the taxation method, with no separate field.
estabelecimento.regimes_tributarios[].atualizado_emcompany.taxRegime.updatedAtOne date for the whole tax regime, not per year.
estabelecimento.inscricoes_estaduais[]stateRegistry.registrations[]By default only the establishment’s UF; for every UF, send stateRegistry.states=ALL.
estabelecimento.inscricoes_estaduais[].inscricao_estadualstateRegistry.registrations[].number
estabelecimento.inscricoes_estaduais[].ativostateRegistry.registrations[].isEnabledRegistration enabled as a taxpayer.
estabelecimento.inscricoes_estaduais[].estado.siglastateRegistry.registrations[].state
estabelecimento.inscricoes_estaduais[].atualizado_emstateRegistry.registrations[].updatedAt
estabelecimento.inscricoes_suframa[]suframa.registrations[]The registration’s number, status, dates, address and activities.

When company.taxRegime.type.code is SIMPLES_NACIONAL_HYBRID, company.taxRegime.view=DETAILED also returns company.taxRegime.regularIbsStartDate and company.taxRegime.regularCbsStartDate, the start of the current IBS and CBS regular regime periods, which come only from live queries at the Simples Nacional. Either may be null when the company opts into only one of the two.

CNPJá also returns in stateRegistry each registration’s type, the recipient restriction and the interstate blocks, and with stateRegistry.view=DETAILED the activity, the address and the authorized tax documents.

CNPJ root

CNPJ.wsCNPJáNotes
data[]establishments[].taxIdEach establishments[] item also carries type, trade name, status, address and primary activity.
paginacaoNo equivalentNo pagination.
ordenacao, filtros_disponiveis, filtros_aplicadosNo equivalent

Lookup company also returns the company data, the partners in partners[] and the tax regime in taxRegime, always present and without the history or the IBS and CBS regular regime dates.

Search

CNPJ.wsCNPJáNotes
data[]records[].taxIdEach record carries the establishment’s registration data, the company, the partners and the tax regime without the history or the IBS and CBS regular regime dates.
paginacao.limitelimit
paginacao.totaltotalMay vary between pages.
paginacao.proximo_cursornextCursornull on the last page.
paginacao.tem_proxima_paginanextCursor other than null
paginacao.tem_pagina_anterior, paginacao.cursor_anterior, paginacao.cursor_pagina_atual, paginacao.cursor_consulta_atualNo equivalentPagination only moves forward.
filtros_disponiveis, filtros_aplicadosNo equivalent

SUFRAMA check

CNPJ.wsCNPJáNotes
cnpj_raizcompany.id
cnpjtaxId
inscricao_suframasuframa.registrations[].number
ativosuframa.registrations[].status.codeACTIVE, INACTIVE, BLOCKED or CANCELLED.
atualizado_emsuframa.registrations[].updatedAt

Formats

  • Classified values come as code and label. Use the code in logic and the label only for display, since it changes with the language. See Response format.
  • Numbers are numbers: company.shareCapital is not a string. Codes are strings without punctuation, including the municipality’s IBGE code and the partner role.
  • Phones come in E.164, with +55 and the area code in the same value.
  • A resource requested in expand is always present, even when empty; a resource you don’t request is absent.

Behavior differences

Freshness and caching

The CNPJ.ws documentation states that its lookup and search use the service’s own database, which can lag up to 45 days behind the Receita Federal. In CNPJá, each resource comes from the cache while it is within maxAge and is queried live, before the response, when it is older or was never fetched. maxAge ranges from 5m to 1y, with a 45d default, and each resource reports its last update in its own updatedAt. Lookup company and Search CNPJ don’t accept maxAge and serve cached data only. See Max age and partial success.

Partial success

When a live query fails or runs past its time limit, the response is 206, with the same shape as 200: the affected resource keeps its cached data, or comes back empty if it was never fetched, and is not billed. With no cached data to fall back on, such as on a CNPJ’s first lookup, the request fails instead of returning 206. Treat 206 as success and compare each resource’s updatedAt with the limit you asked for. See Partial success.

Errors

The CNPJ.ws documentation lists the 401, 404 and 429 statuses on the lookups and the SUFRAMA check, and 400, 401, 403 and 429 on the search. In CNPJá, every error body carries status, code, message and traceId. Handle errors by code, which is stable, such as ESTABLISHMENT_NOT_FOUND or COMPANY_NOT_FOUND, and use message for display only. See Limits and errors.

Limits

The CNPJ.ws commercial API serves up to 500 requests per minute per subscription. In CNPJá, with a key, the requests-per-second and concurrent-request limits apply to the whole organization, across all of its keys, and follow its plan; without a key, they apply to each source IP. The values are in Usage limits. Above them, the response is 429, not billed. Each request has a maximum duration, and the client timeout must stay above it, as shown in Timeout and size.

Billing

Each resource in the response is billed separately, as a live query, which costs more, or a cached query, and each unit has its own quota in the plan, renewed every month. On Pro, the quota of each unit can grow with packs, and the organization can set a budget to pay for each query beyond the quota at the per-query overage price, so an exhausted quota does not have to stop the integration. When a quota runs out with no overage budget, or the month’s budget runs out, every request made with one of the organization’s keys gets 402, as explained in Quota used up; on Free, which has no packs or budget, this happens as soon as the quota runs out. Requests without a key, rejected requests and server failures are not billed, as listed in What is not charged. On Lookup CNPJ, the registration and each resource requested in expand count separately, and Search CNPJ and Lookup company consume cached queries. Responses carry no cost headers: track usage under Usage. See Queries and quota, what each operation consumes in the Metering Rules and Pricing.

Pagination

Search CNPJ uses a cursor like CNPJ.ws, but forward only. Send each page’s nextCursor as cursor, on its own, without repeating filters or limit, until nextCursor comes back null. The cursor keeps the filters, sort, order and limit of the first request and is valid for a set time between one page and the next, given in Timeout and size; once expired, the response is 400 PAGE_CURSOR_INVALID and the search starts over. Drop duplicates by taxId. See Pagination.

Important: cursor must be the request’s only parameter. With any other, including limit, CNPJá returns 400 REQUEST_VALIDATION_FAILED.

Language and labels

label values and error messages come in Portuguese by default; send Accept-Language: en-US to get them in English. Codes, field names and official source data are never translated. Use code in your logic and label for display only. See Language.

No equivalent

  • Checking monthly request usage through the API. Track usage in Usage and Requests.
  • Renewing the token through the API. Create and revoke keys in API keys.
  • A dedicated SUFRAMA check call, with the registration number in the body.
  • Page-number pagination on the CNPJ root and the previous page on the search.
  • Partner filters inside the company search.
  • The list of available and applied filters in the response.
  • The state, city and country id fields, the SIAFI code, the BACEN code and the country’s ISO alpha-3.
  • The CNAE hierarchy in section, division, group, class and subclass.
  • Years with the IMUNES E ISENTAS regime in regimes_tributarios.
  • The fax and the responsible person’s role.

Step by step

  1. Create the account and an API key, as in First request.
  2. Switch authentication: send the key alone in the Authorization header and remove token from the URLs.
  3. Switch the URLs: /cnpj/{cnpj} to /v2/establishments/{taxId}, /cnpj-raiz/{cnpj-raiz} to /v2/companies/{id} and /v2/pesquisa to /v2/establishments.
  4. Set each call’s expand to match the tax fields you use, and maxAge to match the data age you accept.
  5. Rewrite the field mapping with the tables above, converting text descriptions into code values.
  6. On the CNPJ root, remove the page loop and filter establishments[] in your code.
  7. On the search, convert the filters, send cursor alone and read the data straight from records[].
  8. For the SUFRAMA check, use expand=suframa and compare the number in suframa.registrations[].number.
  9. Handle errors by code, accept 206 as success and retry 429, 500 and 504 with backoff.
  10. Validate the integration with the key. Lookup CNPJ also accepts requests without a key and with no parameters in the URL, as in Public access; expand, searches and Lookup company require the key.
  11. Compare the responses for a sample of CNPJs between both integrations, track usage in Usage and then switch traffic.

Sources for this comparison

What this page says about CNPJ.ws comes from its public documentation:

  • Overview: the response structure and the data lag.
  • Public API reference: the lookup and the SUFRAMA validation without a token.
  • Commercial API reference: authentication, the lookup, the paginated root, the search, the SUFRAMA validation, the monthly usage, the token renewal and the per-minute limit.
  • Data models: the company, partner, Simples Nacional and tax regime fields.
  • Establishments: the establishment fields.
  • Error messages: the errors.

Sources accessed on November 19, 2026.

Third-party trademarks on this page are used only to identify them, with no affiliation or endorsement (Terms of Use).

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.