Agent quickstart

Let an agent run ads from setup to iteration.

Agents can discover Adprime Zero, configure API or MCP access, prepare campaigns, and iterate autonomously through public tools. Hosted funding, campaign setup, creative submission, delivery reporting, and conversion setup all share the same account model.

1. Discover the service

Start from the API root or the docs. The API root returns a small discovery document; terminal-capable agents can run `ztdsp agent-guide`, and MCP-capable agents can inspect the tool list exposed by `ztdsp mcp`.

export ADP_ZERO_API_URL="https://adp-zero-api.adam-25a.workers.dev"
curl -sS "$ADP_ZERO_API_URL/"

npx -y ztdsp agent-guide
npx -y ztdsp agent-guide --json
npx -y ztdsp fund --help

2. Create or connect an account

Open account

The dashboard creates a buyer account and returns the account to the same API-key permission model used by CLI, MCP, and direct API calls. Agents should store the returned `ak_...` key only in the user's chosen secret storage. Agents do not need a dashboard login session for ordinary API work; they authenticate with that API key.

Direct REST clients should identify themselves with a normal User-Agent header, for example `your-agent-name/1.0`. Cloudflare can reject anonymous runtime defaults such as Python's `urllib` fingerprint before the request reaches the API Worker.

3. Configure MCP for the agent

Run the embedded MCP server through the CLI. The agent discovers available tools from the MCP tool list and sends all account-changing actions through the public REST API.

{
  "mcpServers": {
    "adprime-zero": {
      "command": "npx",
      "args": ["-y", "ztdsp", "mcp"],
      "env": {
        "ADP_ZERO_API_URL": "https://adp-zero-api.adam-25a.workers.dev",
        "ADP_ZERO_API_KEY": "<stored api key>"
      }
    }
  }
}

4. Open the verified funding handoff

The agent may request a funding link and open it for the user. For external-agent keys, the link opens Adprime Zero login with the account email pre-filled. After the account verifies by email code or password, the browser continues to Stripe Checkout or Demo Wallet. The agent continues from the returned funding intent and account balance after completion.

ztdsp fund 50 --dollars --open
ztdsp fund-status <funding-intent-id> --watch

# MCP tools expose the same flow:
# request_prepay_link -> browser funding flow -> get_funding_intent_status

curl -sS -X POST "$ADP_ZERO_API_URL/account/prepay-link" \
  -H "authorization: Bearer $ADP_ZERO_API_KEY" \
  -H 'user-agent: your-agent-name/1.0' \
  -H 'content-type: application/json' \
  -d '{"amount_cents":'"$ADP_ZERO_AMOUNT_CENTS"',"return_url":"'"$ADP_ZERO_RETURN_URL"'"}'

5. Discover and target audiences

Agents can search the real Beeswax/LiveRamp catalog before creating targeting. Use the returned `id` exactly as the segment key, not the display name, and show the estimated data CPM before launch. Sensitive audience tiers require human review.

# CLI path for terminal-capable agents.
ztdsp targeting discover-segments --query automotive --limit 5 --json
ztdsp targeting create --name "US auto intenders" --countries USA --include-segments alliant-167430 --json

# MCP exposes the same catalog as discover_segments.
curl -sS "$ADP_ZERO_API_URL/targeting/reference/segments?q=automotive&limit=5" \
  -H "authorization: Bearer $ADP_ZERO_API_KEY" \
  -H 'user-agent: your-agent-name/1.0'

curl -sS -X POST "$ADP_ZERO_API_URL/targeting" \
  -H "authorization: Bearer $ADP_ZERO_API_KEY" \
  -H 'user-agent: your-agent-name/1.0' \
  -H 'content-type: application/json' \
  -d '{"name":"US auto intenders","geo":{"include_countries":["USA"]},"audience_segments":{"include_segments":["alliant-167430"],"exclude_segments":[]}}'

6. Continue campaign setup after funding

After the hosted payment flow completes, the agent should check the funding intent or balance before continuing. External agents can prepare and iterate autonomously, but activation still depends on prepaid balance, daily caps, creative review, destination approval, blocked-domain checks, and campaign platform checks.

curl -sS "$ADP_ZERO_API_URL/account/funding-intents/$ADP_ZERO_FUNDING_INTENT_ID" \
  -H "authorization: Bearer $ADP_ZERO_API_KEY" \
  -H 'user-agent: your-agent-name/1.0'

curl -sS -X POST "$ADP_ZERO_API_URL/creative" \
  -H "authorization: Bearer $ADP_ZERO_API_KEY" \
  -H 'user-agent: your-agent-name/1.0' \
  -H 'content-type: application/json' \
  -d @"$ADP_ZERO_CREATIVE_JSON_PATH"

7. Iterate campaign creatives

After a campaign exists, agents can manage the creative set through the same public API used by the dashboard, CLI, and MCP. Add approved variants, replace a primary creative, pause or resume one creative in rotation, remove a creative, or copy a campaign without direct database or Beeswax credentials. The API keeps the last-active creative guard and all creative/destination approval rules attached.

ztdsp campaign creatives list "$ADP_ZERO_CAMPAIGN_ID" --json
ztdsp campaign creatives add "$ADP_ZERO_CAMPAIGN_ID" --creative "$ADP_ZERO_APPROVED_CREATIVE_ID"
ztdsp campaign creatives replace "$ADP_ZERO_CAMPAIGN_ID" --creative "$ADP_ZERO_REPLACEMENT_CREATIVE_ID"
ztdsp campaign copy "$ADP_ZERO_CAMPAIGN_ID" --name "New test flight"

curl -sS "$ADP_ZERO_API_URL/campaign/$ADP_ZERO_CAMPAIGN_ID/creatives" \
  -H "authorization: Bearer $ADP_ZERO_API_KEY" \
  -H 'user-agent: your-agent-name/1.0'

# MCP tools expose the same surface:
# list_campaign_creatives, add_campaign_creative, replace_campaign_creative,
# pause_campaign_creative, resume_campaign_creative, remove_campaign_creative, copy_campaign

8. Measure delivery and conversions

Delivery reporting covers impressions, clicks, spend, and CTR. Conversion events add browser pixels and server postbacks through `/conversion-events`, with MCP tools and `ztdsp conversion` for agent setup. Use install snippets from the API only; never embed API keys in browser tags.

ztdsp conversion create --name "Purchase" --kind purchase
ztdsp conversion install cevt_...
ztdsp conversion link cevt_... camp_...
ztdsp conversion test cevt_...

ztdsp campaign stats "$ADP_ZERO_CAMPAIGN_ID"

curl -sS -X POST "$ADP_ZERO_API_URL/performance/query" \
  -H "authorization: Bearer $ADP_ZERO_API_KEY" \
  -H 'user-agent: your-agent-name/1.0' \
  -H 'content-type: application/json' \
  -d '{"campaign_id":"'"$ADP_ZERO_CAMPAIGN_ID"'","start_at":"2026-05-01T00:00:00Z","end_at":"2026-05-22T00:00:00Z","dimensions":["day"],"metrics":["impressions","clicks","spend_cents","conversions","cvr_bps","cpa_cents","roas_bps"]}'