GET /api/v1/contacts
Contacts of one list, paginated.
listId is required: a read is always scoped to one list, there is no organization-wide contact
listing. A request without it answers 400. Get your list ids from GET /api/v1/lists — see
Discovery.
The one exception is profileToken: it finds the contact carrying a
profile token, in any list of your organization. The
answer is the same page shape, with zero or one contact. listId becomes optional; passed with it, it
must be the contact's list, or the page is empty.
tagId takes the id of a tag, not its name: call GET /api/v1/tags first and pick the id of
the tag whose name you are after.
The organization is never a parameter. It comes from the key. An
organizationId passed in the
query is ignored — you can only ever read your own audience. A listId belonging to another
organization answers 404, not an empty page.id, email, firstName, lastName,
phone, birthDate, locale, country, status, listId, list, tags, customFields, attribution and its createdAt / updatedAt dates. Nothing else — in
particular, the unsubscribe token of a contact is never exposed by this API.
Authorization
| Role in the organization | This endpoint |
|---|---|
OWNER | Allowed |
ADMIN | Allowed |
MEMBER | Allowed |
Query parameters
| Parameter | Type | Description |
|---|---|---|
listId | string | List to read. Contacts are always scoped to a list. Optional with profileToken |
profileToken | string | The value {{profileToken}} rendered in an email. Returns the contact carrying it, or an empty page. status, tagId, search and page are not applied with it |
status | string | pending, subscribed, unsubscribed, bounced, complained |
tagId | string | Only contacts carrying this tag — a tag id, not a name |
search | string | Matches email, first name or last name |
page | number | Defaults to 1 |
limit | number | Defaults to 20, capped at 100 |
Example
bash
curl -H "x-api-key: $AGENTMAIL_API_KEY" \
"https://www.agentsmail.io/api/v1/contacts?listId=$LIST_ID&status=subscribed&limit=50"Response
200 OK— the call succeeded.400 Bad Request— missing or invalid list or query parameters, or aprofileTokenthat is not a token (including the wordpreviewthat previews and tests render).detailsnames the field.404 Not Found— list absent or outside the organization. Never withprofileToken: an unknown token, or one from another organization, answers200with an empty page.401 Unauthorized— missing or invalid key, or its owner left the organization.429 Too Many Requests— over 120 requests in a minute for this key.
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates if the operation was successful |
data[].id | string | Unique identifier for the contact |
data[].email | string | Its address — unique inside its list |
data[].firstName | string | null | What you know of the person |
data[].lastName | string | null | Same |
data[].phone | string | null | International number: leading +, then 8–15 digits, first digit nonzero. Spaces, parentheses, periods and hyphens are removed. Local numbers, 00 prefixes and extensions are rejected; reachability is not checked. |
data[].birthDate | string | null | Real calendar date YYYY-MM-DD, year 0001–9999, no later than today in UTC. Returned as a date-only string. |
data[].locale | string | null | Well-formed BCP 47 language tag, trimmed and canonicalized (for example fr-fr → fr-FR), up to 100 characters. Not limited to the interface languages. |
data[].country | string | null | Two ASCII letters, trimmed and uppercased (for example fr → FR). Only the shape is checked, not membership in a country-code registry. |
data[].status | string | pending, subscribed, unsubscribed, bounced, complained |
data[].listId | string | The list it belongs to |
data[].list | object | {id, name} of that list |
data[].tags | array | {id, name} of every tag carried |
data[].customFields | object | Custom field values of the contact, by key: text, number, boolean, or a date as an ISO string in UTC. {} when the contact has no value. Only custom fields defined in your organization settings appear |
data[].attribution | object | {firstTouch}: the contact's entry point with the earliest capturedAt, or null when it has none. Always present. The last touch and the history are on Get a contact |
data[].createdAt | string | ISO creation date |
data[].updatedAt | string | ISO date of the last change |
pagination | object | {total, page, limit, totalPages} |
Example response
json
{
"success": true,
"data": [
{
"id": "4d19c0a2",
"email": "ada@example.com",
"firstName": "Ada",
"lastName": "Lovelace",
"phone": null,
"birthDate": null,
"locale": null,
"country": null,
"status": "subscribed",
"listId": "0b7c51e8",
"list": {
"id": "0b7c51e8",
"name": "Newsletter"
},
"tags": [
{
"id": "7c2ef4b1",
"name": "vip"
}
],
"customFields": {
"utm_source": "meta",
"signup_at": "2026-11-15T00:00:00.000Z"
},
"attribution": {
"firstTouch": {
"event": "api",
"channel": "meta",
"utmSource": "meta",
"utmMedium": "paid",
"utmCampaign": "webi-nov-test1",
"utmContent": null,
"utmTerm": null,
"fbclid": null,
"gclid": null,
"referrer": null,
"landingUrl": null,
"extra": {},
"capturedAt": "2026-11-01T09:00:00.000Z"
}
},
"createdAt": "2026-08-23T10:22:05.000Z",
"updatedAt": "2026-08-23T10:22:05.000Z"
}
],
"pagination": {
"total": 1,
"page": 1,
"limit": 20,
"totalPages": 1
}
}Agent recipe
A link in an email carries{{profileToken}} to your landing page. The page turns it into a contact,
then updates that contact:
js
const token = new URL(location.href).searchParams.get('t')
const headers = {'x-api-key': process.env.AGENTMAIL_API_KEY}
const api = 'https://www.agentsmail.io/api/v1'
const found = await fetch(`${api}/contacts?profileToken=${token}`, {headers})
if (found.status === 400) return showGenericPage() // not a token, or `preview`
const {data} = await found.json()
if (data.length === 0) return showGenericPage() // unknown token
await fetch(`${api}/contacts/${data[0].id}`, {
method: 'PATCH',
headers: {...headers, 'content-type': 'application/json'},
body: JSON.stringify({customFields: {nps_score: 9}}),
})PATCH needs a key created by an OWNER or ADMIN, and nps_score stands for a custom field
defined in your organization settings.
Notes
-
With
profileToken,paginationis{total, page: 1, limit, totalPages}withtotalandtotalPagesat0or1. The response never contains the token itself. -
phone,birthDate,localeandcountryare optional. Omission preserves an existing value;nullclears it. Omitted fields on a new contact arenull. Empty strings are rejected. - A phone number does not grant permission to send SMS or WhatsApp messages. These profile fields do not change subscription status or consent.