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 organization | This endpoint |
|---|---|
OWNER | Allowed |
ADMIN | Allowed |
MEMBER | Refused — 403 |
Path parameters
| Parameter | Type | Description |
|---|---|---|
contactId | string | Required. The contact to update |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
firstName | string | null | no | Up to 100 characters, null clears it |
lastName | string | null | no | Up to 100 characters, null clears it |
phone | string | null | no | 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. |
birthDate | string | null | no | Real calendar date YYYY-MM-DD, year 0001–9999, no later than today in UTC. Returned as a date-only string. |
locale | string | null | no | 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. |
country | string | null | no | Two ASCII letters, trimmed and uppercased (for example fr → FR). Only the shape is checked, not membership in a country-code registry. |
customFields | object | no | Key → 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"}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-leveldetails. A key ofcustomFieldsthat is not a custom field of your organization, or a value that does not match its field's type, also answers400: theerrormessage 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 amemberof the organization, not anadmin.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
| 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 | Only 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.createdAt | string | ISO creation date |
data.updatedAt | string | ISO 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,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.
customFieldsalways overwrites here, unlike Add or update one contact, which keeps a filled value unlessoverwriteistrue.nullon 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,falseor their strings.date:YYYY-MM-DD(midnight UTC) or an ISO 8601 date-time with a time zone (Zor+02:00). An empty string counts asnull.