Hanzo

Ads

Package ads is your paid ad campaigns, launched and paused from one place.

Package ads is your paid ad campaigns, launched and paused from one place.

Base URLhttps://api.hanzo.ai
Operations7
AuthAuthorization: Bearer $HANZO_API_KEY

ads

POST /v1/ads/campaigns/{id}/launch

Run one of your stored campaigns on its ad network

Creates the campaign on its platform under the CALLER ORG'S own connected ad account, records the provider campaign id, flips the stored campaign to active and answers the updated record. No ad-network token is held here: it is resolved from KMS through the org's connector at launch time, BEFORE any provider call, so an org that has not connected that platform gets 424 and no spend can ever start on a connection the org did not make. Meta is executed for real; a campaign on a platform whose provider is not wired yet answers 501 even when the connector is connected, and an edge failure at the platform is 502. The optional {account} body overrides the target ad account for this launch and is TOLERANT — a malformed or non-JSON body is ignored and the campaign launches on its stored account rather than being refused. A campaign id another org owns reads as not found.

ParameterInTypeRequiredDescription
idpathstringyes

GET /v1/ads/campaigns/{id}

Returns one of the caller org's campaigns. An id another org owns reads as not found, so the response cannot confirm that it exists.

ParameterInTypeRequiredDescription
idpathstringyes

PUT /v1/ads/campaigns/{id}

Replaces the user-owned fields of one of the caller org's campaigns and answers the stored row. It is a full replace, not a patch: every field is written from the request, so an omitted one is cleared. externalId is launch-owned and is never touched here, so editing a campaign cannot break its link to a live provider execution.

ParameterInTypeRequiredDescription
idpathstringyes

Request bodyapplication/json (required)

FieldTypeRequiredDescription
accountstringAccount is the provider ad-account this campaign runs on (Meta act_<id>).
budgetintegerBudget is the campaign budget in MINOR units (cents).
namestringName is the campaign's display label.
objectivestringObjective is the campaign goal as the provider names it.
platformstringPlatform is the ad network: meta, google, tiktok or x.
spendintegerSpend is the amount spent so far in MINOR units (cents).
statusstringStatus is the lifecycle state: draft, active, paused or completed.

DELETE /v1/ads/campaigns/{id}

Removes one of the caller org's campaigns and answers 204 with no body. It deletes the stored record only: a campaign already launched keeps running on the ad network, which must be stopped there. An id another org owns reads as not found.

ParameterInTypeRequiredDescription
idpathstringyes

GET /v1/ads/campaigns

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.

ParameterInTypeRequiredDescription
statusquerystringStatus filters to one lifecycle state (draft, active, paused, completed).
limitqueryintegerLimit caps how many campaigns come back: default 200, maximum 1000.

POST /v1/ads/campaigns

Registers a new ad campaign for the caller's org and answers 201 with the stored row. It only records the campaign — nothing is sent to the ad network until POST /v1/ads/campaigns/{id}/launch runs it. The org is stamped by the server from the validated principal, so a body can never place a campaign in another tenant.

Request bodyapplication/json (required)

FieldTypeRequiredDescription
accountstringAccount is the provider ad-account this campaign runs on (Meta act_<id>).
budgetintegerBudget is the campaign budget in MINOR units (cents).
namestringName is the campaign's display label.
objectivestringObjective is the campaign goal as the provider names it.
platformstringPlatform is the ad network: meta, google, tiktok or x.
spendintegerSpend is the amount spent so far in MINOR units (cents).
statusstringStatus is the lifecycle state: draft, active, paused or completed.

GET /v1/ads/summary

Rolls the caller org's ad campaigns up into four numbers: how many campaigns exist, how many are active, and the summed budget and spend across all of them. Budget and spend are MINOR units (cents), the same units the campaign rows carry. It counts only this org's campaigns.


All Hanzo APIs · Interactive reference

How is this guide?

On this page