Preview audiences

Evaluates the cohort LIVE — the same resolution an enrollment would run — and reports how big it is and how many real mailboxes it reaches.

GET /v1/marketing/audiences/{id}/preview

Addresshttps://api.hanzo.ai/v1/marketing/audiences/{id}/preview
MethodGET
Operationget_marketing_audiences_by_id_preview
AuthAuthorization: Bearer $HANZO_API_KEY

Evaluates the cohort LIVE — the same resolution an enrollment would run — and reports how big it is and how many real mailboxes it reaches. It is the honest answer to "is this send worth making": a cohort of 500 that mails 3 says so, in deliverable and unmatched. Nothing is sent.

Request

1 field.

FieldInTypeRequiredDescription
idpathstringyesID is the audience id from the path, as returned by create.

Response

StatusBodyMeaning
200marketing.AudiencePreviewok
defaultproblem-detailsrefused

200 body — 7 fields.

FieldInTypeAlwaysDescription
availablebodyboolean—Available is false when the roster or the warehouse could not be read; the counts are then zero because nothing was measured, not because the cohort is empty, and Reason says which read failed.
countbodyinteger (int64)—Count is the cohort size: distinct warehouse identifiers for an event audience, mailable customers for an event-less (whole-org) one.
deliverablebodyinteger (int64)—Deliverable is how many de-duplicated mailboxes a send would reach.
reasonbodystring—Reason is the error text of the read that failed: the org's roster could not be loaded ("identity store unavailable…"), or the cohort query had no warehouse to run against ("analytics warehouse not configured").
samplebodystring[]—Sample is up to 1000 cohort IDENTIFIERS — never addresses, which product analytics does not hold.
sourcebodystring—Source names where the cohort was read: the events table for an event audience, "iam:<org>" for the whole-org one.
unmatchedbodyinteger (int64)—Unmatched is how many cohort identifiers named nobody on the org's roster and so have no address to mail.

Failure carries the platform error shape — see Errors.

Examples

hanzo marketing audiences preview <id>
import { Configuration, MarketingApi } from 'hanzoai';

const api = new MarketingApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getMarketingAudiencesByIdPreview({ id: 'id' });
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).get_marketing_audiences_by_id_preview(id='id')
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.MarketingAPI.GetMarketingAudiencesByIdPreview(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::get_marketing_audiences_by_id_preview(&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).getMarketingAudiencesByIdPreview();
curl https://api.hanzo.ai/v1/marketing/audiences/<id>/preview \
  -H "Authorization: Bearer $HANZO_API_KEY"

MCP reaches marketing through the marketing tool, which names its 35 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?