Run ads from Codex
Codex-style agents get a real ad account through the hosted MCP server or the REST API. They launch campaigns and read performance.
On this page
A Codex-style agent launches ads by calling the public Adprime Zero API, not by writing a plan that never becomes an object.
This guide covers how a code-capable agent discovers the service, stores a key, stops at a funding URL, and iterates from reports.
Why a code agent is a good fit
Codex already lives in a terminal and can call MCP tools. Add https://mcp.adprimezero.com/mcp as a remote MCP server and sign in once in the browser; the agent then reads the tool list instead of guessing route names. REST API reference has the REST map for anything scripted.
If the build you run cannot open a browser for MCP sign-in, create a key on the dashboard API keys page and send it as Authorization: Bearer ak_..., to the MCP URL or to the REST API. Direct REST clients need a normal User-Agent header, for example your-agent-name/1.0. Anonymous runtime defaults can be rejected before the request reaches the API.
The MCP tools cover get_account, request_prepay_link, targeting, creative, campaign launch and pause, conversion, and performance. Every tool call that changes account state goes through the public REST API. There is no hidden agent permission system.
Launch sequence
- Connect the account (MCP sign-in, or a key kept in the user's secret storage).
- Collect landing URL, offer, geography, daily budget, and image assets from the user. Do not invent a click URL.
pre_check_creative, thensubmit_creativewith headline, description, expected content, and disclosure. Pollget_creativeuntil it is approved.discover_segmentswhen the user asked for an audience. Use returned ids. Show estimated data CPM.create_targeting,create_campaign, thenactivate_campaign.- If balance is missing,
request_prepay_link, hand the user the link, and pollget_funding_intent_status. Do not collect cards. - After activation,
list_campaign_performanceandget_beeswax_reporting_status(reporting freshness).
Copy a campaign when the next test would contaminate the first. Rotate creatives with add_campaign_creative and replace_campaign_creative. The last active creative cannot be paused or removed.
What Codex must not do
It must not write exchange campaign ids by hand. It must not embed the API key in a browser pixel. It must not treat generated_at as reporting freshness. It must not optimize on click-through rate. It must not enable conversion-based optimization until an event exists, a test fire has succeeded, and the campaign is linked.
If the environment is Cursor instead of Codex, use Launch ads from Cursor. If you are still choosing how any agent connects, use Connect your AI assistant and launch. The daily operating loop after attach is How an agent buys ads.
Related
- Guides · 2 min readLaunch ads from CursorAdd Adprime Zero to Cursor as an MCP server and paste one launch brief. The campaign objects live on the account, not only in the chat.
- Guides · 4 min readConnect your AI assistant and launchAdd https://mcp.adprimezero.com/mcp to Claude, ChatGPT, Cursor, or Claude Code, sign in with an emailed code, and your assistant can fund, launch, and report on real display campaigns.
- Playbooks · 5 min readLaunch prompts for Claude, ChatGPT, Cursor, and CodexCopy-paste launch briefs for a $20/day display test. One full prompt for code agents, short versions for Claude, ChatGPT, and Codex. Real ids only, payment on a hosted page.
Run this from your assistant
Add one URL to Claude, ChatGPT, or Cursor, sign in with your email, and ask for the campaign. Prepaid from $5, with no insertion order and no sales call.