私隱偏好

必要功能

用於安全驗證及網站基本功能。

一直啟用

Landing 診斷及遮蔽重播

量度公開網站到訪、流失及註冊連結操作,只使用此分頁的匿名識別碼,不連結帳戶。所有文字會遮蔽,表格會封鎖。

選擇性使用分析

是否允許 PostHog 分析網站使用情況?您可隨時在頁尾更新選擇。

另外允許重播此公開網站的操作

選擇性跨網站模式的重播會顯示公開頁面及操作,並遮蔽輸入及私人內容。App 重播須另行選擇。

須先開啟選擇性分析;此跨網站模式的重播預設關閉。上方 Landing 模式獨立運作。

瀏覽器分析選擇不會啟用帳戶分析。

搜尋資料會在使用時載入。亦可直接瀏覽下方分類。

廣告

執行已核對廣告修改

消耗確切且已核對的單次廣告 token。回應不明時,重用已回傳的操作 ID 查閱狀態,切勿建立替代修改。

POST /advertising-api/actions/apply

Contract 核對日期: · sha256:9aedef8d43dd4514

概覽

消耗確切且已核對的單次廣告 token。回應不明時,重用已回傳的操作 ID 查閱狀態,切勿建立替代修改。

HTTP 成功只表示本次操作的回應。背景工作須保留回傳 ID,並讀取同一操作,直至達到文件指定的終態。接受請求、排程成功或客戶端逾時,均不代表已發佈。

驗證及權限

接受的憑證類型
user_session, delegated_oauth, personal_access_token
委派權限
agent:advertising_manage
最低工作空間角色
editor
存取範圍
已登入用戶及獲授權資源範圍
需要所有工作空間同意
否
會改動狀態
是
完成依據
terminal provider receipt

憑證不能擴大持有人的權限。實際操作仍會檢查工作空間成員資格、資源擁有權、已選工作空間及能力授權。Tool profile 只會改變可見工具,不會授予權限。

請求欄位

必填表示在所屬物件及所選分支內必須提供;子欄位必填不代表可選的父物件亦變成必填。以下欄位名稱及規則直接來自 contract。

請求欄位
欄位/分支類型/必填限制
$object父物件內必填
  • additionalProperties: false
workspace_idstring父物件內必填
  • format: "uuid"
  • pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
prepare_tokenstring父物件內必填
  • minLength: 32
  • maxLength: 128
reviewed_digeststring父物件內必填
  • pattern: "^[a-f0-9]{64}$"
完整 JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspace_id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "prepare_token": {
      "type": "string",
      "minLength": 32,
      "maxLength": 128
    },
    "reviewed_digest": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    }
  },
  "required": [
    "workspace_id",
    "prepare_token",
    "reviewed_digest"
  ],
  "additionalProperties": false
}

回應及完成條件

成功 HTTP 狀態碼: 200. 完成依據: terminal provider receipt.

HTTP 成功只表示本次操作的回應。背景工作須保留回傳 ID,並讀取同一操作,直至達到文件指定的終態。接受請求、排程成功或客戶端逾時,均不代表已發佈。

必填表示在所屬物件及所選分支內必須提供;子欄位必填不代表可選的父物件亦變成必填。以下欄位名稱及規則直接來自 contract。

回應及完成條件
欄位/分支類型/必填限制
$object父物件內必填—
contract_versionstring父物件內必填
  • const: "advertising/v1"
actionobject父物件內必填—
action.idstring父物件內必填
  • format: "uuid"
  • pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
action.workspace_idstring父物件內必填
  • format: "uuid"
  • pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
action.advertising_account_idstring父物件內必填
  • format: "uuid"
  • pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
action.mutation_idstring父物件內必填
  • format: "uuid"
  • pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
action.statusstring父物件內必填
  • enum: ["prepared","queued","processing","succeeded","failed","unknown","cancelled"]
action.commandobject父物件內必填—
action.commandoneOf 1object父物件內必填—
action.command.operationoneOf 1string父物件內必填
  • const: "create_campaign"
action.command.nameoneOf 1string父物件內必填
  • minLength: 1
  • maxLength: 200
action.command.budgetoneOf 1object可選/陣列項目—
action.command.budget.kindoneOf 1string父物件內必填
  • enum: ["daily","lifetime"]
action.command.budget.amount_minoroneOf 1string父物件內必填
  • pattern: "^[1-9]\\d{0,11}$"
action.command.objectiveoneOf 1string父物件內必填
  • enum: ["OUTCOME_AWARENESS","OUTCOME_ENGAGEMENT","OUTCOME_LEADS","OUTCOME_SALES","OUTCOME_TRAFFIC","OUTCOME_APP_PROMOTION"]
action.command.special_ad_categoriesoneOf 1array父物件內必填
  • maxItems: 4
  • default: []
action.command.special_ad_categories[]oneOf 1string可選/陣列項目
  • enum: ["CREDIT","EMPLOYMENT","HOUSING","ISSUES_ELECTIONS_POLITICS"]
action.command.statusoneOf 1string父物件內必填
  • const: "PAUSED"
  • default: "PAUSED"
action.commandoneOf 2object父物件內必填—
action.command.operationoneOf 2string父物件內必填
  • const: "update_campaign"
action.command.object_idoneOf 2string父物件內必填
  • pattern: "^[1-9]\\d{1,24}$"
action.command.nameoneOf 2string可選/陣列項目
  • minLength: 1
  • maxLength: 200
action.command.budgetoneOf 2object可選/陣列項目—
action.command.budget.kindoneOf 2string父物件內必填
  • enum: ["daily","lifetime"]
action.command.budget.amount_minoroneOf 2string父物件內必填
  • pattern: "^[1-9]\\d{0,11}$"
action.command.statusoneOf 2string可選/陣列項目
  • enum: ["ACTIVE","PAUSED","ARCHIVED"]
