# Coruja: the CNPJá AI assistant

> How to use Coruja, the AI assistant in the CNPJá app: what she answers, how she shows you where to click, the lookups, exports and changes she makes on your behalf and the chat history.

Coruja is CNPJá's artificial intelligence assistant. She answers questions about the app, the data, the API and billing, shows you where to click on the screen itself, and queries CNPJá, exports spreadsheets and makes changes on your behalf, always within what your role allows. Her panel opens from the **Coruja** button, in the app header, next to the search, or with `Ctrl+J` (`⌘J` on a Mac). To chat with her, log in to your account: without an account, the panel invites you to log in or to create one.

Coruja is experimental: what she does and the way you talk to her may change. A strip at the top of her panel says so, with her guide and the **Send feedback** button, to tell us what you ran into.

## Open Coruja

1. Click **Coruja**, in the app header, next to the search, or press `Ctrl+J` (`⌘J` on a Mac). The panel opens on the right, with the cursor in the message field. On the website, the same button takes you to the app's **Dashboard** with Coruja already open, and so does **Talk to Coruja**, in the website footer and contact dialog.
2. Type in the **Ask Coruja…** field and click **Send** or press `Enter`. `Shift+Enter` starts a new line; on a touch screen, `Enter` starts a new line and only the button sends. In a new chat, the **Suggestions** offer questions about the screen you are on: click one to send it.
3. While she answers, short notes show what she is doing. To interrupt her, click **Stop**: whatever she already wrote stays in the chat.
4. To close it, click **Coruja** again or the panel's close button (**Close Coruja**), or press `Ctrl+J` once more.

