Tracking Preferences: Writing
Set Preferences
Record the tracking choice of a recipient, for example the consent you collected in your own forms or CRM.
https://g.sendcorex.com/v1/privacycommand: set_preferencesNeeds the privacy:write scope on your API key.
Send only what changed: a field you leave out keeps its current value. Sending the same values again changes nothing and changed comes back false.
Changes made here are recorded with source: "api" in the history. They do not trigger the tracking_preferences_updated webhook, so a CRM sync never loops.
Arguments
emailstringrequiredThe recipient address.
e.g.
"jane.doe@example.com"track_opensbooleanoptionaltrueallows open tracking,falserefuses it.e.g.
truetrack_clicksbooleanoptionaltrueallows click tracking,falserefuses it.e.g.
true
Quick start
import axios from 'axios';
const response = await axios.post(
'https://g.sendcorex.com/v1/privacy',
{
commands: [
{
command: "set_preferences",
args: {
email: "jane.doe@example.com",
track_opens: true,
track_clicks: true
}
}
]
},
{ headers: { Authorization: process.env.SENDCOREX_API_KEY } },
);
const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);Response
{
"type": "SUCCESS",
"results": [
{
"command": "set_preferences",
"id": "0",
"type": "SUCCESS",
"took_ms": 6,
"data": {
"changed": true,
"preference": {
"email": "jane.doe@example.com",
"track_opens": true,
"track_clicks": true,
"source": "api",
"updated_at": "2026-10-24T08:02:19.744Z"
}
}
}
]
}Response fields
changedfalsewhen the recipient already had these values (nothing was written).preferenceThe state after the call.
preference.emailThe recipient address, in lowercase.
preference.track_openstruethe recipient allows open tracking,falsethey refused it,nullthey never chose.preference.track_clickstruethe recipient allows click tracking,falsethey refused it,nullthey never chose.preference.sourceWho made the change:
page(the recipient, on the tracking preferences page),api(you, with Set Preferences) ordashboard.preference.updated_atWhen the change was made. ISO 8601, UTC.
How it affects your sends
Refusal always winsWhen
track_opensortrack_clicksisfalse, that tracking is left out of the email even if your send asks for it with"track_opens": true.Never choseWhen the value is
null(or the recipient has no preference at all), your send decides, exactly as before.Needs our unsubscribe enginePreferences are applied to sends with
"unsubscribe": true. That is also what puts the preferences link in the email.Your defaultFor opt-in rules (for example France), send
"track_opens": falseand"track_clicks": falseuntil the recipient allowed it, and read the preference with Get Many before sending.
Errors
HTTP-level errors return type, code and message. Errors marked CMD come back inside the command result, with HTTP 200.
- 401
INVALID_API_KEYThe API key does not exist, was revoked or was disabled in the dashboard.
- 429
RATE_LIMITEDMore than 15 requests/s or 15 in flight for the same IP + API key. Wait the number of seconds in Retry-After.
- CMD
MISSING_SCOPEThe API key does not have the scope of this command (`privacy:read` to read, `privacy:write` to change).
- CMD
INVALID_ARGSAn argument is invalid: missing or malformed `email`, more than 100 `emails`, `track_opens` that is not `true`/`false`, limit out of range…
- CMD
INTERNALServer error. The detail is only written to the server log.