action.commandoneOf 3object父物件內必填—
action.command.operationoneOf 3string父物件內必填
  • const: "create_adset"
action.command.campaign_idoneOf 3string父物件內必填
  • pattern: "^[1-9]\\d{1,24}$"
action.command.nameoneOf 3string父物件內必填
  • minLength: 1
  • maxLength: 200
action.command.budgetoneOf 3object可選/陣列項目—
action.command.budget.kindoneOf 3string父物件內必填
  • enum: ["daily","lifetime"]
action.command.budget.amount_minoroneOf 3string父物件內必填
  • pattern: "^[1-9]\\d{0,11}$"
action.command.targetingoneOf 3object父物件內必填—
action.command.targeting.geo_locationsoneOf 3object父物件內必填—
action.command.targeting.geo_locations.countriesoneOf 3array父物件內必填
  • minItems: 1
  • maxItems: 25
action.command.targeting.geo_locations.countries[]oneOf 3string可選/陣列項目
  • pattern: "^[A-Z]{2}$"
action.command.targeting.age_minoneOf 3integer父物件內必填
  • minimum: 18
  • maximum: 65
  • default: 18
action.command.targeting.age_maxoneOf 3integer父物件內必填
  • minimum: 18
  • maximum: 65
  • default: 65
action.command.targeting.gendersoneOf 3array可選/陣列項目
  • minItems: 1
  • maxItems: 2
action.command.targeting.genders[]oneOf 3number可選/陣列項目—
action.command.targeting.genders[]oneOf 3 / anyOf 1number可選/陣列項目
  • const: 1
action.command.targeting.genders[]oneOf 3 / anyOf 2number可選/陣列項目
  • const: 2
action.command.targeting.localesoneOf 3array可選/陣列項目
  • maxItems: 25
action.command.targeting.locales[]oneOf 3integer可選/陣列項目
  • maximum: 9007199254740991
  • exclusiveMinimum: 0
action.command.targeting.publisher_platformsoneOf 3array父物件內必填
  • minItems: 1
  • maxItems: 3
action.command.targeting.publisher_platforms[]oneOf 3string可選/陣列項目
  • enum: ["facebook","instagram","threads"]
action.command.targeting.facebook_positionsoneOf 3array可選/陣列項目
  • maxItems: 4
action.command.targeting.facebook_positions[]oneOf 3string可選/陣列項目
  • enum: ["feed","story","facebook_reels","video_feeds"]
action.command.targeting.instagram_positionsoneOf 3array可選/陣列項目
  • maxItems: 4
action.command.targeting.instagram_positions[]oneOf 3string可選/陣列項目
  • enum: ["stream","story","reels","explore"]
action.command.targeting.threads_positionsoneOf 3array可選/陣列項目
  • maxItems: 1
action.command.targeting.threads_positions[]oneOf 3string可選/陣列項目
  • const: "threads_stream"
action.command.targeting.custom_audience_idsoneOf 3array可選/陣列項目
  • maxItems: 4
action.command.targeting.custom_audience_ids[]oneOf 3string可選/陣列項目
  • pattern: "^[1-9]\\d{1,24}$"
action.command.targeting.excluded_custom_audience_idsoneOf 3array可選/陣列項目
  • maxItems: 4
action.command.targeting.excluded_custom_audience_ids[]oneOf 3string可選/陣列項目
  • pattern: "^[1-9]\\d{1,24}$"
action.command.billing_eventoneOf 3string父物件內必填
  • enum: ["IMPRESSIONS","LINK_CLICKS"]
action.command.optimization_goaloneOf 3string父物件內必填
  • enum: ["REACH","IMPRESSIONS","LINK_CLICKS","LANDING_PAGE_VIEWS","OFFSITE_CONVERSIONS","LEAD_GENERATION"]
action.command.bid_strategyoneOf 3string父物件內必填
  • const: "LOWEST_COST_WITHOUT_CAP"
  • default: "LOWEST_COST_WITHOUT_CAP"
action.command.start_timeoneOf 3string可選/陣列項目
  • format: "date-time"
  • pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
action.command.end_timeoneOf 3string可選/陣列項目
  • format: "date-time"
  • pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
action.command.promoted_objectoneOf 3object可選/陣列項目—
action.command.promoted_object.page_idoneOf 3string可選/陣列項目
  • pattern: "^[1-9]\\d{1,24}$"
action.command.promoted_object.pixel_idoneOf 3string可選/陣列項目
  • pattern: "^[1-9]\\d{1,24}$"
action.command.promoted_object.custom_event_typeoneOf 3string可選/陣列項目
  • enum: ["PURCHASE","LEAD","COMPLETE_REGISTRATION","ADD_TO_CART"]
action.command.statusoneOf 3string父物件內必填
  • const: "PAUSED"
  • default: "PAUSED"
action.commandoneOf 4object父物件內必填—
action.command.operationoneOf 4string父物件內必填
  • const: "update_adset"
action.command.object_idoneOf 4string父物件內必填
  • pattern: "^[1-9]\\d{1,24}$"
action.command.nameoneOf 4string可選/陣列項目
  • minLength: 1
  • maxLength: 200
action.command.budgetoneOf 4object可選/陣列項目—
action.command.budget.kindoneOf 4string父物件內必填
  • enum: ["daily","lifetime"]
action.command.budget.amount_minoroneOf 4string父物件內必填
  • pattern: "^[1-9]\\d{0,11}$"
action.command.statusoneOf 4string可選/陣列項目
  • enum: ["ACTIVE","PAUSED","ARCHIVED"]
action.command.targetingoneOf 4object可選/陣列項目—
action.command.targeting.geo_locationsoneOf 4object父物件內必填—
action.command.targeting.geo_locations.countriesoneOf 4array父物件內必填
  • minItems: 1
  • maxItems: 25
action.command.targeting.geo_locations.countries[]oneOf 4string可選/陣列項目
  • pattern: "^[A-Z]{2}$"
