Create bulk

Applies one action to a selection of a list and answers how many rows it matched and changed.

POST /v1/marketing/lists/{id}/subscribers/bulk

Addresshttps://api.hanzo.ai/v1/marketing/lists/{id}/subscribers/bulk
MethodPOST
Operationpost_marketing_lists_by_id_subscribers_bulk
AuthAuthorization: Bearer $HANZO_API_KEY

Applies one action to a selection of a list and answers how many rows it matched and changed. The selection is ids, a saved segment, a filter, or the whole list. It walks the selection in batches of a thousand, one transaction each, so millions of rows move in bounded memory: tag and untag add or remove a tag; move moves the rows to another list of the org; unsubscribe and clean set those statuses on every row that is pending or subscribed, each telling the CRM and the event stream; delete removes the rows and their evidence.

Org admin only.

Request

23 fields, body application/json (required).

FieldInTypeRequiredDescription
idpathstringyesID is the list, by id or slug, from the path.
actionbodystring—Action is tag, untag, move, unsubscribe, clean or delete.
filterbodymarketing.Filter—
filter.basisbodystring—Basis keeps subscribers by the consent basis recorded for them: explicit, legitimate_interest or unverified.
filter.clickedAfterbodyinteger (int64)—ClickedAfter keeps subscribers who clicked a link at or after this time.
filter.confirmedAfterbodyinteger (int64)—ConfirmedAfter and ConfirmedBefore bound when the subscription was confirmed, unix seconds, inclusive.
filter.confirmedBeforebodyinteger (int64)—ConfirmedBefore is the upper bound of ConfirmedAfter's range.
filter.createdAfterbodyinteger (int64)—CreatedAfter and CreatedBefore bound when the subscriber joined the list, unix seconds, inclusive.
filter.createdBeforebodyinteger (int64)—CreatedBefore is the upper bound of CreatedAfter's range.
filter.fieldbodystring—Field names a custom field, and Value keeps subscribers whose value for it is exactly this.
filter.notOpenedSincebodyinteger (int64)—NotOpenedSince keeps subscribers who have opened nothing since this time, including those who never opened anything.
filter.openedAfterbodyinteger (int64)—OpenedAfter keeps subscribers who opened a broadcast at or after this time.
filter.qbodystring—Q keeps subscribers whose address or name begins with it, case-insensitively.
filter.refbodystring—Ref keeps subscribers from one source instance: a form id, a page, an import batch id.
filter.sourcebodystring—Source keeps subscribers that came from this kind of source: form, page, api, import or commerce.
filter.statusbodystring—Status is one status or several, comma-separated: pending, subscribed, unsubscribed, bounced, complained, cleaned.
filter.tagbodystring—Tag keeps subscribers carrying this tag.
filter.valuebodystring—Value is the custom field's value Field keeps.
idbodystring—ID is the list, by id or slug, from the path.
idsbodyinteger (int64)[]—IDs selects subscribers by id.
segmentbodystring—Segment selects a saved segment of the list.
tagbodystring—Tag is the tag tag and untag add or remove.
tobodystring—To is the list move moves the selection to, by id or slug.

Response

StatusBodyMeaning
200marketing.BulkOutok
defaultproblem-detailsrefused

200 body — 2 fields.

FieldInTypeAlwaysDescription
changedbodyinteger (int64)—Changed is how many of them the action changed.
matchedbodyinteger (int64)—Matched is how many subscribers the selection held.

Failure carries the platform error shape — see Errors.

Examples

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

const api = new MarketingApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postMarketingListsByIdSubscribersBulk({ id: 'id', action: "<action>", filter: {"basis":"<basis>","clickedAfter":0,"confirmedAfter":0,"confirmedBefore":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).post_marketing_lists_by_id_subscribers_bulk(id='id', action="<action>", filter={"basis":"<basis>","clickedAfter":0,"confirmedAfter":0,"confirmedBefore":0})
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.MarketingAPI.PostMarketingListsByIdSubscribersBulk(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::post_marketing_lists_by_id_subscribers_bulk(&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).postMarketingListsByIdSubscribersBulk();

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 POST https://api.hanzo.ai/v1/marketing/lists/<id>/subscribers/bulk \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "action": "<action>",
       "filter": {
         "basis": "<basis>",
         "clickedAfter": 0,
         "confirmedAfter": 0,
         "confirmedBefore": 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.