List segments
Returns one list's saved segments, newest first.
GET /v1/marketing/lists/{id}/segments
| Address | https://api.hanzo.ai/v1/marketing/lists/{id}/segments |
| Method | GET |
| Operation | get_marketing_lists_by_id_segments |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Returns one list's saved segments, newest first.
Request
1 field.
| Field | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | ID is the list's id or its slug. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | marketing.SegmentPage | ok |
default | problem-details | refused |
200 body — 23 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
data | body | marketing.Segment[] | — | Data is every segment of the list, newest first. |
data[].count | body | integer (int64) | — | Count is how many subscribers it selects now; filled on read of one. |
data[].createdAt | body | integer (int64) | — | CreatedAt is when it was saved, unix seconds. |
data[].filter | body | marketing.Filter | — | |
data[].filter.basis | body | string | — | Basis keeps subscribers by the consent basis recorded for them: explicit, legitimate_interest or unverified. |
data[].filter.clickedAfter | body | integer (int64) | — | ClickedAfter keeps subscribers who clicked a link at or after this time. |
data[].filter.confirmedAfter | body | integer (int64) | — | ConfirmedAfter and ConfirmedBefore bound when the subscription was confirmed, unix seconds, inclusive. |
data[].filter.confirmedBefore | body | integer (int64) | — | ConfirmedBefore is the upper bound of ConfirmedAfter's range. |
data[].filter.createdAfter | body | integer (int64) | — | CreatedAfter and CreatedBefore bound when the subscriber joined the list, unix seconds, inclusive. |
data[].filter.createdBefore | body | integer (int64) | — | CreatedBefore is the upper bound of CreatedAfter's range. |
data[].filter.field | body | string | — | Field names a custom field, and Value keeps subscribers whose value for it is exactly this. |
data[].filter.notOpenedSince | body | integer (int64) | — | NotOpenedSince keeps subscribers who have opened nothing since this time, including those who never opened anything. |
data[].filter.openedAfter | body | integer (int64) | — | OpenedAfter keeps subscribers who opened a broadcast at or after this time. |
data[].filter.q | body | string | — | Q keeps subscribers whose address or name begins with it, case-insensitively. |
data[].filter.ref | body | string | — | Ref keeps subscribers from one source instance: a form id, a page, an import batch id. |
data[].filter.source | body | string | — | Source keeps subscribers that came from this kind of source: form, page, api, import or commerce. |
data[].filter.status | body | string | — | Status is one status or several, comma-separated: pending, subscribed, unsubscribed, bounced, complained, cleaned. |
data[].filter.tag | body | string | — | Tag keeps subscribers carrying this tag. |
data[].filter.value | body | string | — | Value is the custom field's value Field keeps. |
data[].id | body | string | — | ID is the segment's id ("seg_" and 96 random bits in hex). |
data[].list | body | string | — | List is the list it selects from. |
data[].name | body | string | — | Name is what the segment is called; at most 200 characters. |
data[].updatedAt | body | integer (int64) | — | UpdatedAt is the last change, unix seconds. |
Failure carries the platform error shape — see Errors.
Examples
CLI
SDK
HTTP
MCP
hanzo marketing lists segments list <id>.ts
.py
.go
.rs
.java
import { Configuration, MarketingApi } from 'hanzoai';
const api = new MarketingApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getMarketingListsByIdSegments({ 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_lists_by_id_segments(id='id')cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)
resp, _, err := client.MarketingAPI.GetMarketingListsByIdSegments(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_lists_by_id_segments(&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).getMarketingListsByIdSegments();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 https://api.hanzo.ai/v1/marketing/lists/<id>/segments \
-H "Authorization: Bearer $HANZO_API_KEY"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"
}
}
}'Was this page useful?
Broken link or missing step? Drop it in #docs on Discord or open a PR.