Update a contact

PATCH /api/v1/contacts/{contactId} Updates the names and optional profile fields of a contact. A field you do not send is left untouched.
The status is not editable here. A status sent in the body is ignored — it never changes the subscription state. Use /unsubscribe and /resubscribe, which are explicit acts.

Authorization

Role in the organizationThis endpoint
OWNERAllowed
ADMINAllowed
MEMBERRefused — 403
A key carries the role its creator holds in this organization — never a role on AgentsMail itself. See API keys.

Path parameters

ParameterTypeDescription
contactIdstringRequired. The contact to update

Request body

FieldTypeRequiredDescription
firstNamestring | nullnoUp to 100 characters, null clears it
lastNamestring | nullnoUp to 100 characters, null clears it
phonestring | nullnoInternational 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.
birthDatestring | nullnoReal calendar date YYYY-MM-DD, year 0001–9999, no later than today in UTC. Returned as a date-only string.
localestring | nullnoWell-formed BCP 47 language tag, trimmed and canonicalized (for example fr-fr → fr-FR), up to 100 characters. Not limited to the interface languages.
countrystring | nullnoTwo ASCII letters, trimmed and uppercased (for example fr → FR). Only the shape is checked, not membership in a country-code registry.
customFieldsobjectnoKey → value, up to 50 keys. Each key must be a custom field defined in your organization settings; each value is a string, number, boolean or null, checked against the field's type. Always overwrites; null clears the field. Keys you do not send are left untouched
json
{"phone": "+33612345678", "birthDate": "2000-02-29", "locale": "fr-FR", "country": "FR"}
Changing one custom field and clearing another:
json
{"customFields": {"utm_source": "youtube", "utm_campaign": null}}

Example

bash
curl -X PATCH -H "x-api-key: $AGENTMAIL_API_KEY" -H "content-type: application/json" \
  -d '{"phone":"+33612345678","birthDate":"2000-02-29","locale":"fr-FR","country":"FR"}' \
  "https://www.agentsmail.io/api/v1/contacts/$CONTACT_ID"

Response

  • 200 OK — the updated contact.
  • 400 Bad Request — malformed JSON, non-object body or invalid field; validation failures include field-level details. A key of customFields that is not a custom field of your organization, or a value that does not match its field's type, also answers 400: the error message names every faulty key, and the expected type. Nothing is written — neither the other fields of the body nor any value.
  • 401 Unauthorized — missing or invalid key, or its owner left the organization.
  • 403 Forbidden — the key's owner is a member of the organization, not an admin.
  • 404 Not Found — no such resource, or it belongs to another organization. The API never confirms that an id exists to a caller who has no right to it.
  • 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.customFieldsobjectOnly when the call sends customFields. Every custom field value of the contact after the call, by key. Dates come back as ISO strings in UTC
data.createdAtstringISO creation date
data.updatedAtstringISO date of the last change

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"
      }
    ],
    "createdAt": "2026-08-23T10:22:05.000Z",
    "updatedAt": "2026-08-23T10:22:05.000Z"
  }
}

Notes

  • 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.
  • customFields always overwrites here, unlike Add or update one contact, which keeps a filled value unless overwrite is true. null on a field that is already empty does nothing.
  • Custom field types. text: a string, up to 1000 characters. number: a number, or a decimal string such as "12.5". boolean: true, false or their strings. date: YYYY-MM-DD (midnight UTC) or an ISO 8601 date-time with a time zone (Z or +02:00). An empty string counts as null.