Update a contact's topic preferences

Update a contact's topic preferences

PATCH/api/v1/contacts/{id}/topics

PATCH /contacts/{id}/topics
curl -X PATCH 'https://www.unitpost.com/api/v1/contacts/con_123/topics' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "topics": [
      {
        "topic_id": "top_123",
        "subscribed": false
      },
      {
        "topic_id": "top_456",
        "subscribed": true
      }
    ]
  }'
Response · 200
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "object": "contact_topic",
      "topic_id": "topic_123",
      "channel": "email",
      "subscribed": false,
      "status": "subscribed",
      "source": "user"
    }
  ]
}

Subscribe or unsubscribe a contact for several topics in one call: topics lists up to 50 preferences, each topic once. Topics you leave out keep their current preference. The contact and every topic are checked before any preference is set, so an unknown topic is a 404 naming it and nothing changes. Each preference is then recorded as Set a contact's topic preference records one (topic.subscribed / topic.unsubscribed only when it actually changes), and it's idempotent. The answer lists the resolved subscriptions in the order sent. Any key other than topics, in the body or in an item, is a 422. Requires the topics:write capability.

Parameters1 field
FieldTypeDescription
idrequiredstring · path—
Request body1 field
FieldTypeDescription
topicsrequiredobject[]The preferences to change, up to 50, each topic once. Topics left out keep theirs.
Response · 200 fields6 fields
FieldTypeDescription
objectrequiredstring—
topic_idrequiredstring—
channelrequiredenumemail | smsThe topic's channel: manage it under `/email/topics` or `/sms/topics`.
subscribedrequiredboolean—
statusrequiredenumsubscribed | unsubscribed—
sourcerequiredenumuser | manual | import | api—
200400401403404422

Search docs and guides

Search the docs and product guides.