Evaluates the cohort LIVE — the same resolution an enrollment would run — and…
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
| Address | https://api.hanzo.ai/v1/marketing/audiences/{id}/preview |
| Method | GET |
| Operation | get_marketing_audiences_by_id_preview |
| Auth | Authorization: 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.
| Field | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | ID is the audience id from the path, as returned by create. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | AudiencePreview | ok |
200 body — 7 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
available | body | boolean | — | 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,… |
count | body | integer | — | Count is the cohort size: distinct warehouse identifiers for an event audience, mailable customers for an event-less (whole-org) one. |
deliverable | body | integer | — | Deliverable is how many de-duplicated mailboxes a send would reach. |
reason | body | string | — | 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… |
sample | body | string[] | — | Sample is up to 1000 cohort IDENTIFIERS — never addresses, which product analytics does not hold. |
source | body | string | — | Source names where the cohort was read: the events table for an event audience, "iam:<org>" for the whole-org one. |
unmatched | body | integer | — | 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 := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.MarketingAPI.GetMarketingAudiencesByIdPreview(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::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.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + 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"The door reaches marketing through the marketing tool, which names its 35 operations with its own verbs — this one among them, under a name only the door 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"
}
}
}'How is this guide?