List contacts

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.
Every contact in the response carries exactly these fields: 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 organizationThis endpoint
OWNERAllowed
ADMINAllowed
MEMBERAllowed
A key carries the role its creator holds in this organization — never a role on AgentsMail itself. See API keys.

Query parameters

ParameterTypeDescription
listIdstringList to read. Contacts are always scoped to a list. Optional with profileToken
profileTokenstringThe 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
statusstringpending, subscribed, unsubscribed, bounced, complained
tagIdstringOnly contacts carrying this tag — a tag id, not a name
searchstringMatches email, first name or last name
pagenumberDefaults to 1
limitnumberDefaults 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 a profileToken that is not a token (including the word preview that previews and tests render). details names the field.
  • 404 Not Found — list absent or outside the organization. Never with profileToken: an unknown token, or one from another organization, answers 200 with 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

FieldTypeDescription
successbooleanIndicates if the operation was successful
data[].idstringUnique identifier for the contact
data[].emailstringIts address — unique inside its list
data[].firstNamestring | nullWhat you know of the person
data[].lastNamestring | nullSame
data[].phonestring | nullInternational 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[].birthDatestring | nullReal calendar date YYYY-MM-DD, year 0001–9999, no later than today in UTC. Returned as a date-only string.
data[].localestring | nullWell-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[].countrystring | nullTwo ASCII letters, trimmed and uppercased (for example fr → FR). Only the shape is checked, not membership in a country-code registry.
data[].statusstringpending, subscribed, unsubscribed, bounced, complained
data[].listIdstringThe list it belongs to
data[].listobject{id, name} of that list
data[].tagsarray{id, name} of every tag carried
data[].customFieldsobjectCustom 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[].attributionobject{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[].createdAtstringISO creation date
data[].updatedAtstringISO date of the last change
paginationobject{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}}),
})
Call the API from your server, never from the visitor's browser: the key would be exposed. The 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, pagination is {total, page: 1, limit, totalPages} with total and totalPages at 0 or 1. The response never contains the token itself.
  • phone, birthDate, locale and country are optional. Omission preserves an existing value; null clears it. Omitted fields on a new contact are null. 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.