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

# Contacts

> Read, export and delete the contacts of your workspace from your server with a secret key.

Read, export and erase the people of your workspace from your server. Every route is on `https://api.maqetin.com`, takes `Authorization: Bearer mq_sec_…` and acts in the key's own workspace.

| Route | What it does | Scope |
| - | - | - |
| `GET /v1/public/contacts` | Lists contacts. | `contacts:read` |
| `GET /v1/public/contacts/{contactId}` | Reads one contact and its newest events. | `contacts:read` |
| `GET /v1/public/contacts/{contactId}/messages` | Lists the messages sent to the contact. | `contacts:read` |
| `GET /v1/public/contacts/{contactId}/messages/{messageId}` | Reads one message and its events. | `contacts:read` |
| `GET /v1/public/contacts/{contactId}/export` | Returns everything stored about the person, a page at a time. | `contacts:read` |
| `DELETE /v1/public/contacts/{contactId}` | Erases the person. | `contacts:delete` |

A public key is a `401`, and a key without the scope is a `403`. A secret key made with no scopes has `contacts:read` only.

## Two ids

`userId` is your own key for the person, the one you send with identify. `id` is the platform id Maqetin makes, and the routes that read one contact take it as `contactId`. To find it, list with `userId` and read `id` from `data.items`.

## Limits

| What | Limit |
| - | - |
| Rate | 600 requests a minute per key |
| `total` of a list | Exact up to 10,000 |
| Events in a contact | The 20 newest |
| Devices in a contact | At most 20 |
| Export page | Up to 1,000 items |

## List contacts

`GET /v1/public/contacts` lists the contacts of the workspace, the most recently updated first.

**search** `string`

A prefix of the email address or of the `userId`, 1 to 254 characters.

**userId** `string`

Your own key for the person, matched exactly, 1 to 256 characters.

**limit** `number` (default: 50)

The page size, a whole number from 1. At most 100.

**cursor** `string`

The `nextCursor` of the page before.

**data.items** `object[]` *required*

**a contact**

**id** `string` *required*

The platform id.

**userId** `string` *required*

Your own key for the person.

**email** `string | null` *required*

The email address, or `null`.

**traits** `object` *required*

The traits you sent with identify.

**createdAt** `string` *required*

When the contact was made.

**updatedAt** `string` *required*

When the contact last changed.

**data.nextCursor** `string | null` *required*

The cursor of the next page, or `null` on the last page.

**data.total** `number | null` *required*

On the first page, the number of contacts in the workspace, whatever the filter. On a page read with a `cursor`, `null`.

**data.totalCapped** `boolean` *required*

`true` when the workspace has more than 10,000 contacts, so `total` is 10,000.

```bash theme={null}
curl 'https://api.maqetin.com/v1/public/contacts?userId=user_123' \
  -H 'Authorization: Bearer mq_sec_…'
```

```json theme={null}
{
  "success": true,
  "data": {
    "items": [
      {
        "id": "Vh3kP9qLm2XzT7rB4nWcA",
        "userId": "user_123",
        "email": "ada@example.com",
        "traits": { "firstName": "Ada", "lastName": "Lovelace", "plan": "pro" },
        "createdAt": "2026-11-02T10:15:00.000Z",
        "updatedAt": "2026-12-01T08:40:12.000Z"
      }
    ],
    "nextCursor": null,
    "total": 1840,
    "totalCapped": false
  },
  "meta": { "requestId": "4f8Kq2LmZ7xR1tN9pW3sY", "timestamp": "2026-12-03T09:30:00.000Z" }
}
```

## Get a contact

`GET /v1/public/contacts/{contactId}` reads one contact with its 20 newest events, including those of the person's earlier anonymous visits. The reply has the fields of a listed contact, and these:

**contactId** `string` *required*

The platform id, `id` in a list.

**data.emailOptIn** `boolean` *required*

Whether journey email may reach the person.

**data.suppressed** `object | null` *required*

The suppression of the person's address in your workspace, or `null`. It has a `reason`, one of `hard_bounce`, `complaint`, `unsubscribe` or `manual`, and the time it began, `at`. No message reaches a suppressed address.

**data.lastSeenAt** `string | null` *required*

The time of the person's newest event, or `null` when there is none. An identify alone is not an event.

**data.devices** `object[]` *required*

At most 20 devices, each with `platform` (`ios`, `android`, `web` or `null`) and `lastSeenAt`.

**data.timezone** `string | null` *required*

The time zone you sent as the `timezone` trait, or `null`.

**data.activity** `object[]` *required*

The newest events, each with `eventId`, `event`, `timestamp`, `userId`, `anonymousId` and `properties`.

## List the messages of a contact

`GET /v1/public/contacts/{contactId}/messages` lists the messages sent to the contact, the newest first.

**contactId** `string` *required*

The platform id.

