# Create and manage CNPJ lists

> How to create CNPJ lists on CNPJá from a search, by pasting CNPJs or uploading a file, add and remove entries, and use a list as a search filter.

A list keeps a fixed set of the organization's CNPJs, built from a search, by pasting CNPJs or by loading a file, to use as a search filter or export to a spreadsheet. Lists live in the **CNPJ** app, in the **Lists** group of the sidebar, and all of them appear under **Lists** > **View all**.

## What a list is

A [list](https://cnpja.com/en-us/docs/glossary#lista--list) is static: it keeps the establishments themselves, not the criteria that picked them. It only changes when someone in the organization adds or removes CNPJs, and it does not follow the registry: an establishment that no longer matches the original search stays in the list. The data shown for each establishment, on the other hand, comes from the registry CNPJá keeps at the time you open the list, not from a copy made when it joined the list.

To keep a search whose results follow the registry, use a [view](https://cnpja.com/en-us/docs/search/views#view-or-list), which is dynamic.

## Who can use it

Lists belong to the organization. Any member, in any role, creates, uses, changes, exports and deletes the lists of the organization in use, and everyone sees the same lists, as the [permissions matrix](https://cnpja.com/en-us/docs/organizations/members-and-roles#matrix) shows. Without an organization, the **Lists** group does not appear in the sidebar, and without an account the addresses of lists lead back to **Search CNPJ**, as [Guests, accounts and organizations](https://cnpja.com/en-us/docs/app/access-levels#matrix) explains. A link to a deleted list, or to one from another organization, opens **List not found**.

## Create from a search

1. In **Search CNPJ**, or in a view, apply the search and filters that describe the establishments.
2. Click **Save as list**, at the top of the page.
3. Name the list in the **Name** field.
4. Click **Save**.

The list keeps every establishment that matches the search, not only the ones on the page on screen, as a snapshot of that moment: the dialog shows the count and the time the snapshot is taken. When the search goes past the limit of a list, the dialog warns that only the first ones will be saved. Once saved, the list opens on its own page, except on a view with unsaved changes, where you stay on the view and the notice carries **Open list**, as [Open and change](https://cnpja.com/en-us/docs/search/views#changes) explains.

With a search that has no results, **Save as list** is dimmed and its tooltip says **No establishments to save**.

**Export** also saves the search as a new list, when the export is sent, with no need for **Save as list** first, and, on a list's page, **Export** is how the filtered establishments become a new list, as [Export to a spreadsheet](https://cnpja.com/en-us/docs/lists/export) explains.

## Create by pasting CNPJs or with a file

1. Click **Create list**, at the top of the **Lists** page, or the **+** next to **Lists** in the sidebar.
2. In the **Create a list** dialog, fill in the **Name**.
3. Type or paste the CNPJs in the **CNPJs** field, or click **Load file** to read an Excel, CSV or text file.
4. Click **Create list**.

The field highlights valid CNPJs, points out invalid ones and counts repeats only once. Only valid CNPJs go into the list. Separators, file formats and leading zeros are covered in [Import CNPJs](https://cnpja.com/en-us/docs/lists/import).

## Work inside a list

The list's page, opened from the sidebar or from the **Lists** table, shows its establishments in the same table as **Search CNPJ**. At the top, on wide screens, the count says how many establishments are shown and, when that number differs from the list size, how many the list holds in total. The difference comes from the filters applied or from valid CNPJs not yet in CNPJá's data: they count in the list but only show in the table once they enter the search index, as [When a new CNPJ appears](https://cnpja.com/en-us/docs/data/search-matching#index-lag) explains.

- **Search and filters:** the **Search a CNPJ, name or address** field and the filter band work as in the search, but only among the list's establishments. The [filters](https://cnpja.com/en-us/docs/search/filters) applied stay in the page address.
- **Record:** click the CNPJ on a row to open the establishment's record.
- **Export:** with no search or filter on screen, **Export** makes a spreadsheet of the whole list, and, when the search or the filters leave part of the list out, the window first asks **What to export**, as [Export to a spreadsheet](https://cnpja.com/en-us/docs/lists/export#filtered-list) explains.

The **Lists** page gathers every list of the organization, with the **Search lists** field, which searches by name:

| Column | What it shows |
| --- | --- |
| **Name** | The list name and, under it, the creation date |
| **Establishments** | How many CNPJs the list holds, with a bar showing how full it is |
| **Updated** | How long ago the list last changed; hover to see the date and time |
| **Exported** | The progress of the export under way, or the date of the latest ready spreadsheet, which leads to the list's exports |

On narrow screens, the columns on the right drop out, and the count and the export progress move under the name.

## Add and remove CNPJs

To add:

1. On the list's page, click **Add CNPJs**.
2. Type, paste or load from a file the CNPJs in the **CNPJs** field.
3. Check the **List capacity** meter, which adds the CNPJs read to the list's current size.
4. Click **Add**.

CNPJs already in the list do not go in twice. A list at the limit opens the dialog with the **This list is full** warning and takes no more CNPJs until you remove some.

To remove:

1. Tick the box on the left of each establishment. The box in the header ticks every row of the page.
2. In the bar that appears at the foot of the table, click **Remove**, followed by the number ticked.
3. Confirm in the dialog, which repeats the list name and the number.

Removed establishments only leave the list: they stay in the registry and can be added again at any time. **Clear selection** unticks everything, and moving to another page or filter clears the selection too.

## Use a list as a filter

In **Search CNPJ**, a list becomes a filter like any other:

1. Open the **Filters** menu and pick **List**, in the **Lists** group.
2. Choose one or more of the organization's lists.
3. Keep **Include** to search only the establishments in the lists, or switch to **Exclude** to leave them out.

The filter combines with the others. With **Include**, you search within your customer base; with **Exclude**, you prospect only those not in it yet. The filter can also be kept in a view. It is only offered to members of the organization, and a link carrying it, opened without an account, runs the search without it. How to include and exclude values is covered in [Search filters](https://cnpja.com/en-us/docs/search/filters#exclude).

## Rename and delete

Both commands sit in the actions column of the **Lists** page, at the end of each row.

To rename:

1. Click the pencil, **Rename list**.
2. Type the new name in the **Name** field, under **Current name**.
3. Click **Rename**.

To delete:

1. Click the trash can, **Delete list**.
2. Check the name and the number of establishments in the **Delete this list?** dialog.
3. Click **Delete list**.

> **Important:** deleting a list cannot be undone. Its establishments leave the list, its [exports](https://cnpja.com/en-us/docs/lists/export#previous-exports) are deleted along with their spreadsheets, and views and searches filtered by it stop working. Before deleting, check whether any of the organization's views uses the **List** filter.

## List locked during an export

While an export of the list is queued or running, the list's CNPJs cannot change, neither in the app nor through the API: the export reads the list as it was when requested. In the app, the list can't be deleted during that time either. Renaming still works, in the app and through the API. In the app, during that time:

- **Add CNPJs** shows a lock in place of the **+**;
- the rows' checkboxes do not tick;
- **Delete list** is dimmed on the **Lists** page.

When you press one of these commands, the app tells you why: **Export in progress** and **CNPJs can't be added or removed, nor the list deleted, until the export finishes.** The lock ends on its own once the export is ready, and meanwhile you can keep searching, filtering and downloading earlier spreadsheets. The progress shows on the list's own page, as [Export to a spreadsheet](https://cnpja.com/en-us/docs/lists/export#status) explains.

## Limits

A list holds a maximum number of CNPJs, and each organization a maximum number of lists. The current values are in Usage limits, under [Lists, exports and bulk](https://cnpja.com/en-us/docs/billing/limits#lists) and [Organization](https://cnpja.com/en-us/docs/billing/limits#organization).

## In the API

Lists are the same in the app and in the API: a list created here can be used by the organization's API keys as a Search CNPJ filter and changed by them, and the other way around. The operations are in [CNPJ search and lists](https://cnpja.com/en-us/docs/api/cnpj-search#lists).
