Import contacts in bulk

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 organizationThis endpoint
OWNERAllowed
ADMINAllowed
MEMBERRefused — 403

Path parameters

ParameterTypeDescription
listIdstringRequired. The destination list

Request body

FieldTypeRequiredDescription
contactsarrayyesUp to 500 entries described below
tagsstring[]noUp to 5 batch tags, added to each entry's tags; names 1–50 characters
overwritenevernoRefused with 400 for the whole batch: an import never replaces a custom field that already holds a value
Each contact entry accepts:
FieldTypeRequiredDescription
emailstringyesValid address, matched within this list
firstNamestringnoUp to 100 characters
lastNamestringnoUp to 100 characters
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.
tagsstring[]noNames 1–50 characters, added to existing tags
statusstringnopending, subscribed, unsubscribed, bounced, complained; on creation only, defaults to subscribed
optinAtstringnoSign-up date in ISO format
optinIpstringnoSign-up IP, up to 45 characters
confirmedAtstringnoConfirmation date in ISO format
confirmedIpstringnoConfirmation IP, up to 45 characters
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. Fills empty fields only (see Notes)
doubleOptInnevernoRefused: this endpoint never sends confirmation emails
overwritenevernoRefused 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 of customFields that is not a custom field of your organization, or a value that does not match its field's type: the reason names 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, or overwrite is sent on the body or on any entry (the message names it, for example contacts[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

FieldTypeDescription
successbooleanRequest succeeded
data.totalnumberEntries submitted
data.creatednumberNew contacts
data.updatednumberExisting contacts completed
data.rejectednumberRejected entries
data.errorsarray{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. Check data.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, 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.
  • 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. null in customFields is 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 with overwrite: true.
  • For a duplicate email within one batch, the first occurrence is written, its customFields included; later occurrences add no values.