**limit** `number` (default: 25)

The page size, a whole number from 1. At most 100.

**cursor** `string`

The `nextCursor` of the page before.

**data.items** `object[]` *required*

**a message**

**id** `string` *required*

The message id, the `messageId` a send answered with.

**templateId** `string` *required*

The template it was made from.

**templateName** `string | null` *required*

The name of the template, or `null` once the template is deleted.

**subject** `string | null` *required*

The subject it was sent with, or `null` when it was not sent.

**source** `object | null` *required*

What sent it: `type` is `journey` (with `journeyId` and `stepId`), `api` for a send through this API, or `test` for a test send. `null` for any other send.

**status** `string` *required*

The furthest delivery event it reached: `sent`, `deferred`, `delivered`, `bounced`, `complained` or `failed`.

**counts** `object` *required*

The number of `sent`, `delivered`, `opened` and `clicked` events. Opens and clicks that look like a mail scanner are left out, and an event recorded twice counts once.

**bounceReasonClass** `string | null` *required*

For a bounce: `hard`, `soft`, `policy` or `egress`.

**failedReason** `string | null` *required*

Why a send was refused.

**createdAt** `string` *required*

When the message was made.

**data.nextCursor** `string | null` *required*

The cursor of the next page, or `null` on the last page.

## Get one message

`GET /v1/public/contacts/{contactId}/messages/{messageId}` reads one message of the contact with every event of it, the oldest first. A message of another contact answers `404`. The reply has the fields of a listed message, and `data.events`.

**contactId** `string` *required*

The platform id.

**messageId** `string` *required*

The message's `id` in the list.

**data.events** `object[]` *required*

Each event once, with `eventId`, `type` (`sent`, `deferred`, `delivered`, `opened`, `clicked`, `bounced`, `complained`, `unsubscribed` or `failed`), `timestamp`, `likelyBot` and `reasonClass` (`hard`, `soft`, `policy`, `egress` or `null`). An open or a click by a mail scanner is here, flagged `likelyBot`, though the counts leave it out.

## Export a contact

`GET /v1/public/contacts/{contactId}/export` returns everything stored about the person, `profile`, `events` and `messages`, a page at a time. Use it to answer a person who asks for their data.

**contactId** `string` *required*

The platform id.

**eventsCursor** `string`

The `events.nextCursor` of the reply before.

**messagesCursor** `string`

The `messages.nextCursor` of the reply before.

The first call has no cursor and starts both sections. A section is complete when its `nextCursor` is `null`. Send `eventsCursor` and `messagesCursor` only for the sections that are not complete: a section you send no cursor for comes back empty.

**data.profile** `object` *required*

In every reply: `id`, `userId`, `email`, `anonymousIds`, `emailOptIn`, `traits`, `devices`, `lastSeenAt`, `createdAt` and `updatedAt`.

**data.events** `object` *required*

`items` and `nextCursor`. Each event has `eventId`, `event`, `timestamp`, `receivedAt`, `userId`, `anonymousId`, `channel`, `properties` and `context`.

**data.messages** `object` *required*

`items` and `nextCursor`. Each item is one event of a message sent to the person, with its `messageId`, `eventType`, `timestamp`, `templateId` and `likelyBot`. A click or an open by a security scanner is here, flagged `likelyBot`.

## Delete a contact

`DELETE /v1/public/contacts/{contactId}` erases the person: their profile, their events, the events of their messages and their place in every journey. It needs the `contacts:delete` scope.

**contactId** `string` *required*

The platform id.

**data.deleted** `boolean` *required*

`true`. A repeat answers `404`.

> [!WARNING]
>
> A delete cannot be undone. The suppression list keeps its entries: an address that was suppressed stays suppressed. A delete that fails part way leaves the contact in place; send the same request again to finish it.

## Errors

| Status | `error.code` | Meaning |
| - | - | - |
| `400` | `VALIDATION_FAILED` | A query parameter is unknown or does not parse, or a cursor is not one of this contact's. |
| `401` | `API_KEY_INVALID` | The request has no active secret key. |
| `403` | `FORBIDDEN` | The key has no scope for the route. |
| `404` | `NOT_FOUND` | The contact or the message is not in your workspace, exactly as for an id that exists nowhere. |
| `429` | `RATE_LIMITED` | Over 600 requests a minute for the key. Wait for `Retry-After`. |

[Errors](https://docs.maqetin.com/api-reference/errors.md) lists the rest.


## Related topics

- [Contacts](https://docs.maqetin.com/data/contacts.md)
- [Journeys](https://docs.maqetin.com/messaging/journeys.md)
- [Analytics](https://docs.maqetin.com/messaging/analytics.md)
- [Errors](https://docs.maqetin.com/api-reference/errors.md)
- [Profiles](https://docs.maqetin.com/data/profiles.md)


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