action.command.targeting.age_minoneOf 4integer父物件內必填
  • minimum: 18
  • maximum: 65
  • default: 18
action.command.targeting.age_maxoneOf 4integer父物件內必填
  • minimum: 18
  • maximum: 65
  • default: 65
action.command.targeting.gendersoneOf 4array可選/陣列項目
  • minItems: 1
  • maxItems: 2
action.command.targeting.genders[]oneOf 4number可選/陣列項目—
action.command.targeting.genders[]oneOf 4 / anyOf 1number可選/陣列項目
  • const: 1
action.command.targeting.genders[]oneOf 4 / anyOf 2number可選/陣列項目
  • const: 2
action.command.targeting.localesoneOf 4array可選/陣列項目
  • maxItems: 25
action.command.targeting.locales[]oneOf 4integer可選/陣列項目
  • maximum: 9007199254740991
  • exclusiveMinimum: 0
action.command.targeting.publisher_platformsoneOf 4array父物件內必填
  • minItems: 1
  • maxItems: 3
action.command.targeting.publisher_platforms[]oneOf 4string可選/陣列項目
  • enum: ["facebook","instagram","threads"]
action.command.targeting.facebook_positionsoneOf 4array可選/陣列項目
  • maxItems: 4
action.command.targeting.facebook_positions[]oneOf 4string可選/陣列項目
  • enum: ["feed","story","facebook_reels","video_feeds"]
action.command.targeting.instagram_positionsoneOf 4array可選/陣列項目
  • maxItems: 4
action.command.targeting.instagram_positions[]oneOf 4string可選/陣列項目
  • enum: ["stream","story","reels","explore"]
action.command.targeting.threads_positionsoneOf 4array可選/陣列項目
  • maxItems: 1
action.command.targeting.threads_positions[]oneOf 4string可選/陣列項目
  • const: "threads_stream"
action.command.targeting.custom_audience_idsoneOf 4array可選/陣列項目
  • maxItems: 4
action.command.targeting.custom_audience_ids[]oneOf 4string可選/陣列項目
  • pattern: "^[1-9]\\d{1,24}$"
action.command.targeting.excluded_custom_audience_idsoneOf 4array可選/陣列項目
  • maxItems: 4
action.command.targeting.excluded_custom_audience_ids[]oneOf 4string可選/陣列項目
  • pattern: "^[1-9]\\d{1,24}$"
action.command.start_timeoneOf 4string可選/陣列項目
  • format: "date-time"
  • pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
action.command.end_timeoneOf 4string可選/陣列項目
  • format: "date-time"
  • pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
action.commandoneOf 5object父物件內必填—
action.command.operationoneOf 5string父物件內必填
  • const: "create_ad"
action.command.nameoneOf 5string父物件內必填
  • minLength: 1
  • maxLength: 200
action.command.adset_idoneOf 5string父物件內必填
  • pattern: "^[1-9]\\d{1,24}$"
action.command.creative_idoneOf 5string父物件內必填
  • pattern: "^[1-9]\\d{1,24}$"
action.command.statusoneOf 5string父物件內必填
  • const: "PAUSED"
  • default: "PAUSED"
action.commandoneOf 6object父物件內必填—
action.command.operationoneOf 6string父物件內必填
  • const: "update_ad"
action.command.object_idoneOf 6string父物件內必填
  • pattern: "^[1-9]\\d{1,24}$"
action.command.nameoneOf 6string可選/陣列項目
  • minLength: 1
  • maxLength: 200
action.command.creative_idoneOf 6string可選/陣列項目
  • pattern: "^[1-9]\\d{1,24}$"
action.command.statusoneOf 6string可選/陣列項目
  • enum: ["ACTIVE","PAUSED","ARCHIVED"]
action.commandoneOf 7object父物件內必填—
action.command.operationoneOf 7string父物件內必填
  • const: "create_creative"
action.command.nameoneOf 7string父物件內必填
  • minLength: 1
  • maxLength: 200
action.command.object_story_speconeOf 7object可選/陣列項目—
action.command.object_story_spec.page_idoneOf 7string父物件內必填
  • pattern: "^[1-9]\\d{1,24}$"
action.command.object_story_spec.instagram_user_idoneOf 7string可選/陣列項目
  • pattern: "^[1-9]\\d{1,24}$"
action.command.object_story_spec.link_dataoneOf 7object父物件內必填—
action.command.object_story_spec.link_data.linkoneOf 7string父物件內必填
  • format: "uri"
  • maxLength: 2048
action.command.object_story_spec.link_data.messageoneOf 7string父物件內必填
  • maxLength: 5000
action.command.object_story_spec.link_data.nameoneOf 7string可選/陣列項目
  • minLength: 1
  • maxLength: 200
action.command.object_story_spec.link_data.image_hashoneOf 7string父物件內必填
  • pattern: "^[a-fA-F0-9]{16,128}$"
action.command.object_story_spec.link_data.call_to_actiononeOf 7string可選/陣列項目
  • enum: ["LEARN_MORE","SHOP_NOW","SIGN_UP","CONTACT_US"]
action.command.object_story_idoneOf 7string可選/陣列項目
  • pattern: "^[1-9]\\d{1,24}_[1-9]\\d{1,24}$"
action.commandoneOf 8object父物件內必填—
action.command.operationoneOf 8string父物件內必填
  • const: "create_saved_audience"
action.command.nameoneOf 8string父物件內必填
  • minLength: 1
  • maxLength: 200
action.command.targetingoneOf 8object父物件內必填—
action.command.targeting.geo_locationsoneOf 8object父物件內必填—
action.command.targeting.geo_locations.countriesoneOf 8array父物件內必填
  • minItems: 1
  • maxItems: 25
action.command.targeting.geo_locations.countries[]oneOf 8string可選/陣列項目
  • pattern: "^[A-Z]{2}$"
