Contacts
The contacts API is used for contact CRUD, search, counts, and bulk updates.
Use it when an external CRM, warehouse sync, or internal tool needs to keep people data in sync with RadarSend.
Required scopes#
contacts:readfor list, get, count, and export operationscontacts:writefor create, update, tag changes, delete, merge, and bulk actions
Contact IDs#
Contacts still use their canonical IDs in URLs.
Example:
GET /api/contacts/9c21895d-57f0-4a15-a1df-4dc6835d4f80
Create a contact#
POST /api/contacts
Example:
{
"email": "jamie@example.com",
"first_name": "Jamie",
"last_name": "Reed",
"company": "Acme",
"source": "crm-sync",
"external_id": "crm_12345",
"custom_fields": {
"plan": "enterprise",
"region": "west"
},
"subscriptions": {
"newsletter": true
}
}
full_name is the contact’s name in one piece, as they wrote it. A form’s
Full name field sets it (and fills first_name / last_name with a best-guess
split); an integration can set it directly. It is independent of the split
fields: setting one never changes the others. {{ full_name }} in an email
uses it, falling back to first and last name joined.
Typical uses:
- create a new contact from a CRM
- upsert-like create flows handled in your own integration logic
- attach custom fields and subscription data at creation time
List contacts#
GET /api/contacts
Supported query parameters:
cursorlimitstatussearchsortdirfiltersdefinition
Example:
GET /api/contacts?limit=50&status=active&search=jamie
Notes:
filtersmust be valid JSON: an array of{ field, operator, value }. The operators areeq,neq,gt,lt,gte,lte,in,contains,is_nullandis_not_null, plushas_tagon custom fields (custom.<key>). An operator or field outside that set returns400 INVALID_FILTERS— here, onGET /api/contacts/countand on exports — rather than being skipped, which used to widen the result.definitioncan be used for smart filtering based on a segment-like definition
Count contacts#
GET /api/contacts/count
Use this when you need a quick count without fetching a full page of results.
Get one contact#
GET /api/contacts/:contact_id
Upsert a contact#
PUT /api/contacts
Create-or-update a contact. By default it is matched by email: if no contact with the given email exists, one is created; if one does, it is updated with the provided fields, and an external_id in the body is stored on it. If that external_id already belongs to a different contact, nothing is written and the call fails with 409 EXTERNAL_ID_CONFLICT.
Returns 201 on create, 200 on update.
Matching on external_id#
To match on your system’s id for the person (such as a WordPress user id) instead, send external_id and on_email_change. Sending on_email_change is the opt-in: integrations written for email matching keep it. The id is then the stable key and the email an attribute of the contact it finds:
- A contact has this
external_id→ it is updated, including its email. - Otherwise, a contact has this email → if it has no
external_id, yours is attached to it. If it has a different one, nothing is written and the call fails with409 EXTERNAL_ID_CONFLICT. - Otherwise, a contact is created.
So when a customer changes their email in your system, send the new email with the same external_id. The contact keeps its id, history and lists.
When the email changes#
When step 1 changes a contact’s email:
- The old address is kept as a previous email. It is never mailed again. A note on the contact records the change, the date, and why. Events and website identification that still use the old address are credited to this contact. Deliberately adding the old address again (a form signup, an import, an API create) creates a new contact for it, as with any address.
- If another contact already has the new address and has no
external_id(a lead, or someone who signed up with that address before), it is merged into this contact: its lists, events and history move over, and it is removed. - If a contact with a different
external_idhas the new address, nothing is written and the call fails with409 EXTERNAL_ID_CONFLICT.error.details.contact_idanderror.details.external_idname that contact. Two people in your system claim one address, and RadarSend won’t merge them on its own. - Bounces and complaints stay with the old address. They describe that mailbox, not the person.
- Unsubscribes follow
on_email_change:
| Field | Values | |
|---|---|---|
on_email_change | start_fresh, keep_unsubscribes | Required to match on external_id (see above). start_fresh: the new address starts with no unsubscribes. keep_unsubscribes: an explicit unsubscribe (global, or from one email category) on the old address carries to the new one. Bounces and complaints never carry. |
email_change_reason | text, up to 200 characters | Your words for why the email changed, e.g. Account email changed in WordPress. Recorded in the contact’s note. |
If the new address was already a contact that bounced, complained or unsubscribed, the contact keeps that state in both modes. “Start fresh” clears the old address’s history, never the new one’s.
The response carries what happened:
{
"id": "6f1c…",
"email": "jamie@newmail.example",
"external_id": "wp_232",
"email_change": {
"previous_email": "jamie@oldjob.example",
"merged_contact_id": "0b9e…",
"unsubscribes": "started_fresh"
}
}
merged_contact_id is null when no contact had the new address. email_change is absent when the email did not change.
Example:
{
"email": "jamie@example.com",
"first_name": "Jamie",
"source": "signup-form",
"stage_id": "d3f1a2b0-...",
"custom_fields": {
"plan": "starter"
}
}
Stage handling#
The upsert endpoint accepts two stage fields with different merge behavior:
stage_id— always applied, whether the contact is new or existing. Use this when the caller knows the correct stage and wants to set it unconditionally.stage_id_if_new— only applied when the contact is being created, or when this call activates a pending contact that has no stage yet (one a browseridentify()created, so a signup flow gets the same stage whichever call runs first). Ignored for any other existing contact. Use this for signup or registration flows where you want a default stage without overwriting a stage that was already set by a sales team or other process.
If both are provided, stage_id takes precedence on creation.
When an upsert changes an existing contact’s stage, the same score-reset logic applies as for direct updates (e.g., prospect-to-customer resets customer score).
A stage_id (or stage_id_if_new) must name a stage this account owns.
One that does not — deleted, or belonging to another account — is refused with
400 INVALID_FIELD_VALUE, and the message names the offending id so it can be
found in whatever stores it. Both cases report the same code because from the
caller’s side they are the same fact: the stage you named is not one of yours.
This matters for anything that keeps stage ids in its own configuration (a
CMS plugin, a CRM sync). A stale id is a permanent error, not a transient
one — retrying will never fix it, so treat INVALID_FIELD_VALUE as a signal
to re-resolve the id against GET /api/settings/stages rather than to back
off. Clearing a stage with stage_id: null is still accepted.
If neither is provided, the contact gets the account’s default stage — the one flagged is_default in GET /api/settings/stages. It is applied when the contact becomes active, not when the row is created, so:
- A contact created active (the usual case for an API call) gets it immediately.
- A
pendingcontact — one created by an anonymousidentify()call or an unconfirmed double opt-in — has no stage until it is activated.stage_idisnullfor those, and that is deliberate: it has no lifecycle position until somebody has vouched for it. - Whatever activates a pending contact gives it a stage if it has none: the
stage_id(orstage_id_if_new) the call sends, otherwise the default. That includes an update by id that activates it, and an import that matches it.
Every stage change is recorded, including this one, so a contact’s stage can always be traced back to what set it.
Contacts held in a release pool#
An import in the app can hold its new contacts in a release pool and release them a few at
a time on a schedule (Release contacts a few at a time). A pooled contact
is pending: it isn’t mailed and doesn’t count toward the plan.
A create, upsert or update through the API with an API key makes a pooled contact active and
releases it from its pool, as it does for any pending contact. You don’t need to know a contact
is pooled, and there’s nothing extra to send. A customer who signs up while waiting in a pool is
released by the same call that records the signup. A pooled contact has no stage until it’s
released, so stage_id_if_new applies to it as it would to a new contact.
Until it’s released, a pooled contact doesn’t enter sequences and no automation runs for it.
Linking the visitor’s browser (session_id)#
When the call is made while serving a visitor — they just signed up, logged in, or checked out on your site — pass their tracking session and the same call also links their browser to the contact:
{
"email": "jamie@example.com",
"external_id": "wp_232",
"stage_id_if_new": "d3f1a2b0-...",
"session_id": "<the visitor's _emts cookie, unchanged>"
}
session_id is the value of the _emts cookie the tracking script sets on
your site, read from the visitor’s request by your server and passed through
exactly as received. It also works from a queued job: capture the value when
the visitor’s request arrives and send it when the job runs.
What it does:
- The pages this browser viewed before the call — the signup form, the landing page — are attributed to the contact.
- Everything the browser does after it is attributed too, with no
client-side
identify()call. - The response carries
session_link:linked, oralready_linkedif that session was this contact’s already. - If the contact was written but the link itself could not be made, the call
still succeeds and
session_linkisfailed. Repeat it withPUT(the upsert converges) to retry the link.
A visitor with no _emts cookie is ordinary — blocked cookies, a first page,
a tracking host on another domain. Send "session_id": null (or leave it out)
and the contact is written with nothing linked.
This is the recommended way to identify a visitor you know server-side. It is
one authenticated call, so the contact is created active (with
stage_id_if_new, source and the rest applied as on any create), where a
browser identify() for a new address can only create a pending one. Keep
the browser-side _qp.identify() for sites with no server of their own.
A session_id the tracking script did not issue for this account — edited,
truncated, from another site, or a bare id — is refused with
400 INVALID_SESSION_ID before anything is written, so fix the value and
retry the whole call. If a session is already linked to a different contact,
the latest call wins, as it does for identify().
Both PUT /api/contacts and POST /api/contacts accept session_id.
Identity token#
Pass ?include_identity_token=true to receive an identity_token field in the response. It is the value the tracking code keeps in the visitor’s _emt cookie. It is encrypted: treat it as opaque, and don’t parse it. The snippet has no call that accepts it, so using it means setting that first-party cookie yourself. If you have the visitor’s _emts cookie, session_id above links the session in the same call and is the simpler route.
Update a contact#
PUT /api/contacts/:contact_id
You can update any subset of the contact fields, including:
- profile fields such as name, company, and phone
stage_idexternal_iddo_not_contactcustom_fieldssubscriptions
tags sent here replaces the whole array. To change individual tags, use the
endpoint below.
Add or remove tags#
POST /api/contacts/tags
Changes one contact’s tags and nothing else. Name the contact by email or
contact_id, and send add, remove, or both:
{
"email": "ada@example.com",
"add": ["customer"],
"remove": ["trial"]
}
Returns the contact, with its tags as they now are. Tags it already had and that you did not name are left alone.
- Tags match exactly, including case.
- Adding a tag the contact has, or removing one it lacks, changes nothing, so the call is safe to repeat.
- A tag in both
addandremoveends up on the contact. - Up to 100 tags in each list, each up to 100 characters.
404 NOT_FOUNDwhen no contact matches. This endpoint never creates a contact; usePUT /api/contactsfor that, which also adds anytagsyou send to the ones already there.400 INVALID_FIELDwhen the request names no contact or no tags.
Delete a contact#
DELETE /api/contacts/:contact_id
Only use direct deletes if your integration really owns contact lifecycle. In many cases, updating status or subscription state is safer than deleting records.
Merge contacts#
POST /api/contacts/merge
Example:
{
"primary_id": "2ec8d707-7b2d-451f-b5ec-e4f041d2b844",
"secondary_ids": [
"39de8127-0e65-4e72-b344-b9017608fe35"
],
"field_selections": {
"company": "39de8127-0e65-4e72-b344-b9017608fe35"
},
"list_ids": []
}
field_selections values are contact IDs, not the words "primary" /
"secondary". The example above means “the survivor takes the secondary’s
company”. Naming the primary, or leaving a field out, keeps the primary’s own
value — so an unrecognised value is not an error, it just quietly changes
nothing.
Selectable keys are email, first_name, last_name, full_name, title, company,
phone, address_line1, address_line2, city, state, postal_code, country,
timezone, website, source, external_id, do_not_contact,
global_status, stage_id, prospect_score, customer_score, plus
subscriptions and custom.<field_key> for a single custom field. A
custom.<field_key> may also be set to the literal "merge", which unions that
field’s array values across every contact in the merge instead of picking one.
Use this carefully. The secondaries are hard-deleted — the rows are removed, not suppressed, and there is no undo. Merge is a destructive reconciliation action and is best reserved for dedupe workflows you fully control.
What carries over: everything the secondaries had (events, list memberships, sends, notes, sequence enrollments) moves to the survivor. A secondary’s id keeps working where it was already handed out: unsubscribe, preference-center, view-in-browser and tracking links in emails sent to it, and its website identity cookie, all act on the survivor. Sender and provider blocks are tied to an email address, so only the contact whose email survives keeps them. Every address that no longer belongs to a contact is kept as a previous email of the survivor.
Bulk actions#
POST /api/contacts/bulk
One call that changes many contacts, instead of one request each. If you are
hitting the rate limit with per-record writes, this and PUT /api/contacts are
the endpoints to move to.
Supported actions:
delete— soft-delete tosuppressedsuppressrestorechange_stage— needsstage_idset_dnc— needsdo_not_contactactivate_pending— make thependingcontacts in the selectionactive(eligible for sending, counted toward the plan); contacts in any other status are left alone. Needscontact_ids. Activates as many as the plan allows, oldest first: the response carriesaffected(how many changed) andquota_blocked(how many pending contacts the contact limit held back)update_field— needsfieldandvalueenroll_in_sequence— needsenroll_in_sequence_id, capped at 500 contacts per call
Most actions require an explicit contact_ids array (at most 500); an empty or
absent one returns MISSING_IDS. Two can target a filter instead:
update_field— every contact matchingfilter.filters,filter.definitionand/orfilter.search. Archived contacts are left out unless the filter itself constrainsglobal_status. Settingglobal_statuskeeps the archive state in step: settingsuppressedarchives, any other status unarchives.suppress— archives every contact matchingfilter.filters,filter.definitionand/orfilter.searchthat isn’t archived already. Each contact keeps the status it had, sorestoreputs it back.
Both take up to 100,000 contacts per call (more returns TOO_MANY; narrow the
filter and repeat). A filter with no filters, definition or search returns
400 FILTER_REQUIRED: an empty filter is never read as “every contact”.
On both, a filter with an operator or field the contact filters don’t support
(the operators are eq, neq, gt, lt, gte, lte, in, contains,
is_null, is_not_null, plus has_tag on custom fields) returns
400 INVALID_FILTERS rather than running with that condition left out.
{
"action": "suppress",
"filter": { "definition": { "conditions": [ … ] } }
}
enroll_in_sequence returns { enrolled, duplicate, skipped }, plus pooled when some of the
contacts are waiting in a release pool (they aren’t enrolled). Every other action returns
{ affected }.
reset_status is not available to API keys and returns
403 ACTION_NOT_AVAILABLE. It clears unsubscribe and do-not-contact state across
every targeted contact, which is a consent change we only accept from a signed-in
operator. Every other action works normally.
Automation triggers do not fire by default. Pass trigger_automations: true
on change_stage or a scalar update_field to emit the per-contact
attribute-changed events that attribute_changed sequence entry triggers listen
for.
update_field with field: "stage_id" requires a stage id; null is rejected
with INVALID_FIELD. There is no bulk “clear the stage” — every active contact
has one (see Stage handling). Move contacts to a different
stage instead.
A stage change made through change_stage or update_field is recorded per
contact, whatever trigger_automations is set to — the record of what moved a
contact is not an opt-in.
Exporting contacts#
For bulk read-out, use an export rather than paging GET /api/contacts. An
export runs asynchronously and produces a single CSV.
POST /api/contacts/export # start one -> 202 { export_id, status }
GET /api/contacts/export # recent exports
GET /api/contacts/export/{export_id} # status
GET /api/contacts/export/{export_id}/download # the CSV
All four require contacts:read — an export extracts data your key can already
read and changes nothing.
The body of POST /export accepts the same audience selectors as the contact
list (segment_id, status, search, filters, definition) plus:
| Field | Notes |
|---|---|
fields | Column allow-list. Omit for the default set. |
include_rollups | Engagement rollup columns. |
include_lead_score | Lead score column. |
include_archived | Include archived contacts. |
Poll the status endpoint until status is completed, then download:
EXPORT_ID=$(curl -sX POST "$BASE/api/contacts/export" \
-H "X-API-Key: $API_KEY" -H 'Content-Type: application/json' \
-d '{"include_rollups":true}' | jq -r '.export_id')
until [ "$(curl -s "$BASE/api/contacts/export/$EXPORT_ID" \
-H "X-API-Key: $API_KEY" | jq -r '.status')" = "completed" ]; do sleep 2; done
curl -s "$BASE/api/contacts/export/$EXPORT_ID/download" \
-H "X-API-Key: $API_KEY" -o contacts.csv
Notes:
- Exports expire. After the TTL the file is removed and download returns
410 EXPIRED. Fetch it promptly; re-run the export if you need it again. 409 NOT_READYmeans the job has not finished — keep polling.- When a human starts an export from the app they get a “ready” email. An API-key export has no requester, so no email is sent; poll instead.
Importing contacts#
There is no CSV import endpoint, and this is deliberate. The risky part of import is parsing and column mapping — an affordance for a human with a spreadsheet. An integration already holds structured data, so use the validated write paths instead:
PUT /api/contacts— upsert byexternal_idor email, one contactPOST /api/contacts/bulk— bulk actions over an explicit set or a filter
Both validate per contact and report per-contact errors, which a CSV upload cannot do as precisely.
Error examples#
Common contact errors include:
INVALID_EMAILDUPLICATE_EMAILUNKNOWN_FIELDINVALID_FIELD_VALUECONTACT_ERASED(409): the contact’s personal data was erased in the app. The record is kept only so report totals stay correct, so it can’t be updated, merged, or used to enroll. To add the person back, create a new contact with their email.EXTERNAL_ID_CONFLICT(409): an upsert withexternal_idfound the email on a contact that has a differentexternal_id. Nothing was written.error.details.contact_idanderror.details.external_idname that contact. Retrying gives the same answer: fix the data on one side, or merge the two contacts in the app.INVALID_SESSION_ID(400): thesession_idon a create or upsert is not a tracking session issued for this account. Nothing was written. Pass the visitor’s_emtscookie value unchanged, or leavesession_idout.
Example:
{
"error": {
"code": "INVALID_EMAIL",
"message": "Email address is invalid"
}
}
Integration guidance#
- Store RadarSend contact IDs after creation or lookup.
- Keep your own external record key in
external_idwhen possible. It lets the upsert follow a person through an email change instead of creating a second contact. - Treat every
4xxas final: retrying it returns the same answer. Retry only5xxand network errors. A5xxbody never contains database detail, only{"error":{"code":"INTERNAL"}}. - Treat bulk delete and merge as privileged actions in your integration.
- If the integration only needs reporting or audience selection, do not grant
contacts:write.
Restore an archived contact#
POST /api/contacts/{id}/restore
DELETE /api/contacts/{id} archives rather than erases, and this reverses it —
the contact returns to the status it held before archiving. Needs
contacts:write.
A contact whose personal data was erased cannot be restored; the data is gone.
Why a contact is not receiving mail#
The workspace-wide block is the suppression list, and the API reads and writes it. A contact can also be unreachable for narrower reasons — they blocked one of your From addresses, or one sending service is holding them on its own list — and those are diagnosed on the contact’s page in the app, where the remedy sits next to the finding.
Contact stages#
GET /api/settings/stages
Lifecycle stages (contacts:read). stage_id is settable on a contact, so read
this to resolve a stage’s id before assigning it. Creating and editing stages is
session-only.
Exactly one stage carries is_default: true — where a contact lands when
nothing else names a stage (see Stage handling).