In the global search, pick **Ask Coruja** to have her open in a new chat with what you typed. The line shows among the results, and only your pick sends the question ([Ask Coruja](https://cnpja.com/en-us/docs/app/global-search#coruja)).

With the panel closed, Coruja carries on with her answer, and a dot on the **Coruja** button tells you while she is working or waiting for your reply. Until Coruja is first opened in this browser, the dot invites you to meet her.

If an answer reaches the maximum length, the chat shows **The answer was cut short**: click **Continue** to have her pick up where she left off.

On documentation pages, the arrow next to **Copy page** holds **Ask Coruja**, which opens a new chat where she briefly explains the page and tells you where it shows up in the app. Without an account, it opens the panel with the invitation to log in ([Open in an AI assistant](https://cnpja.com/en-us/docs/support/using-the-docs#ai)).

The panel adapts to the screen:

- *On wide screens*, it sits beside the page and pushes it to the left, covering nothing. When the window has no room to spare, the app's sidebar folds to icons while Coruja is open and comes back as you left it when she closes, and the panel may be narrower than the width you chose, so the page isn't cramped.
- *On medium screens*, it opens over the content, below the app header. During a highlight or tour, it steps aside and comes back when it ends.
- *On a phone*, it fills the screen between the header and the tab bar and closes when you follow a link, to show the page that opened. During a highlight or tour, it sinks until only its top band shows, above the tab bar: tap it to close the highlight and return to the chat.

On wide and medium screens, drag the panel's left edge to widen or narrow it. With the focus on the edge, the `←` and `→` arrows do the same, and a double click on it restores the default width. Outside a phone, Coruja stays open as you navigate the app, and this browser remembers whether she was open and how wide the panel was for your next visit ([Cookies](https://cnpja.com/en-us/docs/privacy/browser-data#cookies)).

## What she answers

Coruja answers anything about CNPJá:

- *The app:* where each feature is, what each screen shows and how to get a task done, such as searching with filters, building a list or exporting.
- *The data:* what each field of a record means, where it comes from and when it was updated, and codes such as CNAE and legal nature.
- *The API and integrations:* authentication, parameters, responses, errors and request examples, including migrating from other services.
- *Billing:* plans, quota, usage, packs, subscription and invoices.

To answer, she looks things up in the help center, the API documentation and the terms and policies, and cites the guides she relies on, with links to them.

She answers in a few lines and leaves the details for when you ask. When a request is vague or could mean more than one thing, she first asks what you need and offers ready-made replies: click one to send it, or write your own.

In the app, she is CNPJá's support: she works to solve the problem in the chat itself and, when she can't, offers to send the team a report, as [feedback](https://cnpja.com/en-us/docs/support/feedback#feedback-vs-support). If you ask for a contact or want to talk to a person, she gives you the channel ([Official channels](https://cnpja.com/en-us/docs/support/contact#channels)).

She declines topics unrelated to CNPJá. On legal matters, such as laws, contracts and what the [Terms and policies](https://cnpja.com/en-us/legal) say, she only points to where the subject is covered, without interpreting or discussing it.

> **Important:** Coruja uses artificial intelligence and can make mistakes. Before acting on an answer, check the data in the record and the rule in the guide or document she cites.

## Show where to click

When your question is about the screen, Coruja can show you the way on the page itself, instead of only describing it:

| What she does | How it works |
| --- | --- |
| Reads the screen | Reads the visible headings, buttons, links, tabs, fields and columns, and the page text, to know where you are. She doesn't read what is typed in the fields, confidential snippets such as verification codes, or the panel itself |
| Highlights an element | Lights up an outline around a button, field or tab, with a bubble explaining what it is for. The page stays usable. Close it with **Got it**, a click on the element or `Esc` |
| Gives a tour | Highlights several elements in sequence, one step at a time. Move forward with **Next** or a click on the highlighted element and back with **Back**, or use the `→` and `←` arrows. **Done** closes the last step, and `Esc` closes the tour at any time |
| Navigates | Opens another page of the app, such as a search with filters or the organization's settings. Opening a CNPJ record, a partner or CEP record, or the **Network** starting from a person uses quota and asks first, depending on the **Autonomy** chosen ([Lookups on your behalf](#quota)) |
| Fills in a form | Types what you asked for into the fields of a form on the page, such as the name of an API key, and highlights the button for you to confirm. She never submits the form or fills in passwords, codes, card data, keys or a person's CPF |
| Opens a guide | Opens the guide in the help drawer, without leaving the screen ([Help on every page](https://cnpja.com/en-us/docs/app/tour#page-help)) |

Each action shows in the chat as an activity line. The line of a highlight or tour has **Show again**, which repeats it while the elements are still on the page, and moving to another page closes the highlight. She only opens pages of the app, never the website or other addresses.

## Lookups on your behalf

Coruja queries CNPJá for you, with your session: she sees and does only what your role allows in the organization in use, the one in the organization selector ([Permissions by role](https://cnpja.com/en-us/docs/organizations/members-and-roles#matrix)). If the selected organization changes before a request runs, as when another tab selects another organization or you retry a request made in the previous one, Coruja does nothing: she shows **The organization changed**, the tab switches to the organization now selected and you write the request again. Her answers can bring the results in cards, fact sheets, charts and step-by-step guides, with links to the full page in the app. When she searches again in the same answer, the earlier searches of the same kind stay on their line only, with the total, which opens their results in a click. When she only needs a count, such as the companies in each city, the line shows the total alone.

| Lookup | What it covers | Asks first |
| --- | --- | --- |
| Searches | Companies, partners and CEPs, with the filters of the app's search, codes such as CNAE and legal nature, and the day's company openings | No |
| Account and organization data | Your account and your organizations, quota, usage, requests, lists, views, exports, members, API keys, subscription, invoices and plans, depending on your role. An invoice is read in full, with a link to its page and to the boleto PDF | No |
| Records | A CNPJ record and a partner or CEP record, including when she opens those pages for you | Depending on the **Autonomy** |
| Live refreshes | A record's sources queried again at the source, such as the Receita Federal or the Simples Nacional | Depending on the **Autonomy** |
| Certificates and images | A CNPJ's certificates in a PDF and the aerial map or Street View of its address, on a card | No: the quota is used when you click **Download PDF** or **Load the image** |
| Changes | Lists, views, members, API keys, the organization, the subscription and your account ([Changes on your behalf](#changes)) | Yes, always |
| Exports | Exporting a list, a search, a view or CNPJs to a spreadsheet ([Export with Coruja](#export)) | Yes, always |

When an action asks first, Coruja stops and shows on a card what she is about to look up, change or export and what it uses or costs:

1. Check what the card shows, such as the CNPJ, the list and the name it had before, or the amount of a billing change.
2. Click **Allow** to let her go ahead, or **Decline** to have her carry on without it.
3. With more than one request pending, answer each of them or click **Allow all**, which doesn't show when one of them changes billing. The chat resumes once all of them have an answer.

Sending another message without answering declines the pending requests.

Searches don't use the quota, nor does chatting with Coruja without lookups ([What is not charged](https://cnpja.com/en-us/legal/metering#not-charged)). Reading a record in the chat uses the quota of the organization in use just like opening its page in the app, without the automatic updates ([Metering Rules](https://cnpja.com/en-us/legal/metering#coruja)). Without an organization, each record she reads counts toward the [limit on use without an account](https://cnpja.com/en-us/docs/billing/limits#guest), and searches never do. How the quota works is covered in [Queries and quota](https://cnpja.com/en-us/docs/billing/queries-and-quotas).

**Autonomy**, under the message field, sets how much Coruja does without asking. Reading, searching and moving around never ask, and changes, exports and billing changes always ask:

| Option | What she does without asking |
| --- | --- |
| **Always ask** | Nothing that uses quota: she asks before every query |
| **Query the cache without asking** | Reads and opens records, which use cached queries. A CNPJ not yet in the cache is read live once, also without asking ([A CNPJ's first lookup](https://cnpja.com/en-us/docs/data/freshness#first-lookup)). A record she opens may update itself live ([Automatic updates](https://cnpja.com/en-us/docs/companies/live-refresh#automatic-updates)); other live refreshes still ask |
| **Query without asking** | Live and cached queries |

Picking an option that lets more through also lets through the requests already waiting for an answer. The choice stays in this browser only and goes back to **Always ask** when you log out.

> **Important:** outside **Always ask**, each query Coruja runs uses the quota of the organization in use, without confirmation.

What Coruja looks up counts under your name, like your own actions in the app, and shows on the **Requests** page with you as the **Actor** ([Requests page](https://cnpja.com/en-us/docs/billing/usage#usage-events)). Once the quota runs out, the lookup is refused as it is in the app and Coruja tells you ([Quota used up](https://cnpja.com/en-us/docs/billing/quota-exhausted)). A live refresh of several sources at once only starts if what is left of the live quota, or of the overage budget, covers every source and state asked for; otherwise, it is refused before any source is queried. When only some sources answer, the record brings what answered, and the others keep their earlier reading.

## Changes on your behalf

Coruja does much of what you would do in the app for you, within what your role allows, always after you allow it on the card:

| Where | What she changes |
| --- | --- |
| Lists | Creates a list from CNPJs or from a search, renames it, adds and removes CNPJs |
| Views | Creates a view from a search, renames it and replaces the search it keeps |
| Members | Invites, cancels invitations and changes a member's role |
| API keys | Renames them and changes their color |
| Organization | Changes its name and logo |
| Subscription | Changes the payment method, when the tax document is issued, the default card and the overage budget, and cancels at the end of the period or undoes the cancellation. A new payment method applies at once and issues a new charge for the open invoices, and making a card the default charges it at once for the invoices declined on a card ([New card attempts](https://cnpja.com/en-us/docs/billing/payment-methods#card-retries)) |
| Your account | Changes your name and the language of spreadsheets |
| Other | Refreshes a record's sources live, switches the organization in use, changes the app's theme and sends a message to the CNPJá team |

After each change, the open page shows the result. When a change replaces something, such as a list's name or a view's search, Coruja keeps what was there before: ask her to undo it and she puts it back, also with your permission.

What can't be undone or needs a secret stays with you: deleting lists and views, removing members or leaving an organization, creating or revoking API keys, adding or removing cards, creating an organization, subscribing, changing packs or the due day, paying an invoice or issuing a new charge, cancelling an order still awaiting its first payment, deactivating the account or the organization, changing the e-mail, the password and connected accounts, logging in and out. In those cases, Coruja opens the page, fills in what she can of the form and highlights the button for you to confirm ([Show where to click](#guidance)).

## Export with Coruja

Ask Coruja to export what the app's [export](https://cnpja.com/en-us/docs/lists/export) and [bulk lookup](https://cnpja.com/en-us/docs/lists/bulk-lookup) export: a list, the companies of a search, such as *export the active bakeries in Campinas*, a view, the part of a list some filters leave, or CNPJs you paste in the chat. She hands over the Excel spreadsheet right in the chat:

1. She confirms what to export and counts how many establishments it covers, free of charge. If the request doesn't say whether it is a list, a search or some CNPJs, she asks. Long lists of CNPJs go through the [bulk lookup](https://cnpja.com/en-us/docs/lists/bulk-lookup).
2. By default, the spreadsheet holds each establishment's registration. Ask for any resources to add, such as tax regime, state registrations, SUFRAMA or coordinates. Ask also for the detailed level of the regime or of the registrations and the registrations of every state or of some. A search, a view or a list is exported with the **1 year** max age, which takes from the cache what it read in the last year ([Max age](https://cnpja.com/en-us/docs/lists/export#max-age)), and CNPJs you paste in the chat, or data you ask for up to date, are read live (**Live**): ask for another max age if you need it. When the export fits neither the quota nor the overage budget, she offers the other age, with what it consumes, before suggesting a smaller selection.
3. The permission card shows what will be exported, how many establishments it covers, the resources and the age of the data, how much the export uses of each quota and the **Extra cost**, as the [estimated consumption](https://cnpja.com/en-us/docs/lists/export#estimate) of an export from the app does, saving nothing beforehand. Click **Allow** to export. A search or some CNPJs then become a new list of the organization, under the name Coruja suggested, and a search also becomes a view of the same name if you ask.
4. A card follows the export, from the queue to the finished spreadsheet, and tells you when it is done. Click **Download** to save the spreadsheet, or each **Part** when it is split.

The export also shows under **Exports**, on the list's page, and Coruja hands over the spreadsheet of an earlier export again when you ask, while it is kept ([Previous exports](https://cnpja.com/en-us/docs/lists/export#previous-exports)). It uses quota as an export made in the app does ([Exports on the web Platform](https://cnpja.com/en-us/legal/metering#platform-exports)), and how to export from the app is in [Export companies to an Excel spreadsheet](https://cnpja.com/en-us/docs/lists/export).

## Chat history

Chats are kept in this browser only, separately for each account, and the oldest give way to new ones when there are many ([History and recent items](https://cnpja.com/en-us/docs/privacy/browser-data#history)). Nothing goes to your account or to the organization, no other browser or device shows them and the other members can't see them. Tabs of the same browser show the same chats, and each tab remembers the chat open in it, even if you reload the page. A new tab starts on a new chat.

- **New chat** starts a blank chat, with the cursor in the message field.
- **History** lists the saved chats, newest first. Search them by title in **Search chats** and click one to pick up where you left off.
- To delete a chat, use **Delete chat**, the trash button that shows beside it in **History** when you hover over it. **Clear history**, at the foot of **History**, deletes every chat of your account in this browser, once you confirm.
- **Log out** deletes every chat in this browser and sets **Autonomy** back to **Always ask**, so the next person on the device can't read them or run queries unawares. Clearing the site's data in the browser settings deletes the chats too ([Clear what stays in the browser](https://cnpja.com/en-us/docs/privacy/browser-data#clear)).

When you reopen a chat that stopped before Coruja finished answering, for example because the page was reloaded mid-answer, it shows **The conversation was interrupted**. Click **Resume** to have her pick up where she left off.

## Privacy

To produce her answers, Coruja sends to an artificial intelligence provider:

- your messages;
- the page you are on and your account's context, such as your name, the organization in use, your role, the plan and the quota;
- what she reads for you, such as the screen's text and the data looked up.

How CNPJá handles personal data is set out in the [Privacy Policy](https://cnpja.com/en-us/legal/privacy#sharing).

> **Tip:** don't type passwords, API keys or personal data the question doesn't need.

## In the API

The API has no Coruja: what queries the API is your application, with an API key ([First request](https://cnpja.com/en-us/docs/api/first-request)). Coruja helps plan the integration, explains operations and errors and writes request examples based on the [API documentation](https://cnpja.com/en-us/docs/api).
