Menu

Create or update contacts in a batch

POST/v1/contacts/batch

Requires an API key with the contacts:write scope. About keys and scopes

Identify for up to 100 contacts in one request, each resolved and written exactly as POST /v1/contacts/identify would, in order. One contact refused does not stop the rest: its entry carries the error a single identify would have answered. Counts against the rate limit as one request per contact; for a larger sync, send several batches. Agent keys are refused with 403.

Request body

contactsCreateContactInput[]required

at least 1 item · at most 100 items

12 child attributes
externalIdstring | nulloptional

Your own id for the contact, up to 255 characters. Identify matches on it first.

1–255 characters

emailstring | nulloptional

email

firstNamestring | nulloptional

1–100 characters

lastNamestring | nulloptional

1–100 characters

phonestring | nulloptional

Phone number; normalised to E.164 (a leading + and country code).

timezonestring | nulloptional

IANA timezone, e.g. Europe/London; used for send-time scheduling.

up to 100 characters

countrystring | nulloptional

ISO 3166-1 alpha-2 code. Omitted, it is inferred from the phone, else the timezone.

datesContactDatesInputoptional

Named calendar dates, merged key by key; null removes one.

attributesobjectoptional

Custom attributes, merged key by key; null removes one. At most 50 keys and 16 KB.

emailConsentbooleanoptional

Consent to email. Omitted, the current value is kept.

pushConsentbooleanoptional

Consent to push. Omitted, the current value is kept.

consentStatementConsentStatementInputoptional

How the contact agreed, recorded with any consent this request grants.

2 child attributes
basisstringrequired

The legal basis the contacts agreed under.

one of opted_in, existing_customer

evidencestringrequired

Where and how they agreed, e.g. "Checkout opt-in on shop.example.com".

1–500 characters

Returns

Returns 200 OK with a IdentifyContactsBatchResult in data. Otherwise returns an error; Errors lists every code and which to retry.

resultsobject[]required
One of 2 shapes
Contact written
2 child attributes
createdbooleanrequired

Whether a new contact was created.

contactContactDetailrequired
15 child attributes
idstringrequired

uuid

externalIdstring | nullrequired

Your own id for the contact, if set.

emailstring | nullrequired

email

firstNamestring | nullrequired
lastNamestring | nullrequired
phonestring | nullrequired

Phone number in E.164 format.

timezonestring | nullrequired

IANA timezone, e.g. Europe/London.

countrystring | nullrequired

ISO 3166-1 alpha-2 code: as written, or inferred from the phone, else the timezone.

datesobjectrequired

Named calendar dates, e.g. birthday, as YYYY-MM-DD or --MM-DD.

attributesobjectrequired

Custom attributes, keyed by attribute name.

emailConsentbooleanrequired

Whether the contact has consented to email.

pushConsentbooleanrequired

Whether the contact has consented to push.

createdAtstringrequired

date-time

updatedAtstringrequired

date-time

emailSuppressionobjectrequired
2 child attributes
suppressedbooleanrequired

Whether email to this contact is blocked.

reasonstring | nullrequired

Why email to this contact is suppressed: bounced, complained, complained_transactional, unsubscribed, manual, imported, or other_workspace (a bounce or complaint in another workspace with the same owner or partner).

Contact refused
1 child attribute
errorobjectrequired
4 child attributes
codestringrequired

one of BAD_REQUEST, ALREADY_EXISTS, CONFLICT, IN_USE, FORBIDDEN, INTERNAL_ERROR, NOT_FOUND, RATE_LIMITED, REVISION_CONFLICT, SERVICE_UNAVAILABLE, UNAUTHORIZED, VALIDATION_ERROR, API_KEY_IP_NOT_ALLOWED, AGENT_CONFIRMATION_REQUIRED, EMBED_ORIGIN_NOT_ALLOWED, WORKSPACE_SUSPENDED, WORKSPACE_DELETION_PENDING, CONTACT_SEND_IN_PROGRESS, EXPORT_UNAVAILABLE, NOTHING_TO_EXPORT, EVENT_NAME_LIMIT_REACHED, PLAN_LIMIT_REACHED, PLAN_FEATURE_UNAVAILABLE, CAMPAIGN_AUDIENCE_CONFLICT, EMPTY_AUDIENCE, INVALID_CAMPAIGN_CONTENT, DRAFT_INCOMPLETE, INVALID_SCHEDULE, UNSUPPORTED_CHANNEL, POSTAL_ADDRESS_MISSING, CONSENT_MISSING, SUPPRESSED, SIGNUP_BLOCKED, INVALID_SENDER_ADDRESS, SENDING_DOMAIN_DMARC_MISSING, SENDING_DOMAIN_IDENTITY_CONFLICT, SENDING_DOMAIN_UNVERIFIED, IDEMPOTENCY_KEY_REUSED, CONTENT_NOT_RETAINED, RECIPIENT_EMAIL_MISSING, TEMPLATE_NOT_PUBLISHED, TEMPLATE_ENVELOPE_INCOMPLETE, PUSH_APP_NOT_READY, PUSH_DESTINATION_MISSING

messagestringrequired
detailsobjectoptional
requestIdstringoptional