action.command.targeting.age_minoneOf 8integer父物件內必填
  • minimum: 18
  • maximum: 65
  • default: 18
action.command.targeting.age_maxoneOf 8integer父物件內必填
  • minimum: 18
  • maximum: 65
  • default: 65
action.command.targeting.gendersoneOf 8array可選/陣列項目
  • minItems: 1
  • maxItems: 2
action.command.targeting.genders[]oneOf 8number可選/陣列項目—
action.command.targeting.genders[]oneOf 8 / anyOf 1number可選/陣列項目
  • const: 1
action.command.targeting.genders[]oneOf 8 / anyOf 2number可選/陣列項目
  • const: 2
action.command.targeting.localesoneOf 8array可選/陣列項目
  • maxItems: 25
action.command.targeting.locales[]oneOf 8integer可選/陣列項目
  • maximum: 9007199254740991
  • exclusiveMinimum: 0
action.command.targeting.publisher_platformsoneOf 8array父物件內必填
  • minItems: 1
  • maxItems: 3
action.command.targeting.publisher_platforms[]oneOf 8string可選/陣列項目
  • enum: ["facebook","instagram","threads"]
action.command.targeting.facebook_positionsoneOf 8array可選/陣列項目
  • maxItems: 4
action.command.targeting.facebook_positions[]oneOf 8string可選/陣列項目
  • enum: ["feed","story","facebook_reels","video_feeds"]
action.command.targeting.instagram_positionsoneOf 8array可選/陣列項目
  • maxItems: 4
action.command.targeting.instagram_positions[]oneOf 8string可選/陣列項目
  • enum: ["stream","story","reels","explore"]
action.command.targeting.threads_positionsoneOf 8array可選/陣列項目
  • maxItems: 1
action.command.targeting.threads_positions[]oneOf 8string可選/陣列項目
  • const: "threads_stream"
action.command.targeting.custom_audience_idsoneOf 8array可選/陣列項目
  • maxItems: 4
action.command.targeting.custom_audience_ids[]oneOf 8string可選/陣列項目
  • pattern: "^[1-9]\\d{1,24}$"
action.command.targeting.excluded_custom_audience_idsoneOf 8array可選/陣列項目
  • maxItems: 4
action.command.targeting.excluded_custom_audience_ids[]oneOf 8string可選/陣列項目
  • pattern: "^[1-9]\\d{1,24}$"
action.commandoneOf 9object父物件內必填—
action.command.operationoneOf 9string父物件內必填
  • const: "update_saved_audience"
action.command.object_idoneOf 9string父物件內必填
  • pattern: "^[1-9]\\d{1,24}$"
action.command.nameoneOf 9string可選/陣列項目
  • minLength: 1
  • maxLength: 200
action.command.targetingoneOf 9object可選/陣列項目—
action.command.targeting.geo_locationsoneOf 9object父物件內必填—
action.command.targeting.geo_locations.countriesoneOf 9array父物件內必填
  • minItems: 1
  • maxItems: 25
action.command.targeting.geo_locations.countries[]oneOf 9string可選/陣列項目
  • pattern: "^[A-Z]{2}$"
action.command.targeting.age_minoneOf 9integer父物件內必填
  • minimum: 18
  • maximum: 65
  • default: 18
action.command.targeting.age_maxoneOf 9integer父物件內必填
  • minimum: 18
  • maximum: 65
  • default: 65
action.command.targeting.gendersoneOf 9array可選/陣列項目
  • minItems: 1
  • maxItems: 2
action.command.targeting.genders[]oneOf 9number可選/陣列項目—
action.command.targeting.genders[]oneOf 9 / anyOf 1number可選/陣列項目
  • const: 1
action.command.targeting.genders[]oneOf 9 / anyOf 2number可選/陣列項目
  • const: 2
action.command.targeting.localesoneOf 9array可選/陣列項目
  • maxItems: 25
action.command.targeting.locales[]oneOf 9integer可選/陣列項目
  • maximum: 9007199254740991
  • exclusiveMinimum: 0
action.command.targeting.publisher_platformsoneOf 9array父物件內必填
  • minItems: 1
  • maxItems: 3
action.command.targeting.publisher_platforms[]oneOf 9string可選/陣列項目
  • enum: ["facebook","instagram","threads"]
action.command.targeting.facebook_positionsoneOf 9array可選/陣列項目
  • maxItems: 4
action.command.targeting.facebook_positions[]oneOf 9string可選/陣列項目
  • enum: ["feed","story","facebook_reels","video_feeds"]
action.command.targeting.instagram_positionsoneOf 9array可選/陣列項目
  • maxItems: 4
action.command.targeting.instagram_positions[]oneOf 9string可選/陣列項目
  • enum: ["stream","story","reels","explore"]
action.command.targeting.threads_positionsoneOf 9array可選/陣列項目
  • maxItems: 1
action.command.targeting.threads_positions[]oneOf 9string可選/陣列項目
  • const: "threads_stream"
action.command.targeting.custom_audience_idsoneOf 9array可選/陣列項目
  • maxItems: 4
action.command.targeting.custom_audience_ids[]oneOf 9string可選/陣列項目
  • pattern: "^[1-9]\\d{1,24}$"
action.command.targeting.excluded_custom_audience_idsoneOf 9array可選/陣列項目
  • maxItems: 4
action.command.targeting.excluded_custom_audience_ids[]oneOf 9string可選/陣列項目
  • pattern: "^[1-9]\\d{1,24}$"
action.reviewed_digeststring父物件內必填
  • pattern: "^[a-f0-9]{64}$"
action.effectsobject父物件內必填—
action.effects.creates_objectboolean父物件內必填—
action.effects.initial_statusstring | null父物件內必填—
action.effects.initial_statusanyOf 1string父物件內必填
  • const: "PAUSED"
