# Pix Key

The Pix keys are saved in the DICT (Diretório de Identificadores de Contas Transacionais), the centralized Pix service managed by Bacen (Brazilian Central Bank) that allows you to search for transactional accounts with convenient addressing keys.

The types of keys currently available are CPF, CNPJ, phone number, e-mail and EVP (random UUID). In this section, we will teach you how to manage DICT keys.

**Note:** Whenever a Workspace is created, an EVP (random) DICT key is created and associated with it. This is done in order to ensure the safety of the Invoice service, since it requires an active DICT Key to work.

### The Pix Key object

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `id` | STRING | Unique id for the Pix key (CPF, CNPJ, phone, email or EVP). |
| `accountNumber` | STRING | Account number. |
| `accountType` | STRING | Account type. Options: "checking", "savings", "salary", "payment". |
| `bankName` | STRING | Bank name. |
| `branchCode` | STRING | Account branch code. |
| `ispb` | STRING | Bank ISPB code. |
| `name` | STRING | Account owner full name. |
| `ownerType` | STRING | Account owner type (return-only). Options: "individual", "business". |
| `status` | STRING | Current key status. |
| `taxId` | STRING | Account owner CPF or CNPJ. |
| `type` | STRING | Key type. Options: "cpf", "cnpj", "phone", "email", "evp". |

### List your DICT Keys

`GET /v2/dict-key`

Get a list of the DICT Keys you own (or have owned) in chunks of at most 100. If you need smaller chunks, use the limit parameter.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `after` | OPTIONAL | Filter entities created after this date. |
| `before` | OPTIONAL | Filter entities created before this date. |
| `cursor` | OPTIONAL | String used to get the next batch of results. Our SDKs handle this for you. |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |
| `ids` | OPTIONAL | List of strings to get specific entities by ids. |
| `limit` | OPTIONAL | Number of results per cursor. Max = 100. |
| `status` | OPTIONAL | Filter dicts by the specified status. |
| `type` | OPTIONAL | DICT Key type. Options are: "cpf", "cnpj", "phone", "email" or "evp". |

**Request**

```python
import starkbank

dict_keys = starkbank.dictkey.query(
    status="registered",
    limit= 1,
    type= "evp"
)

for dict_key in dict_keys:
    print(dict_key)
```

**Response**

```python
DictKey(
    account_number=*ZW5jcnlwdGVkLWFjY291bnQtbnVtYmVy,
    account_type=checking,
    branch_code=*ZW5jcnlwdGVkLWJyYW5jaC1jb2Rl,
    id=1aa1aaaa-a11a-1111-a111-1a1aa111aaaa,
    ispb=67372284,
    name=Jon Snow,
    owner_type=naturalPerson,
    status=registered,
    tax_id=***.456.789-**,
    type=evp
)
```

### Get a DICT Key

`GET /v2/dict-key/:id`

Get a single DICT key by its id. This method includes keys you do not own. You can use it to retrieve a key's information before creating Transfers.

**Note:** Try to avoid looking up DICT keys without sending transfers afterwards, since Bacen's system will block users making too many standalone requests in a short timespan. Invalid key searches also count towards this block.

**Note:** The encrypted parameters can be used to create a transfer without the need to decrypt.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `id` | REQUIRED | Id of the dict key. Examples: "jon.snow@starkbank.com", "012.345.678-90" |

**Request**

```python
import starkbank

dictkey = starkbank.dictkey.get("jon.snow@starkbank.com")

print(dictkey)
```

**Response**

```python
DictKey(
    account_number=*ZW5jcnlwdGVkLWFjY291bnQtbnVtYmVy,
    account_type=checking,
    branch_code=*ZW5jcnlwdGVkLWJyYW5jaC1jb2Rl,
    id=jon.snow@starkbank.com,
    ispb=67372284,
    name=Jon Snow,
    owner_type=naturalPerson,
    status=registered,
    tax_id=***.456.789-**,
    type=email
)
```

## Available Languages

Code samples on this page are in Python. The same content is available with samples in:

- [Python](https://docs.starkbank.com/api/v2/dict-key-python.md)
- [Node.js](https://docs.starkbank.com/api/v2/dict-key-node.md)
- [PHP](https://docs.starkbank.com/api/v2/dict-key-php.md)
- [Java](https://docs.starkbank.com/api/v2/dict-key-java.md)
- [Ruby](https://docs.starkbank.com/api/v2/dict-key-ruby.md)
- [Elixir](https://docs.starkbank.com/api/v2/dict-key-elixir.md)
- [.NET](https://docs.starkbank.com/api/v2/dict-key-dotnet.md)
- [Go](https://docs.starkbank.com/api/v2/dict-key-go.md)
- [Clojure](https://docs.starkbank.com/api/v2/dict-key-clojure.md)
- [cURL](https://docs.starkbank.com/api/v2/dict-key-curl.md)
