> ## Documentation Index
> Fetch the complete documentation index at: https://docs.privacyboost.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Contacts and Labels

> A per-wallet address book and transaction memos stored by the server. Values are encrypted in the database, and the server reads them inside the TEE.

# Contacts and Labels

Contacts and labels are bookkeeping that the server stores for an account. A
contact is an address-book entry: a privacy address, an optional Ethereum
address, a nickname, an emoji, and string metadata. A label attaches a memo, a
contact, and metadata to a transaction hash. Use them to show names in place
of addresses and to annotate history.

They involve no keys or notes. Any signed-in session can read and edit them,
including a locked one, because the sign-in message authorizes editing
contacts and labels.

## What the server stores

Each address book belongs to one wallet in one app. The same wallet signed in
to a different app has a separate book.

| Item | Limit |
| - | - |
| Contacts per book | 5,000 |
| Labels per book | 50,000 |
| Contacts per bulk create | 500 |
| Nickname | 1 to 80 characters |
| Emoji | Up to 16 characters |
| Label memo | Up to 500 characters |
| Metadata | Up to 32 entries; keys up to 64 characters, values up to 256, and 4,096 bytes as JSON |

A privacy address can appear once per book. A bulk create reports addresses
already in the book as `skipped`, with the existing contact's ID. Writing a
label replaces the whole label, so a field you leave out is cleared. Deleting
a contact unlinks it from its labels, which keep their memo and metadata.
Deleting the account's vault with `sdk.auth.deleteVault()` deletes the
wallet's contacts and labels in every app.

## What the operator can see

Contacts and labels are not end-to-end encrypted. The SDK sends them as JSON
inside the encrypted request envelope, and the server reads them in plaintext
inside the TEE, the same way it reads transaction details. See
[Trust and Security](https://docs.privacyboost.io/product/trust-and-security.md) for what the TEE protects.

In the database, every value (privacy address, Ethereum address, nickname,
emoji, memo, metadata, and a label's transaction hash and contact ID) sits in
an Always Encrypted column with randomized encryption, under a key derived
from the TEE's root key. Someone with database access sees only ciphertext.
The server finds rows by HMAC tags computed with another TEE-held key. The
tags are scoped to the wallet and app, so the same address in two users' books
produces unrelated tags.

A database reader can still see how many contacts and labels a book holds,
the timestamps on each row, and which labels in one book link to the same
contact.

Each row also carries a MAC over its values, its ID, and its owner. A row that
was altered or moved to another book fails the check, and the API returns it
with `decryptionFailed: true` and its values removed. Show such a row as
unreadable instead of dropping it.

The request envelope covers the body and the query string, not the URL path.
Writing or deleting a label puts its transaction hash in the path
(`/api/v1/labels/{txHash}`), so anything that logs request paths before the
TEE can see which transaction was labeled.

## SDK calls

```typescript theme={null}
const contact = await sdk.contacts.create({
  privacyAddress,
  nickname: 'Alice',
  emoji: '🦊',
});

const txHash = '0x…'; // an on-chain transaction hash
await sdk.labels.upsert(txHash, { contactId: contact.id, memo: 'March invoice' });

const contacts = await sdk.contacts.list(); // reads every page
```

| Platform | Contacts | Labels |
| - | - | - |
| TypeScript | `sdk.contacts`: `list`, `listPage`, `create`, `bulkCreate`, `update`, `delete` | `sdk.labels`: `list`, `listPage`, `upsert`, `delete` |
| React | `useContacts()` | `useLabels()` |
| iOS, Android, React Native | `listContacts`, `createContact`, `bulkCreateContacts`, `updateContact`, `deleteContact` | `listLabels`, `upsertLabel`, `deleteLabel` |
| CLI | `contacts list`, `create`, `update`, `delete`, `import` | `labels list`, `set`, `delete` |

`listPage`, `listContacts`, and `listLabels` return up to 100 entries and a
`nextCursor` for the next page. Contacts and labels live on the root SDK; a
`forChain()` client doesn't have them. See the
[TypeScript reference](https://docs.privacyboost.io/sdk/typescript/api-reference.md#sdk-contacts) and the
[CLI commands](https://docs.privacyboost.io/sdk/cli/guides/commands.md#contacts-commands).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.