Refresh CNPJ data live
How to refresh a CNPJ's data live from the Receita Federal, Simples Nacional, CCC and SUFRAMA, read the age of each source and adjust automatic updates.
Refreshing live queries the official source now and replaces, on screen, the stored data with the data of the moment. The controls sit at the top of the record page (CNPJ > legal name > Update all), in the Sources menu and next to the age of each section, and they work for members of an organization.
Live and cached
Each part of the record comes from a source and is stored by CNPJá with the date of its last query. Opening the record shows that stored data, a cached query. A live query asks the source again, takes a few seconds and updates what is stored. How the two work together is in Data freshness: live and cached.
You can refresh five sources on the record:
| Source | What it refreshes |
|---|---|
| Receita Federal | Overview, Contacts, Activities and Partners and administrators |
| Simples Nacional | Tax regime |
| CCC | State registrations |
| SUFRAMA | SUFRAMA |
| Geolocation | The coordinates and the Precision, under Geolocation |
The coordinates are recomputed from the registered address, as explained in Data sources. The street view and the aerial map are part of no refresh: they are only rendered when you click Load, as explained in Map, street view and coordinates.
Without an account or an organization, the refresh buttons carry a padlock with the hint Requires an account, and Sources shows Live queries need an account. See Guests, accounts and organizations.
Age of each source
The age of each source shows in the header or footer of the section it feeds and under Sources, always beside a dot in the color of the reading’s kind, as across the app: teal for live and grey for cache. The color tells the kind, never the age: an outdated reading keeps its grey dot, and it is the age that turns amber. The Sections band shows only the dot:
| State | Age | How it shows |
|---|---|---|
| Live | Up to 1 hour | Teal dot. The details read Live |
| Fresh | Up to 7 days | Grey dot. The details read Cache |
| Outdated | Over 7 days | Grey dot and amber age. The details read Cache and Outdated |
| Never queried | No query | Hollow dot and Never queried |
Geolocation has no age, because the coordinates do not keep the date they were computed. It shows only Updated, when the record has coordinates, or Never queried, when it has none, whether they were never computed or the address was not located. The details read Live right after a computation made on the page and Cache otherwise.
The age is told relatively, such as “3 days ago”. Hover over it (or tap) to see the exact date and time of the query, in your time zone (Time zone and dates). Data that arrived with the source’s open data publication, such as the Receita Federal’s, shows only the publication date, with no time.
Refresh everything
Update all queries every available source of the record live, at once. Geolocation joins only while it shows Never queried: coordinates the record already has are recomputed only from that source’s own button, in Sources or in the section.
- At the top of the record page, check the number next to Update all: it is the total of live queries the action uses. For the CCC, its share is an estimate from the registrations already known in the establishment’s state, and usage follows the registrations the query finds, as in the Metering Rules. On smaller screens the button shows only its icon, and the cost shows when you hover.
- Click Update all.
- In the Run live queries? confirmation, check the receipt, with one line per source and the Total.
- Click Query, or Cancel to give up.
Each source is queried separately, so a slow source does not hold back the others. Each section updates as soon as its source answers, and a beam of light runs along the section while it waits. Once the answers are in, the Record updated in real time notice appears.
If you leave the record before the answers arrive, the page stops waiting for them and does not show what comes back later.
Refresh one source
To refresh a single source:
- Click the arrow next to Update all to open Sources.
- Check the age of each source and its automatic rule, such as “Auto 7d”. Geolocation shows Updated or Never queried instead of an age.
- Click the refresh button next to the source. The hint says what it does, such as “Run a live query: Receita Federal”, and its cost: Consumes one live query. For the CCC, the cost counts one query per registration already known in the establishment’s state, at least one, such as “Consumes 3 live queries”, and goes through the confirmation when it is more than one.
The same button shows in the header or footer of each section, next to the age or, under Geolocation, the state. An action that costs a single query runs without confirmation. When it costs more, the Run live queries? confirmation comes first, as with Update all.
State registrations by state
The CCC answers per state. In the State registrations panel, each state has a band with the age of its query, such as “CCC - SP”, and a refresh button of its own. A registration marked No details · query the state does not yet have the data only the state’s query brings.
- Under State registrations, find the state’s band.
- Click the band’s refresh button. If more than one state is waiting for details, use Fetch missing details, at the top of the panel, to query them all.
- If the confirmation appears, check the receipt and click Query.
The receipt recalls the CCC rule: CCC: 1 query per registration · at least 1 per state. Establishments abroad have no state, and the CCC is locked with the hint Establishments abroad have no state to query. What the details add is covered in State registration and CCC.
Automatic updates
Important: automatic updates are on by default. When a record opens, each source older than this browser’s rule, or never queried, is queried live automatically. Opening a record can use the organization’s live queries, without confirmation. Usage follows the Metering Rules and the Terms of Use.
The default rule is Older than 7 days for the Receita Federal, the Simples Nacional, the CCC and SUFRAMA, and When never queried for Geolocation: every source marked Outdated or Never queried is queried on open. The update runs once per opening, for members only, and, for the CCC, includes the details of the registrations in the establishment’s state, never those of other states. After it, reopening the record within the rule’s window does not query again.
Important: under the default rule, a record without coordinates queries Geolocation live as it opens. An address that cannot be located stays without coordinates and marked Never queried, so it is queried and charged again on every opening, until you choose Never for Geolocation. See Address not located and the usage in the Metering Rules.
To change the rule:
- At the top of the record page, click the arrow next to Update all to open Sources.
- At the foot of the menu, click Automatic updates.
- For each source, pick a rule on the ruler of options.
- Click Close. The choice applies right away.
| Option on the ruler | Rule | When the source is queried on open |
|---|---|---|
| Never | Never | Never. The source is only queried when you click |
| If never | When never queried (default for Geolocation) | Only if the source was never queried for the CNPJ. For Geolocation, whenever the record has no coordinates |
| 1 hour | Older than 1 hour | When the last query is over 1 hour old, or there was none |
| 1 day | Older than 1 day | When it is over 1 day old, or there was none |
| 7 days | Older than 7 days (default for the other sources) | When it is over 7 days old, or there was none |
| 30 days | Older than 30 days | When it is over 30 days old, or there was none |
Geolocation has only Never and If never: since the coordinates carry no date, there is no age to choose. On each source’s ruler, a dot marks the default rule, as the Default legend in the dialog’s footer recalls.
Next to each source, the dialog shows what the rule would do with the open record: Would query on open, Up to date, Not queried on open or Unavailable. Under Sources, each source shows the rule in force, such as “Auto 7d” or, for Geolocation, “Auto If never”.
The choice is saved in this browser, as the dialog’s footer notes (Saved in this browser), and does not follow your account: another browser or device uses the default rule until it is set. What else stays in the browser is covered in Data stored in your browser.
Tip: to use live queries only when you click, choose Never for every source. The record still opens with the stored data and the age of each item.
Quota usage
Every refresh, manual or automatic, uses live queries of the selected organization; guests and accounts without an organization use none. The usage of each action is in the Metering Rules, and that of automatic updates under Automatic updates.
Common problems
When a query fails, a notice names the source and the section keeps its previous data:
| Message | What to do |
|---|---|
| The source took too long to answer, try again in a moment | The official source is slow or down. Try again later |
| Your session expired, sign in again to run live queries | Sign in again and repeat the refresh |
| The Receita Federal no longer lists this CNPJ | The Receita Federal no longer finds the CNPJ. The page keeps the last data obtained. See Registration status |
| The live query failed, try again in a moment | A momentary failure. Try again in a moment |
| The source answered only in part, try again in a moment | The source brought only part of what was asked: what it answered is already on screen, and the rest stays as it was. Try again in a moment |
| Live query allowance used up or This month’s overage budget doesn’t cover this | The organization used up its quota, or what is left of its overage budget doesn’t cover the query. See the ways out in Quota used up |
Other cases:
- Padlock on the button: the hint Requires an account means you need to sign in and belong to an organization.
- Spinning button: the query for that source is still running. Wait for the answer.
- Nothing was queried on open: check Automatic updates. The rule may be set to Never, the source may be Up to date, or the rule was chosen in another browser.
More cases in Troubleshooting.
In the API
In the API, each request sets the age it accepts with the maxAge parameter: a resource older than that is queried live. See Max age and partial success.