# Ad

URL: https://docs.hanzo.ai/docs/openapi/ad

> Your paid ad campaigns, launched and paused from one place.

Also for this capability: **API** · [CLI](https://docs.hanzo.ai/docs/cli/ad) · [MCP](https://docs.hanzo.ai/docs/mcp-tools/ad) · [SDKs](https://docs.hanzo.ai/docs/sdks)

Your paid ad campaigns, launched and paused from one place.

> [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|                |                                        |
| -------------- | -------------------------------------- |
| **Base URL**   | `https://api.hanzo.ai`                 |
| **Operations** | 7                                      |
| **Auth**       | `Authorization: Bearer $HANZO_API_KEY` |

## Specification

Specification pending — no HIP in [hanzoai/hips](https://github.com/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 ad …`                               | 7 of 7                                                                    |
| **SDK**  | `AdApi` in every published client          | 7 methods                                                                 |
| **MCP**  | tool `ad` on `https://api.hanzo.ai/v1/mcp` | 6 operations, 1 under the document's own id — ask `describe` for the rest |

## Quickstart

```bash
export HANZO_API_KEY=sk-...   # console.hanzo.ai → API keys
```

Then the first call — a read that needs nothing but the key. `GET /v1/ad/summary`, operation `get_ad_summary`:

**CLI**

```bash
hanzo ad summary
```

**SDK**

**.ts**

```ts
import { Configuration, AdApi } from 'hanzoai';

const api = new AdApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getAdSummary();
```

**.py**

```python
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()
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.AdAPI.GetAdSummary(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::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?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.AdApi;

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

var result = new AdApi(client).getAdSummary();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/ad/summary \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

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

```bash
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": "ad",
         "arguments": {
           "op": "get_ad_summary",
           "input": {}
         }
       }
     }'
```

Answers `200` with `object` — ok.

## Endpoints

| Endpoint                                                                                                    | What it does                                                                                                                                                 |
| ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [`POST /v1/ad/campaigns/{id}/launch`](https://docs.hanzo.ai/docs/openapi/ad/post-ad-campaigns-by-id-launch) | Run one of your stored campaigns on its ad network                                                                                                           |
| [`GET /v1/ad/campaigns/{id}`](https://docs.hanzo.ai/docs/openapi/ad/get-ad-campaigns-by-id)                 | Returns one of the caller org's campaigns.                                                                                                                   |
| [`PUT /v1/ad/campaigns/{id}`](https://docs.hanzo.ai/docs/openapi/ad/put-ad-campaigns-by-id)                 | Replaces the user-owned fields of one of the caller org's campaigns and answers the stored row.                                                              |
| [`DELETE /v1/ad/campaigns/{id}`](https://docs.hanzo.ai/docs/openapi/ad/delete-ad-campaigns-by-id)           | Removes one of the caller org's campaigns and answers 204 with no body.                                                                                      |
| [`GET /v1/ad/campaigns`](https://docs.hanzo.ai/docs/openapi/ad/get-ad-campaigns)                            | Returns the caller org's ad campaigns, most recently updated first, optionally narrowed to one lifecycle status.                                             |
| [`POST /v1/ad/campaigns`](https://docs.hanzo.ai/docs/openapi/ad/post-ad-campaigns)                          | Registers a new ad campaign for the caller's org and answers 201 with the stored row.                                                                        |
| [`GET /v1/ad/summary`](https://docs.hanzo.ai/docs/openapi/ad/get-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 of them. |

---

[All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
