OverviewProductsPlatformsAPI ReferenceResources

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.

TypeScript
const { data: resumed } = await zernio.adcampaigns.updateAdCampaignStatus({
  path: { campaignId: 'cmp_abc123' },
  body: { status: 'active', platform: 'openai' }
});

Response (200):

JSON
{ "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, 422 without one).
  • goal sets the campaign objective.
  • promotedObject.customEventType picks the conversion event exactly as on POST /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:

FieldLevelMeaning
statusCampaign, ad group, adDelivery status, cascaded from the ancestors, so an ad under a paused campaign reads paused
platformCampaignStatusCampaignThe campaign's own switch: active, paused or archived
configuredStatusAdThe 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

ErrorCauseFix
501 with code feature_not_availabletargeting 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 capKeep a daily budget, or create a new campaign for a lifetime one.
422 with param: "budget.amount"Budget below 1 in the ad account currencyRaise the budget.
422 on POST /v1/ads/campaignsNo budget sentSend a daily or lifetime budget.
Was this page helpful?

On this page