Contacts API

Contacts API

Create and update contacts from any system (a backend, a data warehouse, a partner integration) through one generic endpoint, single or batch. Field names are matched intelligently, unknown fields become custom properties, and consent is protected by design: syncing data can never resubscribe someone who opted out.

Updated

On this page12 sections

Which endpoint do I want?

  • POST /api/v1/contacts (this guide): syncing contact data: bulk upserts, enrichment, migrations. Never triggers automations.
  • POST /api/leads/intake: a signup event: one person just opted in, welcome automations should fire.

1. Create an API key

  1. Go to Settings → API keys and create a key. The narrow Contact intake only scope is enough for this endpoint; the optional crm block below needs a Full access key.
  2. Authenticate every call with Authorization: Bearer sc_live_… (or X-API-Key).

2. One contact

curl -X POST https://www.sendcore.me/api/v1/contacts \
  -H "Authorization: Bearer sc_live_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "anna@example.com",
    "first_name": "Anna",
    "phone": "+39 333 1234567",
    "birthday": "1990-07-15",
    "tags": ["VIP", "Fiera Milano"],
    "consent": "subscribed",
    "consent_attestation": true,
    "consent_source": "landing_signup",
    "piano_scelto": "premium"
  }'

Response. One row per contact, always telling the whole truth:

JSON
{
  "ok": true,
  "contact": {
    "email": "anna@example.com",
    "created": true,              // created vs updated
    "consent_state": "SUBSCRIBED",
    "consent_preserved": false,   // true = your "subscribed" did not apply
    "first_subscription": true,   // transitioned into SUBSCRIBED
    "suppressed": false           // true = on the unsubscribe list: accepted, but won't be mailed
  }
}

3. Batch

Send up to 500 contacts per request as { "contacts": [ … ] }. Rows that fail validation are reported by index in invalid without failing the rest; duplicate emails within one batch collapse to the last occurrence.

curl -X POST https://www.sendcore.me/api/v1/contacts \
  -H "Authorization: Bearer sc_live_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"consent_attestation": true, "contacts": [
    {"email": "anna@example.com",  "first_name": "Anna"},
    {"email": "marco@example.com", "first_name": "Marco", "consent": "subscribed"}
  ]}'

Response:

JSON
{
  "ok": true,
  "results": [ { "email": "…", "created": true, … } ],
  "invalid": [ { "index": 3, "error": "invalid_email" } ],
  "stats": { "received": 120, "created": 80, "updated": 39, "invalid": 1, "suppressed": 2, "consent_preserved": 0, "unreadable_birthdays": 0, "subscribed_without_attestation": 0, "held": 0 }
}

Field names

Keys go through the same matching engine as the CSV importer: email_address, firstName, phone_number, Date of birth, a single full_name (split into first/last) and Italian names like telefono or cognome all land on the right field. address, city, state, postal_code and country (and their aliases: indirizzo, zip, cap…) are stored as the canonical address properties, the ones segments filter on and the export names. Any other scalar key is kept as a custom property (at most 15 per contact); non-scalar values are refused and listed in ignored_keys rather than guessed at. Explicit custom_properties win over auto-detected keys.

birthday is read like the birthday column of an import: 1990-07-15, or day first, 15/07/1990 (also with - or .), or an Excel date number. 05/03/1990 is 5 March; only a second number above 12 makes it month first. A birthday without the year, with a two-digit year or that does not exist is not saved (a birthday already stored stays) and is counted in stats.unreadable_birthdays. See How the birthday is read.

  • Omit consent when syncing data. The presence of an email in your system is not marketing consent. A row without consent never changes an existing contact's state; a new contact lands as UNKNOWN.
  • "consent": "subscribed" is an assertion that this person actually opted in (form, checkbox, verbal consent you recorded). It applies only together with "consent_attestation": true (see Consent attestation). Send it only then: it updates existing contacts too.
  • Mirroring another system? A full export or a nightly sync carries the consent you recorded back then, not what the person chose since. Add "consent_policy": "preserve" at the top level of the request (next to contacts, or beside the fields of a single contact): subscribed then applies to new contacts only, an existing contact keeps the choice made in Sendcore, and every other field still updates. Rows where that protection applied come back with consent_preserved: true. The default, "assert", is the behaviour above.
  • "consent": "unsubscribed" always applies: downgrading is the safe direction. Accepted dialects: yes/no, true/false, subscribed/unsubscribed/non-subscribed, opted in/opted out…
  • Importing like a file? Send existing_contacts instead of consent_policy to get the import screen's rules: see Contacts you already have.
  • People who clicked unsubscribe are on the suppression list, and this API never removes them from it, whatever you send. Their rows come back with suppressed: true and are never marked SUBSCRIBED: data accepted, no marketing email will go out.

