Contacts and custom fields
PUT/api/v1/contacts
Keep your list in step with Sendcub, keyed on your own id, with typed custom fields and consent recorded as proof.
- Updated
- 23 November 2026
- Scopes
contacts
Routes on this page
8 routes
- GET
/api/v1/contactscontacts - GET
/api/v1/contacts/{id}contacts - PUT
/api/v1/contactscontacts - POST
/api/v1/contacts/batchcontacts - DELETE
/api/v1/contacts/{id}contacts - GET
/api/v1/fieldscontacts - POST
/api/v1/fieldscontacts - PUT
/api/v1/fields/{key}contacts
This is the route most integrations spend their time in. You send people, Sendcub stores them, and your own id stays the key.
Upsert one contact
PUT /api/v1/contacts creates the contact or updates the one that matches. Matching is on externalId first, then on the address. A new contact answers 201, one that already existed answers 200, and either way changed names the fields the call actually moved.
Request
curl -X PUT https://api.sendcub.com/api/v1/contacts \
-H "Authorization: Bearer sk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"externalId": "cust_8891",
"email": "[email protected]",
"firstName": "Ada",
"lastName": "Lovelace",
"language": "en",
"country": "MZ",
"tags": ["customer", "plan:growth"],
"fields": { "lifetime_value": 1840.50, "last_order_at": "2026-11-20" }
}'const res = await fetch("https://api.sendcub.com/api/v1/contacts", {
method: "PUT",
headers: {
Authorization: "Bearer sk_live_your_key_here",
"Content-Type": "application/json",
},
body: JSON.stringify({
externalId: "cust_8891",
email: "[email protected]",
firstName: "Ada",
lastName: "Lovelace",
language: "en",
country: "MZ",
tags: ["customer", "plan:growth"],
fields: { lifetime_value: 1840.5, last_order_at: "2026-11-20" },
}),
});Response
{
"index": 0,
"id": "4b8d2f70-6c31-4f0a-9d55-7e2b1c9a4f83",
"created": true,
"changed": [
"email",
"externalId",
"firstName",
"lastName",
"language",
"country",
"fields.last_order_at",
"fields.lifetime_value",
"tags"
]
}Because externalId is yours, you never have to store a Sendcub id or keep a mapping table. Send the same externalId again and you update the same person. One contact's body is at most 16 KB.
What the request names replaces what is stored, and what it leaves out stays as it was. A blank name, phone, language or country clears it; a blank field value removes that key.
Consent, which is the part people get wrong
Creating a contact does not subscribe it to marketing. A contact written with no consent can receive transactional mail only. To record real consent, send it with its proof:
{
"externalId": "cust_8891",
"email": "[email protected]",
"consent": {
"status": "subscribed",
"source": "checkout_opt_in",
"text": "Email me about new courses and offers",
"at": "2026-11-20T14:02:11Z"
}
}The text is the wording the person actually agreed to. Sendcub keeps it as an append-only record, so when somebody asks why they are receiving your mail, the answer exists.
Two refusals that are deliberate and will not be relaxed:
- An unsubscribe is not reversible through the API. If somebody opted out, writing
"status": "subscribed"does not put them back, and the saved row comes back with aconsent_lockedwarning so your code knows the consent was ignored. Only they can do that. - A suppressed address warns on every write with
email_suppressed. Hard bounces and complaints land here. The contact is still stored, and it still will not be mailed: spending your reputation on an address that already failed is the thing being prevented.
Many at once
POST /api/v1/contacts/batch takes up to 1,000 rows in a body of at most 1 MB.
Request
curl -X POST https://api.sendcub.com/api/v1/contacts/batch \
-H "Authorization: Bearer sk_live_your_key_here" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: nightly-sync-2026-11-22" \
-d '{ "contacts": [ { "externalId": "cust_1", "email": "[email protected]" }, { "externalId": "cust_2", "email": "[email protected]" } ] }'Response
{
"results": [
{
"index": 0,
"id": "7c1e4a90-21bd-4e52-8a6f-0d9c3b7e1a45",
"created": true,
"changed": ["email", "externalId"]
},
{
"index": 1,
"error": { "code": "validation_failed", "field": "email" }
}
],
"created": 1,
"updated": 0,
"failed": 1
}One bad row never fails the others. Every row answers for itself, in the order you sent it and with the index you sent it at, so you can log or re-queue exactly the rows that failed instead of replaying the whole batch. The three tallies at the end are there so a nightly job can log one line and move on.
A batch of more than 1,000 rows is refused whole, with batch_too_large. Send the Idempotency-Key on a nightly job and a retry after a timeout costs nothing.
Reading and removing
| Route | What it does |
|---|---|
GET /api/v1/contacts | One contact, found by ?externalId= or ?email=, exactly one of the two |
GET /api/v1/contacts/{id} | One contact with its fields, tags, status and consent record |
DELETE /api/v1/contacts/{id} | Erases the person, which is the GDPR answer, not a soft hide |
DELETE is a real erasure: every module's rows go, the proof is masked, and it answers 202 with { "id": ..., "erased": true }. The suppression record outlives it on purpose: if an address bounced or complained, that stays known even after the contact is gone, so a later import cannot resurrect a bad address.
Custom fields
Define a field once, then send values with any contact. Fields are typed, so a date stays a date and you can segment on it.
| Route | What it does |
|---|---|
GET /api/v1/fields | Every field with its key, label, type and choices |
POST /api/v1/fields | Define a field |
PUT /api/v1/fields/{key} | Rename it or change its choices. The type never changes |
curl -X POST https://api.sendcub.com/api/v1/fields \
-H "Authorization: Bearer sk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "key": "lifetime_value", "label": "Lifetime value", "type": "number" }'Types are text, number, date, boolean and choice. Send a value the type refuses and the call is refused naming that field, rather than storing something you cannot segment on later. A workspace holds up to 50 fields, and a key that already exists answers 409 field_exists with the definition it already has, so a plugin may safely call this on every start.
Put your own meaning in a field, not in a tag you have to parse. If your application knows who is a lapsed subscriber, send that as a field or an event. Sendcub cannot work out what "lapsed" means in your business, and a segment built on your own field is exact.