action.effects.initial_statusanyOf 2null父物件內必填—
action.effects.activates_deliveryboolean父物件內必填—
action.effects.changes_budgetboolean父物件內必填—
action.effects.changes_audienceboolean父物件內必填—
action.effects.changes_creativeboolean父物件內必填—
action.effects.currencystring父物件內必填
  • pattern: "^[A-Z]{3}$"
action.effects.timezonestring父物件內必填
  • minLength: 1
  • maxLength: 100
action.effects.budgetobject | null父物件內必填—
action.effects.budgetanyOf 1object父物件內必填—
action.effects.budget.kindanyOf 1string父物件內必填
  • enum: ["daily","lifetime"]
action.effects.budget.amount_minoranyOf 1string父物件內必填
  • pattern: "^[1-9]\\d{0,11}$"
action.effects.budgetanyOf 2null父物件內必填—
action.live_approvalobject父物件內必填—
action.live_approval.requiredboolean父物件內必填—
action.live_approval.statestring父物件內必填
  • enum: ["not_required","missing","approved","expired","revoked","invalid"]
action.live_approval.reasonstring | null父物件內必填—
action.live_approval.reasonanyOf 1string父物件內必填
  • maxLength: 100
action.live_approval.reasonanyOf 2null父物件內必填—
action.live_approval.expires_atstring | null父物件內必填—
action.live_approval.expires_atanyOf 1string父物件內必填
  • format: "date-time"
  • pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
action.live_approval.expires_atanyOf 2null父物件內必填—
action.live_approval.approved_bystring | null父物件內必填—
action.live_approval.approved_byanyOf 1string父物件內必填
  • format: "uuid"
  • pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
action.live_approval.approved_byanyOf 2null父物件內必填—
action.provider_object_idstring | null父物件內必填—
action.provider_object_idanyOf 1string父物件內必填
  • pattern: "^[1-9]\\d{1,24}$"
action.provider_object_idanyOf 2null父物件內必填—
action.failure_codestring | null父物件內必填—
action.failure_codeanyOf 1string父物件內必填
  • maxLength: 100
action.failure_codeanyOf 2null父物件內必填—
action.created_atstring父物件內必填
  • format: "date-time"
  • pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
action.completed_atstring | null父物件內必填—
action.completed_atanyOf 1string父物件內必填
  • format: "date-time"
  • pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
