Returns the caller org's ad campaigns, most recently updated first, optionally…
Returns the caller org's ad campaigns, most recently updated first, optionally narrowed to one lifecycle status.
GET /v1/ad/campaigns
| Address | https://api.hanzo.ai/v1/ad/campaigns |
| Method | GET |
| Operation | get_ad_campaigns |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Returns the caller org's ad campaigns, most recently updated first, optionally narrowed to one lifecycle status. The listing is bounded by the org: another tenant's campaigns are not reachable from here at all.
Request
2 fields.
| Field | In | Type | Required | Description |
|---|---|---|---|---|
status | query | string | — | Status filters to one lifecycle state (draft, active, paused, completed). |
limit | query | integer | — | Limit caps how many campaigns come back: default 200, maximum 1000. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | campaignList | ok |
200 body — 12 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
data | body | AdCampaign[] | — | Data is the matching campaigns, newest-updated first. |
data[].account | body | string | — | Account is the provider ad-account the campaign runs under, in Meta's act_<id> form. |
data[].budget | body | integer | — | Budget is the campaign's authorized spend in MINOR units (cents). Negative clamps to 0. |
data[].createdAt | body | integer | — | CreatedAt is when the campaign was first stored, in unix seconds. |
data[].externalId | body | string | — | ExternalID is the ad network's own campaign id, written by a successful launch and by nothing else — an update never touches it. |
data[].id | body | string | — | ID is the campaign's server-minted handle, "camp_" + 32 hex. |
data[].name | body | string | — | Name is the campaign's display label, and the name Meta creates the campaign object under at launch. |
data[].objective | body | string | — | Objective is the campaign goal spelled as the provider names it ("conversions", "OUTCOME_TRAFFIC"), passed through to the network verbatim at launch — Meta… |
data[].platform | body | string | — | Platform is the ad network: meta, google, tiktok or x, and nothing else — a write naming another is 400. Empty stores as meta. |
data[].spend | body | integer | — | Spend is spend-to-date in MINOR units (cents), as last written through create or update. Negative clamps to 0. |
data[].status | body | string | — | Status is the lifecycle: draft, active, paused or completed, and nothing else — a write naming another is 400. |
data[].updatedAt | body | integer | — | UpdatedAt is when the row was last written, in unix seconds — set by create, update and launch. |
Failure carries the platform error shape — see Errors.
Examples
hanzo ads campaigns listimport { Configuration, AdApi } from 'hanzoai';
const api = new AdApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getAdCampaigns();from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import AdApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = AdApi(client).get_ad_campaigns()cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.AdAPI.GetAdCampaigns(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, ad_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = ad_api::get_ad_campaigns(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.AdApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new AdApi(client).getAdCampaigns();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/ad/campaigns \
-H "Authorization: Bearer $HANZO_API_KEY"The door reaches ad through the ads tool, which names its 7 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_ads_campaigns"
}
}
}'How is this guide?