POST /api/v1/lists/{listId}/contacts/bulk
Import up to 500 contacts, matched by email within the list. Existing contacts keep their status. No email, confirmation or automation is sent by an import.
Authorization
| Role in the organization | This endpoint |
|---|---|
OWNER | Allowed |
ADMIN | Allowed |
MEMBER | Refused — 403 |
Path parameters
| Parameter | Type | Description |
|---|---|---|
listId | string | Required. The destination list |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
contacts | array | yes | Up to 500 entries described below |
tags | string[] | no | Up to 5 batch tags, added to each entry's tags; names 1–50 characters |
overwrite | never | no | Refused with 400 for the whole batch: an import never replaces a custom field that already holds a value |
| Field | Type | Required | Description |
|---|---|---|---|
email | string | yes | Valid address, matched within this list |
firstName | string | no | Up to 100 characters |
lastName | string | no | Up to 100 characters |
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. |
tags | string[] | no | Names 1–50 characters, added to existing tags |
status | string | no | pending, subscribed, unsubscribed, bounced, complained; on creation only, defaults to subscribed |
optinAt | string | no | Sign-up date in ISO format |
optinIp | string | no | Sign-up IP, up to 45 characters |
confirmedAt | string | no | Confirmation date in ISO format |
confirmedIp | string | no | Confirmation IP, up to 45 characters |
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. Fills empty fields only (see Notes) |
doubleOptIn | never | no | Refused: this endpoint never sends confirmation emails |
overwrite | never | no | Refused with 400 for the whole batch, like at the body level |
json
{
"contacts": [
{"email": "ada@example.com", "phone": "+33612345678", "birthDate": "2000-02-29", "locale": "fr-FR", "country": "FR"},
{"email": "lin@example.com", "customFields": {"utm_source": "meta", "signup_at": "2026-11-15"}}
],
"tags": ["import-march"]
}Example
bash
curl -X POST -H "x-api-key: $AGENTMAIL_API_KEY" -H "Content-Type: application/json" \
-d '{"contacts":[{"email":"ada@example.com","phone":"+33612345678"}]}' \
"https://www.agentsmail.io/api/v1/lists/$LIST_ID/contacts/bulk"Response
200 OK— batch report, including rejected entries. An invalid profile field rejects that entry, not the entire batch. So does a key ofcustomFieldsthat is not a custom field of your organization, or a value that does not match its field's type: thereasonnames every faulty key and the expected type, and the other entries are written.400 Bad Request— invalid request envelope or list id, the contact plan limit would be exceeded, oroverwriteis sent on the body or on any entry (the message names it, for examplecontacts[1].overwrite). Nothing is written.401 Unauthorized— missing or invalid key.403 Forbidden— the key owner cannot manage this organization's contacts.404 Not Found— list absent or outside the organization.413 Payload Too Large— more than 500 entries; no truncation.429 Too Many Requests— request rate limit exceeded.
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean | Request succeeded |
data.total | number | Entries submitted |
data.created | number | New contacts |
data.updated | number | Existing contacts completed |
data.rejected | number | Rejected entries |
data.errors | array | {index, email, reason} for each rejected entry; index starts at zero |
Example response
json
{"success": true, "data": {"total": 1, "created": 1, "updated": 0, "rejected": 0, "errors": []}}Agent recipe
Send chunks of at most 500. Checkdata.rejected; correct and replay only data.errors.map(error => batch[error.index]). A 200 does not mean every entry was accepted. Read saved profiles with List contacts.
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.
- Consent proof fields are supplemented when supplied; they do not support null clearing.
- Duplicate emails within one batch count as updates after the first occurrence; send each email once to avoid conflicting values.
- Existing subscription status is preserved even if another status is supplied.
- A batch never replaces a custom field value. An empty field is filled; a field that already holds a value keeps it, and the report does not list it.
nullincustomFieldsis accepted and writes nothing — unlike the profile fields above, it does not clear the field. To correct a value, use Update a contact or Add or update one contact withoverwrite: true. - For a duplicate email within one batch, the first occurrence is written, its
customFieldsincluded; later occurrences add no values.