主导航

广告组

创建、列出、检索、更新和更改广告组状态。

列出广告组

列出某个广告系列下的广告组。

GET /ad_groups

参数类型必需备注
campaign_idstring父级广告系列 ID。
limit整数介于 1500 之间。默认值为 20。
afterstring下一页的游标。
beforestring上一页的游标。
orderstringascdesc
curl -X GET "https://api.ads.openai.com/v1/ad_groups?campaign_id=cmpn_101&limit=10" \
  -H "Authorization: Bearer $OPENAI_ADS_API_KEY"
{
  "object": "list",
  "data": [
    {
      "id": "adgrp_301",
      "created_at": 1735689700,
      "updated_at": 1735776100,
      "name": "US English",
      "description": "Primary English-speaking audience.",
      "context_hints": ["productivity", "team collaboration"],
      "status": "active",
      "bidding_config": {
        "billing_event_type": "impression",
        "max_bid_micros": 60000
      }
    }
  ],
  "first_id": "adgrp_301",
  "last_id": "adgrp_301",
  "has_more": false
}

创建广告组

为广告系列创建广告组。

POST /ad_groups

字段类型必需备注
campaign_idstring父级广告系列 ID。
namestring31000 个字符,且必须包含非空格字符。
descriptionstring广告组描述。
context_hints字符串数组自由格式的受众或投放位置提示。
statusstringactive(激活)或 paused(暂停)。
bidding_config.billing_event_typestring目前仅支持 impression(展示)。
bidding_config.max_bid_micros整数介于 1100000000 之间。

字段说明

上下文提示提供了关于您认为广告何时会有用的额外信息,并有助于指导广告的展示时机。请提供一份描述或关键词列表,说明产品或服务在何时展示可能有用。

Micros 是主要货币单位(例如美元)的百万分之一。max_bid 字段针对的是每个事件,因此 60 美元 CPM(每次展示 0.06 美元)在 API 中应传入 60,000。请注意,货币字段遵循您广告账户的默认货币。

curl -X POST "https://api.ads.openai.com/v1/ad_groups" \
  -H "Authorization: Bearer $OPENAI_ADS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "campaign_id": "cmpn_101",
    "name": "US English",
    "description": "Primary English-speaking audience.",
    "context_hints": ["productivity", "team collaboration"],
    "status": "active",
    "bidding_config": {
      "billing_event_type": "impression",
      "max_bid_micros": 60000
    }
  }'

检索广告组

按 ID 获取单个广告组。

GET /ad_groups/{ad_group_id}

curl -X GET "https://api.ads.openai.com/v1/ad_groups/adgrp_301" \
  -H "Authorization: Bearer $OPENAI_ADS_API_KEY"

更新广告组

使用 POST 更新广告组。

POST /ad_groups/{ad_group_id}

更新时所有字段均为可选。可以将 description 设置为 null 以清除它。如果包含 bidding_config,请发送完整对象。status 接受 active(激活)、paused(暂停)或 archived(归档)。

curl -X POST "https://api.ads.openai.com/v1/ad_groups/adgrp_301" \
  -H "Authorization: Bearer $OPENAI_ADS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "context_hints": ["productivity", "workflow automation"],
    "status": "paused",
    "bidding_config": {
      "billing_event_type": "impression",
      "max_bid_micros": 75000
    }
  }'

通过专用操作更改状态

广告 API 还提供显式的状态转换。已暂停的广告组不会向用户投放广告。仅对不再需要的对象进行归档,因为归档操作是不可逆的。

  • POST /ad_groups/{ad_group_id}/activate
  • POST /ad_groups/{ad_group_id}/pause
  • POST /ad_groups/{ad_group_id}/archive
curl -X POST "https://api.ads.openai.com/v1/ad_groups/adgrp_301/archive" \
  -H "Authorization: Bearer $OPENAI_ADS_API_KEY"
{
  "id": "adgrp_301",
  "created_at": 1735689700,
  "updated_at": 1735948800,
  "name": "US English",
  "description": "Primary English-speaking audience.",
  "context_hints": ["productivity", "team collaboration"],
  "status": "archived",
  "bidding_config": {
    "billing_event_type": "impression",
    "max_bid_micros": 60000
  }
}
© . This website operates independently and is not affiliated with or endorsed by OpenAI, Inc. All brand names, logos, and trademarks are the property of their respective owners.