# get()

Canonical URL: https://developers.iagenify.com/sdk/ref/mail/contacts/get/
Language: en

`api.mail.contacts.get(address) → Promise<Contact|null>`

One contact by address — or null when there is none. It does not throw.

Status: free · null, not 404 · by address

```javascript
const contact = await api.mail.contacts.get("fedy@example.net");

if (contact) showName(contact.name);
else showAddress("fedy@example.net");
```

## null is the normal answer {#null}

> **Most correspondents are not in an address book**
>
> Throwing for the common case would mean wrapping every lookup in a try. null is what « this person is not saved » looks like.

## The address is the key, exactly {#exact}

A correspondent writing from a second address is a second contact. Nothing is merged, and nothing guesses that two addresses are the same person.

## For a list, fetch once {#lists}

```javascript
// Not one get() per row
const byAddress = new Map((await api.mail.contacts.list()).map((c) => [c.address, c]));
```

## Messages already carry the picture {#messages}

`from.avatar` on a message is already resolved through the whole chain. This call is for an address book page, not for displaying a message.

- [save()](/sdk/ref/mail/contacts/save): Creating one.
- [messages.get()](/sdk/ref/mailbox/messages/get): Where it is used.

```python
contact = api.mail.contacts.get("fedy@example.net")

if contact:
    show_name(contact["name"])
else:
    show_address("fedy@example.net")
```

```python
# Not one get() per row
by_address = {c["address"]: c for c in api.mail.contacts.list()}
```
