Update Contact Topics
Update the topic subscription preferences for a contact. Subscriptions that match the topic's default are not stored explicitly (they are cleared), so only overrides are persisted.
PATCH
/contacts/{contact_id_or_email}/topicsRequires a full_access API key.
Path Parameters
contact_id_or_emailstringrequiredThe contact ID (UUID) or email address.
Body
The request body is an array of topic subscription objects:
idstringrequiredThe topic ID (UUID).
subscriptionstringrequiredThe subscription state: "opt_in" or "opt_out".
Response Fields
idstringThe contact ID.
curl -X PATCH 'https://api.postflare.app/contacts/e169aa45-1ecf-4183-9955-b1499d5701d3/topics' \
-H 'Authorization: Bearer re_xxxxxxxxx' \
-H 'Content-Type: application/json' \
-d '[
{
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"subscription": "opt_out"
}
]'const response = await fetch(
'https://api.postflare.app/contacts/e169aa45-1ecf-4183-9955-b1499d5701d3/topics',
{
method: 'PATCH',
headers: {
'Authorization': 'Bearer re_xxxxxxxxx',
'Content-Type': 'application/json',
},
body: JSON.stringify([
{
id: 'b2c3d4e5-f6a7-8901-bcde-f12345678901',
subscription: 'opt_out',
},
]),
}
);
const data = await response.json();Response
{
"id": "e169aa45-1ecf-4183-9955-b1499d5701d3"
}