Manage ads
Pause or resume an OpenAI ad, change its budget, create a campaign on its own, and read each level's status.
After creation an OpenAI ad changes only in status and budget, and PUT /v1/ads/ad-sets/{id} can also rename the ad group and change its bid. Sending targeting or creative returns 501 with code feature_not_available.
Pause or resume
PUT /v1/ads/campaigns/{campaignId}/status switches a campaign on or off. PUT /v1/ads/{adId}/status does the same for a single ad.
const { data: resumed } = await zernio.adcampaigns.updateAdCampaignStatus({
path: { campaignId: 'cmp_abc123' },
body: { status: 'active', platform: 'openai' }
});Response (200):
{ "status": "active", "platformCampaignStatus": "active", "updated": 1, "skipped": 0 }Zernio reads the campaign's switch from OpenAI first. If it is already in the requested state, nothing is written and the response says updated: 0, skipped: 1.
Change the budget
Send budget: { amount, type } on PUT /v1/ads/{adId} or PUT /v1/ads/campaigns/{campaignId}. It replaces the campaign's single spend cap with the one you send, daily or lifetime.
A lifetime cap can switch to daily. OpenAI never switches a daily cap back to lifetime, so that edit returns 422: create a new campaign for a lifetime budget.
Campaigns created in ChatGPT Ads Manager with a daily cap are editable the same way.
Create a campaign on its own
POST /v1/ads/campaigns creates a campaign on its own, without an ad group or ad.
- It takes a daily or lifetime budget (required,
422without one). goalsets the campaign objective.promotedObject.customEventTypepicks the conversion event exactly as onPOST /v1/ads/create.
Read status
OpenAI keeps a separate on/off switch at each level, so GET /v1/ads/tree reports two kinds of status:
| Field | Level | Meaning |
|---|---|---|
status | Campaign, ad group, ad | Delivery status, cascaded from the ancestors, so an ad under a paused campaign reads paused |
platformCampaignStatus | Campaign | The campaign's own switch: active, paused or archived |
configuredStatus | Ad | The ad's own switch: ACTIVE, PAUSED or ARCHIVED, unaffected by a paused campaign or ad group |
OpenAI's listings leave out archived campaigns, ad groups and ads. Zernio re-reads by id any stored ad the listing no longer returns, and records its real terminal status.
An ad archived in Ads Manager, or sitting under an archived campaign or ad group, settles as archived instead of keeping a stale status. One OpenAI no longer finds is marked deleted.
Delete
OpenAI has no delete API, and archiving is terminal. Cancelling an ad in Zernio archives the ad, its ad group and its campaign on OpenAI, then marks the ad cancelled in Zernio.
If it fails
| Error | Cause | Fix |
|---|---|---|
501 with code feature_not_available | targeting or creative sent to PUT /v1/ads/{adId} | Change status or budget, and recreate the ad for anything else. |
422 with param: "budget.type" | A lifetime budget sent to a campaign that has a daily cap | Keep a daily budget, or create a new campaign for a lifetime one. |
422 with param: "budget.amount" | Budget below 1 in the ad account currency | Raise the budget. |
422 on POST /v1/ads/campaigns | No budget sent | Send a daily or lifetime budget. |
Related
- Update ad and Update a campaign: status and budget edits.
- Pause or resume a campaign: the switch and its read-back.
- Create a standalone campaign: every field of the campaign-only create.
- Get campaign tree: the status fields per level.