Update subscribers

Changes the fields the body names on one subscriber and answers the row.

PATCH /v1/marketing/lists/{id}/subscribers/{sid}

Addresshttps://api.hanzo.ai/v1/marketing/lists/{id}/subscribers/{sid}
MethodPATCH
Operationpatch_marketing_lists_by_id_subscribers_by_sid
AuthAuthorization: Bearer $HANZO_API_KEY

Changes the fields the body names on one subscriber and answers the row. A status change follows the same rule as add: an address that unsubscribed or complained is not put back by the org.

Org admin only.

Request

14 fields, body application/json (required).

FieldInTypeRequiredDescription
idpathstringyesID is the list, by id or slug, from the path.
sidpathintegeryesSID is the subscriber to change, from the path; ignored on add.
basisbodystring—Basis is the consent basis to record: explicit, legitimate_interest or unverified (the default).
consentAtbodyinteger (int64)—ConsentAt is when consent was given, unix seconds, when it was given before this call; on add only.
emailbodystring—Email is the address to add.
fieldsbodyobject—Fields set custom field values by key; an empty value clears one.
fields.*bodystring—
idbodystring—ID is the list, by id or slug, from the path.
languagebodystring—Language is a BCP 47 tag.
namebodystring—Name is the person's name; at most 200 characters.
refbodystring—Ref is where the subscriber came from (a form id, a page); on add only.
sidbodyinteger (int64)—SID is the subscriber to change, from the path; ignored on add.
statusbodystring—Status is subscribed (the default on add), pending, which mails the address a link to confirm, or unsubscribed, bounced or cleaned.
tagsbodystring[]—Tags replace the subscriber's tags.

Response

StatusBodyMeaning
200marketing.Subscriberok
defaultproblem-detailsrefused

200 body — 30 fields.

FieldInTypeAlwaysDescription
clicksbodyinteger (int64)—Clicks counts the clicks reported.
confirmedAtbodyinteger (int64)—ConfirmedAt is when the subscription was confirmed or, for one that needed no confirmation, began; 0 while pending.
consentbodymarketing.Consent—
consent.atbodyinteger (int64)—At is when it was given, unix seconds; for an import, the date the file carried when it carried one.
consent.basisbodystring—Basis is explicit, legitimate_interest or unverified.
consent.dntbodyboolean—DNT records that the request carried Do Not Track (DNT: 1).
consent.gpcbodyboolean—GPC records that the request carried Global Privacy Control (Sec-GPC: 1).
consent.ipbodystring—IP is the network address it was given from, when it was given here.
consent.languagebodystring—Language is the language it was asked in.
consent.methodbodystring—Method is how it was given: double_opt_in, single_opt_in, import, api, preferences or commerce.
consent.pagebodystring—Page is the form or page it was given on.
createdAtbodyinteger (int64)—CreatedAt is when the row was created, unix seconds.
emailbodystring—Email is the address, lower-cased and trimmed; one row per address per list.
fieldsbodyobject—Fields are the values of the org's custom fields, by key.
fields.*bodystring—
idbodyinteger (int64)—ID is the subscriber's id within the org.
languagebodystring—Language is the subscriber's language, a BCP 47 tag.
lastClickAtbodyinteger (int64)—LastClickAt is the last click the email plane reported.
lastOpenAtbodyinteger (int64)—LastOpenAt is the last open the email plane reported.
lastSentAtbodyinteger (int64)—LastSentAt is the last broadcast sent to them.
listbodystring—List is the list's id.
namebodystring—Name is the person's name, as given.
opensbodyinteger (int64)—Opens counts the opens reported.
personbodystring—Person is the CRM person the address is: the key the event stream, the CRM and Insights join on.
refbodystring—Ref is that place: a form id, a page, an import batch id.
sourcebodystring—Source is the kind of place the membership came from: form, page, api, import or commerce.
statusbodystring—Status is pending, subscribed, unsubscribed, bounced, complained or cleaned.
tagsbodystring[]—Tags label the subscriber; each at most 64 characters.
unsubscribedAtbodyinteger (int64)—UnsubscribedAt is when the subscriber left; 0 while they have not.
updatedAtbodyinteger (int64)—UpdatedAt is the last change, unix seconds.

Failure carries the platform error shape — see Errors.

Examples

hanzo marketing lists subscribers update <id> 1
import { Configuration, MarketingApi } from 'hanzoai';

const api = new MarketingApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.patchMarketingListsByIdSubscribersBySid({ id: 'id', sid: 'sid', basis: "<basis>", consentAt: 0 });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import MarketingApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = MarketingApi(client).patch_marketing_lists_by_id_subscribers_by_sid(id='id', sid='sid', basis="<basis>", consent_at=0)
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.MarketingAPI.PatchMarketingListsByIdSubscribersBySid(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, marketing_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = marketing_api::patch_marketing_lists_by_id_subscribers_by_sid(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.MarketingApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new MarketingApi(client).patchMarketingListsByIdSubscribersBySid();

The method above is the one at the current release of the document. [email protected] (npm) and [email protected] (PyPI) were generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →

curl -X PATCH https://api.hanzo.ai/v1/marketing/lists/<id>/subscribers/1 \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "basis": "<basis>",
       "consentAt": 0
     }'

MCP reaches marketing through the marketing tool, which names its 82 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_marketing_audiences"
         }
       }
     }'

Marketing API · All Hanzo APIs · Interactive reference

Was this page useful?
Broken link or missing step? Drop it in #docs on Discord or open a PR.