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

# Contacts

> The people of your workspace, one per email across all campaigns.

A contact is a person in your workspace. There is one contact per email address, however many
campaigns the person is in, and their profile (name, company, custom fields) is the same in all of
them. Every lead carries the `contactId` of its person, so you can sync people to your CRM once and
see which campaigns each of them is in. A lead added just before Contacts reached your workspace
can have `contactId: null` for a few minutes, until it is linked to its person.

## Scopes

| Action | Scope |
| - | - |
| List / get contacts | `contacts:read` |
| Upsert / update / delete | `contacts:write` |

## Upsert contacts

Create or update 1-1,000 people in one call, matched by email (case-insensitive). Nobody is added
to a campaign: use [Add leads](https://developer.mailbeast.ai/leads.md#add-leads) for that.

```bash theme={null}
curl -X POST https://api.mailbeast.ai/v1/contacts \
  -H "Authorization: Bearer $MAILBEAST_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 7c9e6679-7425-40de-944b-e07fc1f90ae7" \
  -d '{
    "mode": "fill_empty",
    "contacts": [
      { "email": "anna@northwind.io", "firstName": "Anna", "companyName": "Northwind",
        "tags": ["vip"], "customFields": { "industry": "SaaS" } },
      { "email": "sam@globex.com", "website": "not a url" }
    ]
  }'
```

```json Response theme={null}
{
  "summary": { "submitted": 2, "created": 1, "updated": 0, "unchanged": 0, "skipped": 0,
               "invalid": 1, "duplicates": 0, "overStorageLimit": 0 },
  "results": [
    { "email": "anna@northwind.io", "contactId": "019a7c3e-5b21-7d40-9e1f-2a3b4c5d6e7f", "outcome": "created" }
  ],
  "invalidRows": [ { "index": 1, "reason": "website must be a URL address" } ]
}
```

`mode` decides what happens to a person who already exists:

| Mode | Existing person |
| - | - |
| `fill_empty` (default) | Only their empty fields are filled. Tags you send are added to theirs. |
| `overwrite` | Fields are replaced with the values you send. Tags you send are added to theirs. |
| `skip` | Left as they are (`outcome: skipped`). |

A missing or empty value never erases a field, in any mode, and an upsert never removes a tag: the
tags you send are added to the ones the person has (new ones at the end). To clear a field or
remove a tag, use [Update a contact](#update-a-contact): its `tags` replace the person's tags.

Each contact is checked on its own: one that fails validation (a malformed email, a field that is
too long, more than 50 tags, an unknown field) is listed in `invalidRows` with its index and the
reason, and the rest are saved. A contact's tags are the tags of its leads, with the same rules: up
to 50 tags of up to 64 characters each in a request. Since an upsert adds tags to the ones the person
has, a person can end up with more than 50. An email repeated in the same request is one person (`summary.duplicates`).
`results` lists every valid email once, in request order, with its `contactId` and `outcome`.

Contact storage is unlimited under fair use. If the workspace stores more contacts than fair use
covers, new people are not saved (`outcome: over_storage_limit`, `contactId: null`) while existing
ones are still updated. If nobody in the request can be saved (every valid email is a new person
and none of them fit), the request fails with `402 plan_limit_exceeded`. Use the chat in the
MailBeast dashboard to request more.

> [!NOTE]
>
> A request takes up to 1,000 people and its body is limited to 1 MB. A bigger body fails with `413 request_too_large`, before anything is saved: split the people into smaller requests (1,000 people with full profiles and custom fields can exceed 1 MB).

## List and filter

Cursor-paginated, newest first.

```bash theme={null}
curl "https://api.mailbeast.ai/v1/contacts?limit=50&domain=northwind.io" \
  -H "Authorization: Bearer $MAILBEAST_API_KEY"
```

```json Response theme={null}
{
  "data": [
    {
      "id": "019a7c3e-5b21-7d40-9e1f-2a3b4c5d6e7f",
      "email": "anna@northwind.io",
      "firstName": "Anna",
      "companyName": "Northwind",
      "tags": ["vip"],
      "customFields": { "industry": "SaaS" },
      "status": "email_sent",
      "doNotContact": false,
      "inSequence": true,
      "campaigns": [
        { "campaignId": "…", "campaignName": "Q4 outreach", "leadId": "…",
          "leadStatus": "email_sent", "inSequence": true }
      ],
      "version": 2,
      "…": "…"
    }
  ],
  "meta": { "hasMore": false, "nextCursor": null }
}
```

Filter by `search` (email, name or company), `status`, `campaignId` or `domain`. `limit` defaults
to 50 (max 100). Keep requesting with `?cursor=meta.nextCursor` until `meta.hasMore` is `false`.

| Field | Meaning |
| - | - |
| `status` | `blacklisted` while the address or its domain is on the workspace blocklist; otherwise the furthest status of the person across their campaigns (a reply outranks a sent email). `null` if they are in no campaign, or if every campaign row of theirs was blocked and the block was lifted later. |
| `doNotContact` | Unsubscribed, blocked or bounced. An unsubscribe or a bounce stops the campaign where it happened, a block (the workspace blocklist) stops every campaign; adding the person to a campaign from Contacts skips them. |
| `inSequence` | Some campaign still has emails to send this person. |
| `campaigns` | The campaigns the person is in, with their lead in each (`/v1/campaigns/{campaignId}/leads/{leadId}`). |
| `version` | Pass it back when you update the contact. |

## Get one contact

```bash theme={null}
curl https://api.mailbeast.ai/v1/contacts/{id} \
  -H "Authorization: Bearer $MAILBEAST_API_KEY"
```

## Update a contact

The change shows in every campaign the person is in, including in emails not yet sent. The
fields you send are written as given (`null` or an empty string clears one); the rest stay. The
email cannot change. `customFields` works by key the same way: a key you send is set, `null` or
an empty string clears that key, and the keys you leave out stay (`"customFields": null` clears
them all). A value of an image or URL field must be an absolute `http://` or `https://` URL.

```bash theme={null}
curl -X PATCH https://api.mailbeast.ai/v1/contacts/{id} \
  -H "Authorization: Bearer $MAILBEAST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "version": 2, "jobTitle": "Head of Sales", "location": null }'
```

Pass the `version` you read. If the contact changed since, the request fails with
`409 contact_version_conflict`: read it again and retry.

## Delete a contact

Deletes the person everywhere: they leave every campaign (planned emails are canceled) and the
workspace. An unsubscribe or a block on the address stays.

```bash theme={null}
curl -X DELETE https://api.mailbeast.ai/v1/contacts/{id} \
  -H "Authorization: Bearer $MAILBEAST_API_KEY"
```

While an email to the person is being sent, the request fails with `409 contact_sending_now` and a
`Retry-After` header: retry in a few seconds. If one of their campaigns was busy (being paused or
resumed) or the person was added to a campaign at the same moment, it fails with
`409 contact_delete_conflict`. The person may already have left some of their campaigns: retry and
the delete finishes.

## Webhooks

Webhook events about a lead carry `lead.contactId` next to `lead.id`, so the same person reaches
you with the same id from every campaign. While a lead is not linked to its person yet (the first
minutes after Contacts reached your workspace), the event has no `lead.contactId`.


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