A nightly mirror of your own database, then, looks like this. New people land subscribed, everyone else keeps their choice, and every address, phone and property still updates:

JSON
{
  "consent_policy": "preserve",
  "consent_attestation": true,
  "contacts": [
    { "email": "anna@example.com",  "first_name": "Anna",  "city": "Firenze", "consent": "subscribed" },
    { "email": "marco@example.com", "first_name": "Marco", "city": "Prato",   "consent": "subscribed" }
  ]
}

Contacts you already have, and empty fields

Two optional top-level fields (next to contacts, or beside the fields of a single contact) make the same choices as Finalize import on the import screen. Leave them out and the request works exactly as described above.

  • existing_contacts: what to do with a contact already in your account. update_all writes its fields and its subscription status; update_properties writes its fields only; update_status writes its subscription status only; skip leaves it untouched (its row comes back with skipped: true). New contacts are created the same way whatever you send.
  • With existing_contacts the import's consent rule applies, not consent_policy (sending both answers 400 with existing_contacts_with_consent_policy): subscribed needs consent_attestation: true and subscribes an existing contact only if they have no status yet, never one who is not subscribed, unsubscribed, bounced or complained.
  • overwrite_empty_fields: true makes a field you send as null or "" erase the stored value (first and last name, phone, birthday, a custom property) on an existing contact, with update_all or update_properties. A field you do not send is never touched, and tags and consent are never erased. Default false.
  • Any other value answers 400 (invalid_existing_contacts, invalid_overwrite_empty_fields). A response to a request that sent either field echoes both, and its stats add skipped and subscribed_existing.
JSON
{
  "existing_contacts": "update_properties",
  "overwrite_empty_fields": true,
  "contacts": [
    { "email": "anna@example.com", "first_name": "Anna", "phone": "" }
  ]
}

A contact is saved as SUBSCRIBED only when the request carries "consent_attestation": true at the top level (next to contacts, or beside the fields of a single contact). It is your statement that the people you send as subscribed agreed to receive your marketing emails. Sendcore records it on the import, with the API key that sent it and when.

  • Only the JSON value true counts. "true", 1 or a missing field do not.
  • Without it, the contacts are still saved, every field included, but subscribed is not applied: a new contact lands as UNKNOWN (not subscribed), an existing one keeps its state. Each such row comes back with consent_needs_attestation: true, stats.subscribed_without_attestation counts them, and warnings says it in words. This is deliberate: an integration that sent subscribed before this rule existed keeps working, but no longer subscribes anyone until it adds the attestation.
  • Optional consent_source at the top level says where the consent was given, in your words (up to 60 characters, for example "Newsletter form 2025"). It is stored as each subscribed contact's consent source. A consent_source on a single row wins for that row.
  • unsubscribed never needs the attestation: it always applies.

Large imports

The API counts as an import, like a file in Audience → Imports, and no import is held, however many new contacts your requests add: every row is applied as the request says, under the consent rules above. See Large imports.

  • stats.held is always 0. It stays in the response so an integration that reads it keeps working. No row carries held: true and no response carries hold any more.
  • Until 21 November 2026 the new contacts past a daily limit were held, not subscribed. For an import held then that still waits, GET /api/v1/contacts/import-holds lists it (normally the list is empty), with run_id, limit and limit_reason (band or young_account). POST /api/v1/contacts/import-holds with { "run_id": "…", "choice": "…" } makes the same choices as the box: keep_up_to_limit or request_review (with an optional note). It needs a Full access key.
  • check_upgrade is retired with the limit: it changes nothing and answers 409 with hold_retired. A run_id that is not a held import answers 404. Both answers say that imports are no longer held.

Sendcore logs every request as part of an import: the API's requests of one day (UTC) share one import record, with its counts and the attestation. The response's run_id names it.

