Ad
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 URL | https://api.hanzo.ai |
| Operations | 7 |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Specification
Specification pending — no HIP in hanzoai/hips declares capability: ad yet. What this capability serves is below, from the API document; what it is — the store it owns, how it meters, what it publishes — is written as a HIP under HIP-0139.
Four surfaces
| Surface | Reaches this capability as | Coverage |
|---|---|---|
| REST | ad at its own prefix | 7 operations |
| CLI | hanzo ads … | 7 of 7 |
| SDK | — | no published client declares one yet — regenerating the clients is what adds them |
| MCP | tool ads on https://api.hanzo.ai/v1/mcp | 7 operations, 0 under the document's own id — ask describe for the rest |
Quickstart
export HANZO_API_KEY=sk-... # console.hanzo.ai → API keysThen the first call — a read that needs nothing but the key. GET /v1/ad/summary, operation get_ad_summary:
hanzo ads summaryimport { Configuration, AdApi } from 'hanzoai';
const api = new AdApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getAdSummary();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_summary()cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.AdAPI.GetAdSummary(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_summary(&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).getAdSummary();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/summary \
-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"
}
}
}'Answers 200 with object — ok.
Endpoints
| Endpoint | What it does |
|---|---|
POST /v1/ad/campaigns/{id}/launch | Run one of your stored campaigns on its ad network |
GET /v1/ad/campaigns/{id} | Returns one of the caller org's campaigns. |
PUT /v1/ad/campaigns/{id} | Replaces the user-owned fields of one of the caller org's campaigns and answers the stored row. |
DELETE /v1/ad/campaigns/{id} | Removes one of the caller org's campaigns and answers 204 with no body. |
GET /v1/ad/campaigns | Returns the caller org's ad campaigns, most recently updated first, optionally narrowed to one lifecycle status. |
POST /v1/ad/campaigns | Registers a new ad campaign for the caller's org and answers 201 with the stored row. |
GET /v1/ad/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… |
How is this guide?