API Reference
Update Contact Topics
PATCH /contacts/:id/topics — update topic subscriptions for a contact.
PATCH
/contacts/:id/topicsUpdate topic subscriptions for a contact. The contact is identified in the path by either its ID or its email address.
Either id or email must be provided.
Path parameters
idstringoptionalThe Contact ID.
emailstringoptionalThe Contact Email.
Body parameters
topicsarrayrequiredArray of topic subscription updates. Each item has the properties below. You can also send a bare JSON array as the body instead of wrapping it in { topics: [...] } — the example below does exactly that.
topics[].idstringrequiredThe Topic ID.
topics[].subscriptionstringrequiredThe subscription action. Must be either opt_in or opt_out.
import { Mailblastr } from 'mailblastr';
const mb = new Mailblastr('mb_xxxxxxxxx');
const { data, error } = await mb.contacts.updateTopics('e169aa45-1ecf-4183-9955-b1499d5701d3', { topics: [
{
"id": "b6d24b8e-af0b-4c3c-be0c-359bbd97381e",
"subscription": "opt_out"
}
] });
console.log({ data, error });Response
{
"id": "e169aa45-1ecf-4183-9955-b1499d5701d3"
}The id in the response is the contact id (not a topic id).