POST /api/v1/contacts/consent is the Convert to subscribed and Unsubscribe actions of Audience → Contacts as one call: the same change, with the same answers, that an AI agent makes with set_contact_consent. Use it when a person told you directly that they want your emails again, or that they want to stop. To sync contact data, use POST /api/v1/contacts above: it never resubscribes anyone.

It needs a Full access key created by a member who can edit contacts. A Read-only or Contact intake only key is refused with key_scope_insufficient (403), and so is a key whose creator has since become an Analyst, who cannot edit contacts. It only ever acts on the contacts of the workspace the key belongs to.

  • action: "subscribe" or "unsubscribe".
  • Exactly one of: emails (a list of addresses, up to 1,000 per request), segment_id (every member of one of your segments) or "all": true (your whole audience).
  • "plan": true (or ?plan=true on the URL) previews: the answer says what would change, with planned: true, changes and preview (the same fields as below), and nothing is changed. Send the same request without it to apply.
Shell
curl -X POST https://www.sendcore.me/api/v1/contacts/consent \
  -H "Authorization: Bearer sc_live_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{ "action": "subscribe", "emails": ["anna@example.com"], "plan": true }'

What a subscribe does, and what the answer says:

  • It is your statement that these people gave you permission: send it only then. They become subscribed and an unsubscribe is lifted (unsuppressed counts those). count is how many contacts changed.
  • A spam complaint, a hard bounce or a manual block is never lifted. Those contacts are skipped and stay blocked: skipped counts them, skipped_by_reason splits them into complaint, hard_bounce and manual, and skipped_sample lists up to 20 of them with their reason. When every address you named is blocked, refused is true and nothing changes.
  • Contacts already subscribed are left as they are: already_subscribed counts them and already_subscribed_by_source says through what, sendcore (subscribed in Sendcore) or shopify (subscribed in your Shopify store, which Sendcore counts as subscribed). There is nothing to convert: do not retry them.
  • Addresses that are not contacts of your workspace are never touched: not_found counts them. When none of the addresses you named is a contact, the request is refused with contacts_not_found (404).

An unsubscribe always applies, as the button does: the contacts stop receiving marketing email and count is how many were subscribed before. Every answer also carries action, a summary in words and warnings.

JSON
{
  "ok": true,
  "action": "subscribe",
  "count": 1,
  "unsuppressed": 1,
  "skipped": 1,
  "skipped_by_reason": { "hard_bounce": 1 },
  "skipped_sample": [ { "email": "old@example.com", "reason": "hard_bounce" } ],
  "refused": false,
  "already_subscribed": 1,
  "already_subscribed_by_source": { "shopify": 1 },
  "not_found": 0,
  "summary": "Marked 1 contact as subscribed. …"
}
  • Repeating a request is safe: the second time nothing changes, a subscribe answers with already_subscribed and an unsubscribe with count: 0.
  • Refusals: invalid_json, invalid_fields (with field_errors), selection_required (not exactly one of emails, segment_id, all), too_many_emails and action_required (400); selection_invalid (the segment is not one of yours) and contacts_not_found (404); read_failed and write_failed (500, safe to retry).

CRM handoff (optional)

Add a crm block to any row to also create or update a CRM card, idempotently: same (source, external_id) → same card, forever (external_id defaults to the contact's email). Needs a Full access key and a plan with the CRM; if either is missing the contact is still saved and the row's crm result carries the error.

JSON
{
  "email": "anna@example.com",
  "consent": "subscribed",
  "consent_attestation": true,
  "crm": {
    "pipeline_id": "…",          // required: see /api/v1/crm/pipelines
    "stage_id": "…",             // optional: moves the card when it changes
    "external_id": "LEAD-12345", // optional: defaults to the email
    "source": "my_backend",      // optional label, default contacts_api
    "title": "Anna: premium",   // optional
    "amount": 1200               // optional
  }
}

Idempotency, limits, errors

  • Repeating a request converges to the same state: safe to retry on any failure.
  • On 429 or a 5xx, retry with exponential backoff (2s, 4s, 8s), as the PHP example does. Other 4xx are validation refusals: fix the payload or the key instead of retrying.
  • Rate limits: 240 requests/min per IP, 300/min per account (HTTP 429, rate_limit_exceeded).
  • Errors are stable tokens with the usual statuses: missing_api_key / invalid_api_key (401), key_scope_insufficient (403), invalid_json / invalid_email / batch_too_large (400).

Next steps

Can't find the answer?

Write to us: hello@sendcore.me