Get campaign

Returns one campaign of the caller's org — its name, audience, creatives, channels with their per-channel launch state, schedule, budget and status.

GET /v1/campaign/{id}

Addresshttps://api.hanzo.ai/v1/campaign/{id}
MethodGET
Operationget_campaign_by_id
AuthAuthorization: Bearer $HANZO_API_KEY

Returns one campaign of the caller's org — its name, audience, creatives, channels with their per-channel launch state, schedule, budget and status. 404 when the org has no campaign with that id.

Request

1 field.

FieldInTypeRequiredDescription
idpathstringyesID is the campaign's server-minted handle, "cmp_"-prefixed.

Response

StatusBodyMeaning
200campaign.campaignRecordok
defaultproblem-detailsrefused

200 body — 16 fields.

FieldInTypeAlwaysDescription
audiencebodystring—Audience is an opaque reference to the segment this campaign targets.
budgetbodyinteger (int64)—Budget is the campaign's total budget in CENTS, handed to each executor as the budget for its channel.
channelsbodycampaign.ChannelSpec[]—Channels are the fan-out targets, at most one per kind and at most 12, each carrying its own post-launch state.
channels[].accountbodystring—Account is the provider account this channel runs under: an ad-account, a page or a mailing-list id.
channels[].detailbodystring—Detail is the last outcome in one secret-free line — the failure reason, or what the executor reported.
channels[].externalIdbodystring—ExternalID is the provider-side id of the running execution, recorded by the orchestrator at launch and handed back verbatim to read spend or to pause.
channels[].kindbodystring—Kind is the channel and the identity a campaign holds at most one of: paid, organic or email.
channels[].platformbodystring—Platform is the provider within the kind — meta, google, x, instagram, or the email provider.
channels[].statusbodystring—Status is this channel's own launch outcome, not the campaign's: pending (added, never launched), live, paused, failed (Detail says why) or unavailable (no executor wired on this deployment).
contentbodystring[]—Content is the ordered creative set, at most 32, empty entries dropped.
createdAtbodyinteger (int64)—CreatedAt is when the campaign was created, in unix seconds.
idbodystring—ID is the campaign's server-minted handle — "cmp_" and 128 random bits — and the id every other campaign call is addressed by.
namebodystring—Name is the campaign's display name.
scheduleAtbodyinteger (int64)—ScheduleAt is when the campaign should run, in unix seconds.
statusbodystring—Status is the lifecycle state, server-owned and never accepted from a caller.
updatedAtbodyinteger (int64)—UpdatedAt is the last write in unix seconds — an edit, a launch or a pause.

Failure carries the platform error shape — see Errors.

Examples

hanzo campaign get <id>
import { Configuration, CampaignApi } from 'hanzoai';

const api = new CampaignApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getCampaignById({ id: 'id' });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import CampaignApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = CampaignApi(client).get_campaign_by_id(id='id')
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.CampaignAPI.GetCampaignById(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, campaign_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = campaign_api::get_campaign_by_id(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.CampaignApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new CampaignApi(client).getCampaignById();
curl https://api.hanzo.ai/v1/campaign/<id> \
  -H "Authorization: Bearer $HANZO_API_KEY"

Tool campaign, op get_campaign_by_id — POST the JSON-RPC envelope to https://api.hanzo.ai/v1/mcp.

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "campaign",
         "arguments": {
           "op": "get_campaign_by_id",
           "input": {
             "id": "<id>"
           }
         }
       }
     }'

Campaign API · All Hanzo APIs · Interactive reference

Was this page useful?