action.completed_atanyOf 2null父物件內必填—
replayedboolean父物件內必填—
完整 JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "contract_version": {
      "type": "string",
      "const": "advertising/v1"
    },
    "action": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
        },
        "workspace_id": {
          "type": "string",
          "format": "uuid",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
        },
        "advertising_account_id": {
          "type": "string",
          "format": "uuid",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
        },
        "mutation_id": {
          "type": "string",
          "format": "uuid",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
        },
        "status": {
          "type": "string",
          "enum": [
            "prepared",
            "queued",
            "processing",
            "succeeded",
            "failed",
            "unknown",
            "cancelled"
          ]
        },
        "command": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "operation": {
                  "type": "string",
                  "const": "create_campaign"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "budget": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "daily",
                        "lifetime"
                      ]
                    },
                    "amount_minor": {
                      "type": "string",
                      "pattern": "^[1-9]\\d{0,11}$"
                    }
                  },
                  "required": [
                    "kind",
                    "amount_minor"
                  ]
                },
                "objective": {
                  "type": "string",
                  "enum": [
                    "OUTCOME_AWARENESS",
                    "OUTCOME_ENGAGEMENT",
                    "OUTCOME_LEADS",
                    "OUTCOME_SALES",
                    "OUTCOME_TRAFFIC",
                    "OUTCOME_APP_PROMOTION"
                  ]
                },
                "special_ad_categories": {
                  "default": [],
                  "maxItems": 4,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "CREDIT",
                      "EMPLOYMENT",
                      "HOUSING",
                      "ISSUES_ELECTIONS_POLITICS"
                    ]
                  }
                },
                "status": {
                  "default": "PAUSED",
                  "type": "string",
                  "const": "PAUSED"
                }
              },
              "required": [
                "operation",
                "name",
                "objective",
                "special_ad_categories",
                "status"
              ]
            },
            {
              "type": "object",
              "properties": {
                "operation": {
                  "type": "string",
                  "const": "update_campaign"
                },
                "object_id": {
                  "type": "string",
                  "pattern": "^[1-9]\\d{1,24}$"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "budget": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "daily",
                        "lifetime"
                      ]
                    },
                    "amount_minor": {
                      "type": "string",
                      "pattern": "^[1-9]\\d{0,11}$"
                    }
                  },
                  "required": [
                    "kind",
                    "amount_minor"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "ACTIVE",
                    "PAUSED",
                    "ARCHIVED"
                  ]
                }
              },
              "required": [
                "operation",
                "object_id"
              ]
            },
            {
              "type": "object",
              "properties": {
                "operation": {
                  "type": "string",
                  "const": "create_adset"
                },
                "campaign_id": {
                  "type": "string",
                  "pattern": "^[1-9]\\d{1,24}$"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "budget": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "daily",
                        "lifetime"
                      ]
                    },
                    "amount_minor": {
                      "type": "string",
                      "pattern": "^[1-9]\\d{0,11}$"
                    }
                  },
                  "required": [
                    "kind",
                    "amount_minor"
                  ]
                },
                "targeting": {
                  "type": "object",
                  "properties": {
                    "geo_locations": {
                      "type": "object",
                      "properties": {
                        "countries": {
                          "minItems": 1,
                          "maxItems": 25,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^[A-Z]{2}$"
                          }
                        }
                      },
                      "required": [
                        "countries"
                      ]
                    },
                    "age_min": {
                      "default": 18,
                      "type": "integer",
                      "minimum": 18,
                      "maximum": 65
                    },
                    "age_max": {
                      "default": 65,
                      "type": "integer",
                      "minimum": 18,
                      "maximum": 65
                    },
                    "genders": {
                      "minItems": 1,
                      "maxItems": 2,
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "number",
                            "const": 1
                          },
                          {
                            "type": "number",
                            "const": 2
                          }
                        ]
                      }
                    },
                    "locales": {
                      "maxItems": 25,
                      "type": "array",
                      "items": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "publisher_platforms": {
                      "minItems": 1,
                      "maxItems": 3,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "facebook",
                          "instagram",
                          "threads"
                        ]
                      }
                    },
                    "facebook_positions": {
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "feed",
                          "story",
                          "facebook_reels",
                          "video_feeds"
                        ]
                      }
                    },
                    "instagram_positions": {
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "stream",
                          "story",
                          "reels",
                          "explore"
                        ]
                      }
                    },
                    "threads_positions": {
                      "maxItems": 1,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "const": "threads_stream"
                      }
                    },
                    "custom_audience_ids": {
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[1-9]\\d{1,24}$"
                      }
                    },
                    "excluded_custom_audience_ids": {
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[1-9]\\d{1,24}$"
                      }
                    }
                  },
                  "required": [
                    "geo_locations",
                    "age_min",
                    "age_max",
                    "publisher_platforms"
                  ]
                },
                "billing_event": {
                  "type": "string",
                  "enum": [
                    "IMPRESSIONS",
                    "LINK_CLICKS"
                  ]
                },
                "optimization_goal": {
                  "type": "string",
                  "enum": [
                    "REACH",
                    "IMPRESSIONS",
                    "LINK_CLICKS",
                    "LANDING_PAGE_VIEWS",
                    "OFFSITE_CONVERSIONS",
                    "LEAD_GENERATION"
                  ]
                },
                "bid_strategy": {
                  "default": "LOWEST_COST_WITHOUT_CAP",
                  "type": "string",
                  "const": "LOWEST_COST_WITHOUT_CAP"
                },
                "start_time": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "end_time": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "promoted_object": {
                  "type": "object",
                  "properties": {
                    "page_id": {
                      "type": "string",
                      "pattern": "^[1-9]\\d{1,24}$"
                    },
                    "pixel_id": {
                      "type": "string",
                      "pattern": "^[1-9]\\d{1,24}$"
                    },
                    "custom_event_type": {
                      "type": "string",
                      "enum": [
                        "PURCHASE",
                        "LEAD",
                        "COMPLETE_REGISTRATION",
                        "ADD_TO_CART"
                      ]
                    }
                  }
                },
                "status": {
                  "default": "PAUSED",
                  "type": "string",
                  "const": "PAUSED"
                }
              },
              "required": [
                "operation",
                "campaign_id",
                "name",
                "targeting",
                "billing_event",
                "optimization_goal",
                "bid_strategy",
                "status"
              ]
            },
            {
              "type": "object",
              "properties": {
                "operation": {
                  "type": "string",
                  "const": "update_adset"
                },
                "object_id": {
                  "type": "string",
                  "pattern": "^[1-9]\\d{1,24}$"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "budget": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "daily",
                        "lifetime"
                      ]
                    },
                    "amount_minor": {
                      "type": "string",
                      "pattern": "^[1-9]\\d{0,11}$"
                    }
                  },
                  "required": [
                    "kind",
                    "amount_minor"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "ACTIVE",
                    "PAUSED",
                    "ARCHIVED"
                  ]
                },
                "targeting": {
                  "type": "object",
                  "properties": {
                    "geo_locations": {
                      "type": "object",
                      "properties": {
                        "countries": {
                          "minItems": 1,
                          "maxItems": 25,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^[A-Z]{2}$"
                          }
                        }
                      },
                      "required": [
                        "countries"
                      ]
                    },
                    "age_min": {
                      "default": 18,
                      "type": "integer",
                      "minimum": 18,
                      "maximum": 65
                    },
                    "age_max": {
                      "default": 65,
                      "type": "integer",
                      "minimum": 18,
                      "maximum": 65
                    },
                    "genders": {
                      "minItems": 1,
                      "maxItems": 2,
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "number",
                            "const": 1
                          },
                          {
                            "type": "number",
                            "const": 2
                          }
                        ]
                      }
                    },
                    "locales": {
                      "maxItems": 25,
                      "type": "array",
                      "items": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "publisher_platforms": {
                      "minItems": 1,
                      "maxItems": 3,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "facebook",
                          "instagram",
                          "threads"
                        ]
                      }
                    },
                    "facebook_positions": {
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "feed",
                          "story",
                          "facebook_reels",
                          "video_feeds"
                        ]
                      }
                    },
                    "instagram_positions": {
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "stream",
                          "story",
                          "reels",
                          "explore"
                        ]
                      }
                    },
                    "threads_positions": {
                      "maxItems": 1,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "const": "threads_stream"
                      }
                    },
                    "custom_audience_ids": {
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[1-9]\\d{1,24}$"
                      }
                    },
                    "excluded_custom_audience_ids": {
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[1-9]\\d{1,24}$"
                      }
                    }
                  },
                  "required": [
                    "geo_locations",
                    "age_min",
                    "age_max",
                    "publisher_platforms"
                  ]
                },
                "start_time": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                "end_time": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                }
              },
              "required": [
                "operation",
                "object_id"
              ]
            },
            {
              "type": "object",
              "properties": {
                "operation": {
                  "type": "string",
                  "const": "create_ad"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "adset_id": {
                  "type": "string",
                  "pattern": "^[1-9]\\d{1,24}$"
                },
                "creative_id": {
                  "type": "string",
                  "pattern": "^[1-9]\\d{1,24}$"
                },
                "status": {
                  "default": "PAUSED",
                  "type": "string",
                  "const": "PAUSED"
                }
              },
              "required": [
                "operation",
                "name",
                "adset_id",
                "creative_id",
                "status"
              ]
            },
            {
              "type": "object",
              "properties": {
                "operation": {
                  "type": "string",
                  "const": "update_ad"
                },
                "object_id": {
                  "type": "string",
                  "pattern": "^[1-9]\\d{1,24}$"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "creative_id": {
                  "type": "string",
                  "pattern": "^[1-9]\\d{1,24}$"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "ACTIVE",
                    "PAUSED",
                    "ARCHIVED"
                  ]
                }
              },
              "required": [
                "operation",
                "object_id"
              ]
            },
            {
              "type": "object",
              "properties": {
                "operation": {
                  "type": "string",
                  "const": "create_creative"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "object_story_spec": {
                  "type": "object",
                  "properties": {
                    "page_id": {
                      "type": "string",
                      "pattern": "^[1-9]\\d{1,24}$"
                    },
                    "instagram_user_id": {
                      "type": "string",
                      "pattern": "^[1-9]\\d{1,24}$"
                    },
                    "link_data": {
                      "type": "object",
                      "properties": {
                        "link": {
                          "type": "string",
                          "maxLength": 2048,
                          "format": "uri"
                        },
                        "message": {
                          "type": "string",
                          "maxLength": 5000
                        },
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "image_hash": {
                          "type": "string",
                          "pattern": "^[a-fA-F0-9]{16,128}$"
                        },
                        "call_to_action": {
                          "type": "string",
                          "enum": [
                            "LEARN_MORE",
                            "SHOP_NOW",
                            "SIGN_UP",
                            "CONTACT_US"
                          ]
                        }
                      },
                      "required": [
                        "link",
                        "message",
                        "image_hash"
                      ]
                    }
                  },
                  "required": [
                    "page_id",
                    "link_data"
                  ]
                },
                "object_story_id": {
                  "type": "string",
                  "pattern": "^[1-9]\\d{1,24}_[1-9]\\d{1,24}$"
                }
              },
              "required": [
                "operation",
                "name"
              ]
            },
            {
              "type": "object",
              "properties": {
                "operation": {
                  "type": "string",
                  "const": "create_saved_audience"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "targeting": {
                  "type": "object",
                  "properties": {
                    "geo_locations": {
                      "type": "object",
                      "properties": {
                        "countries": {
                          "minItems": 1,
                          "maxItems": 25,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^[A-Z]{2}$"
                          }
                        }
                      },
                      "required": [
                        "countries"
                      ]
                    },
                    "age_min": {
                      "default": 18,
                      "type": "integer",
                      "minimum": 18,
                      "maximum": 65
                    },
                    "age_max": {
                      "default": 65,
                      "type": "integer",
                      "minimum": 18,
                      "maximum": 65
                    },
                    "genders": {
                      "minItems": 1,
                      "maxItems": 2,
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "number",
                            "const": 1
                          },
                          {
                            "type": "number",
                            "const": 2
                          }
                        ]
                      }
                    },
                    "locales": {
                      "maxItems": 25,
                      "type": "array",
                      "items": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "publisher_platforms": {
                      "minItems": 1,
                      "maxItems": 3,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "facebook",
                          "instagram",
                          "threads"
                        ]
                      }
                    },
                    "facebook_positions": {
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "feed",
                          "story",
                          "facebook_reels",
                          "video_feeds"
                        ]
                      }
                    },
                    "instagram_positions": {
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "stream",
                          "story",
                          "reels",
                          "explore"
                        ]
                      }
                    },
                    "threads_positions": {
                      "maxItems": 1,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "const": "threads_stream"
                      }
                    },
                    "custom_audience_ids": {
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[1-9]\\d{1,24}$"
                      }
                    },
                    "excluded_custom_audience_ids": {
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[1-9]\\d{1,24}$"
                      }
                    }
                  },
                  "required": [
                    "geo_locations",
                    "age_min",
                    "age_max",
                    "publisher_platforms"
                  ]
                }
              },
              "required": [
                "operation",
                "name",
                "targeting"
              ]
            },
            {
              "type": "object",
              "properties": {
                "operation": {
                  "type": "string",
                  "const": "update_saved_audience"
                },
                "object_id": {
                  "type": "string",
                  "pattern": "^[1-9]\\d{1,24}$"
                },
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "targeting": {
                  "type": "object",
                  "properties": {
                    "geo_locations": {
                      "type": "object",
                      "properties": {
                        "countries": {
                          "minItems": 1,
                          "maxItems": 25,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^[A-Z]{2}$"
                          }
                        }
                      },
                      "required": [
                        "countries"
                      ]
                    },
                    "age_min": {
                      "default": 18,
                      "type": "integer",
                      "minimum": 18,
                      "maximum": 65
                    },
                    "age_max": {
                      "default": 65,
                      "type": "integer",
                      "minimum": 18,
                      "maximum": 65
                    },
                    "genders": {
                      "minItems": 1,
                      "maxItems": 2,
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "number",
                            "const": 1
                          },
                          {
                            "type": "number",
                            "const": 2
                          }
                        ]
                      }
                    },
                    "locales": {
                      "maxItems": 25,
                      "type": "array",
                      "items": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "publisher_platforms": {
                      "minItems": 1,
                      "maxItems": 3,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "facebook",
                          "instagram",
                          "threads"
                        ]
                      }
                    },
                    "facebook_positions": {
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "feed",
                          "story",
                          "facebook_reels",
                          "video_feeds"
                        ]
                      }
                    },
                    "instagram_positions": {
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "stream",
                          "story",
                          "reels",
                          "explore"
                        ]
                      }
                    },
                    "threads_positions": {
                      "maxItems": 1,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "const": "threads_stream"
                      }
                    },
                    "custom_audience_ids": {
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[1-9]\\d{1,24}$"
                      }
                    },
                    "excluded_custom_audience_ids": {
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "pattern": "^[1-9]\\d{1,24}$"
                      }
                    }
                  },
                  "required": [
                    "geo_locations",
                    "age_min",
                    "age_max",
                    "publisher_platforms"
                  ]
                }
              },
              "required": [
                "operation",
                "object_id"
              ]
            }
          ]
        },
        "reviewed_digest": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "effects": {
          "type": "object",
          "properties": {
            "creates_object": {
              "type": "boolean"
            },
            "initial_status": {
              "anyOf": [
                {
                  "type": "string",
                  "const": "PAUSED"
                },
                {
                  "type": "null"
                }
              ]
            },
            "activates_delivery": {
              "type": "boolean"
            },
            "changes_budget": {
              "type": "boolean"
            },
            "changes_audience": {
              "type": "boolean"
            },
            "changes_creative": {
              "type": "boolean"
            },
            "currency": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            },
            "timezone": {
              "type": "string",
              "minLength": 1,
              "maxLength": 100
            },
            "budget": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "daily",
                        "lifetime"
                      ]
                    },
                    "amount_minor": {
                      "type": "string",
                      "pattern": "^[1-9]\\d{0,11}$"
                    }
                  },
                  "required": [
                    "kind",
                    "amount_minor"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "creates_object",
            "initial_status",
            "activates_delivery",
            "changes_budget",
            "changes_audience",
            "changes_creative",
            "currency",
            "timezone",
            "budget"
          ]
        },
        "live_approval": {
          "type": "object",
          "properties": {
            "required": {
              "type": "boolean"
            },
            "state": {
              "type": "string",
              "enum": [
                "not_required",
                "missing",
                "approved",
                "expired",
                "revoked",
                "invalid"
              ]
            },
            "reason": {
              "anyOf": [
                {
                  "type": "string",
                  "maxLength": 100
                },
                {
                  "type": "null"
                }
              ]
            },
            "expires_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "approved_by": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "required",
            "state",
            "reason",
            "expires_at",
            "approved_by"
          ]
        },
        "provider_object_id": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^[1-9]\\d{1,24}$"
            },
            {
              "type": "null"
            }
          ]
        },
        "failure_code": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 100
            },
            {
              "type": "null"
            }
          ]
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
        },
        "completed_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "workspace_id",
        "advertising_account_id",
        "mutation_id",
        "status",
        "command",
        "reviewed_digest",
        "effects",
        "live_approval",
        "provider_object_id",
        "failure_code",
        "created_at",
        "completed_at"
      ]
    },
    "replayed": {
      "type": "boolean"
    }
  },
  "required": [
    "contract_version",
    "action",
    "replayed"
  ]
}

