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}/topics

Requires a full_access API key.

Path Parameters

contact_id_or_emailstringrequired

The contact ID (UUID) or email address.

Body

The request body is an array of topic subscription objects:

idstringrequired

The topic ID (UUID).

subscriptionstringrequired

The subscription state: "opt_in" or "opt_out".

Response Fields

idstring

The 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

Response
{
  "id": "e169aa45-1ecf-4183-9955-b1499d5701d3"
}