API Reference

Update Contact Topics

PATCH /contacts/:id/topics — update topic subscriptions for a contact.

PATCH/contacts/:id/topics

Update 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
idstringoptional

The Contact ID.

emailstringoptional

The Contact Email.

Body parameters
topicsarrayrequired

Array of topic subscription updates. Each item has the properties below.

topics[].idstringrequired

The Topic ID.

topics[].subscriptionstringrequired

The 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', [
  {
    "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).