錯誤及安全重試

請檢查 HTTP 狀態及實際回應格式。400 驗證錯誤可能回傳 ZodError;handler 錯誤可能採用 error/message/code envelope。請保留可用的 request_id 或 x-request-id,避免記錄憑證。遇到 401/403 時,須先修正存取問題;429 須遵守 Retry-After。寫入結果未明或回傳 5xx 時,請先讀取原有結果,再決定是否重試。只有操作支援時才可重用 idempotency key;並無通用重試或 exactly-once 保證。

問題排解指南

範例

以下虛構值已按 contract 驗證,並非真實帳戶 ID、憑證或發佈紀錄。請以已授權範圍回傳的 ID、已準備完成的素材及已審核排程取代,並在寫入前核對平台資格。此頁不會呼叫 API。

在伺服器環境設定 SOSOAPI_ACCESS_TOKEN,使用此操作接受的憑證。請勿將憑證放入瀏覽器程式。一般 AI Agent 建議透過 sosoapi auth login 使用瀏覽器 OAuth,由 CLI 管理憑證更新。

request.json

{
  "workspace_id": "11111111-1111-4111-8111-111111111111",
  "prepare_token": "exampleaaaaaaaaaaaaaaaaaaaaaaaaa",
  "reviewed_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}

cURL

curl --request POST \
  "https://gqeshlawtcexsapabaui.supabase.co/functions/v1/advertising-api/actions/apply" \
  -H "Authorization: Bearer $SOSOAPI_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  --data-binary @request.json

JavaScript

// Server-side JavaScript. Do not print tokens or credential-bearing responses.
const token = process.env.SOSOAPI_ACCESS_TOKEN;
if (!token) throw new Error("Set an accepted credential for this operation");
const response = await fetch("https://gqeshlawtcexsapabaui.supabase.co/functions/v1/advertising-api/actions/apply", {
  method: "POST",
  headers: { "Content-Type": "application/json", Authorization: "Bearer " + token },
  body: JSON.stringify({
  "workspace_id": "11111111-1111-4111-8111-111111111111",
  "prepare_token": "exampleaaaaaaaaaaaaaaaaaaaaaaaaa",
  "reviewed_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
})
});
const result = await response.json();
// Check response.ok, the operation-specific body and completion state before continuing.

CLI

npx sosoapi api post /advertising-api/actions/apply < request.json

虛構回應範例

{
  "contract_version": "advertising/v1",
  "action": {
    "id": "11111111-1111-4111-8111-111111111111",
    "workspace_id": "11111111-1111-4111-8111-111111111111",
    "advertising_account_id": "11111111-1111-4111-8111-111111111111",
    "mutation_id": "11111111-1111-4111-8111-111111111111",
    "status": "prepared",
    "command": {
      "operation": "create_campaign",
      "name": "example",
      "objective": "OUTCOME_AWARENESS",
      "special_ad_categories": [],
      "status": "PAUSED"
    },
    "reviewed_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "effects": {
      "creates_object": false,
      "initial_status": null,
      "activates_delivery": false,
      "changes_budget": false,
      "changes_audience": false,
      "changes_creative": false,
      "currency": "USD",
      "timezone": "UTC",
      "budget": null
    },
    "live_approval": {
      "required": false,
      "state": "not_required",
      "reason": null,
      "expires_at": null,
      "approved_by": null
    },
    "provider_object_id": null,
    "failure_code": null,
    "created_at": "2099-01-15T09:00:00Z",
    "completed_at": null
  },
  "replayed": false
}

MCP: sosoapi_ads_actions_apply