廣告
分析廣告成效
使用明確歸因及確切來源雜湊,分析有數量上限的客戶提供付費報表。不會存取平台或聲稱獲利因果關係。
POST /advertising-api/performance/analyzeContract 核對日期: · sha256:9aedef8d43dd4514
概覽
使用明確歸因及確切來源雜湊,分析有數量上限的客戶提供付費報表。不會存取平台或聲稱獲利因果關係。
HTTP 成功只表示本次操作的回應。背景工作須保留回傳 ID,並讀取同一操作,直至達到文件指定的終態。接受請求、排程成功或客戶端逾時,均不代表已發佈。
驗證及權限
憑證不能擴大持有人的權限。實際操作仍會檢查工作空間成員資格、資源擁有權、已選工作空間及能力授權。Tool profile 只會改變可見工具,不會授予權限。
請求欄位
必填表示在所屬物件及所選分支內必須提供;子欄位必填不代表可選的父物件亦變成必填。以下欄位名稱及規則直接來自 contract。
| 欄位/分支 | 類型/必填 | 限制 |
|---|---|---|
$ | object父物件內必填 |
|
workspace_id | string父物件內必填 |
|
source_kind | string父物件內必填 |
|
source_id | string父物件內必填 |
|
provider_api_version | string父物件內必填 |
|
provider_account_id | string父物件內必填 |
|
currency | string父物件內必填 |
|
timezone | string父物件內必填 |
|
level | string父物件內必填 |
|
start_date | string父物件內必填 |
|
end_date | string父物件內必填 |
|
action_attribution_windows | array父物件內必填 |
|
action_attribution_windows[] | string可選/陣列項目 |
|
action_report_time | string父物件內必填 |
|
conversion_action_type | string父物件內必填 |
|
revenue_action_type | string父物件內必填 |
|
complete | boolean父物件內必填 | — |
rows | array父物件內必填 |
|
rows[] | object可選/陣列項目 |
|
rows[].account_id | string父物件內必填 |
|
rows[].account_currency | string父物件內必填 |
|
rows[].campaign_id | string父物件內必填 |
|
rows[].campaign_name | string可選/陣列項目 |
|
rows[].adset_id | string可選/陣列項目 |
|
rows[].ad_id | string可選/陣列項目 |
|
rows[].date_start | string父物件內必填 |
|
rows[].date_stop | string父物件內必填 |
|
rows[].spend | string可選/陣列項目 |
|
rows[].clicks | string可選/陣列項目 |
|
rows[].actions | array可選/陣列項目 |
|
rows[].actions[] | object可選/陣列項目 |
|
rows[].actions[].action_type | string父物件內必填 |
|
rows[].actions[].value | string可選/陣列項目 |
|
rows[].actions[].1d_click | string可選/陣列項目 |
|
rows[].actions[].7d_click | string可選/陣列項目 |
|
rows[].actions[].1d_view | string可選/陣列項目 |
|
rows[].action_values | array可選/陣列項目 |
|
rows[].action_values[] | object可選/陣列項目 |
|
rows[].action_values[].action_type | string父物件內必填 |
|
rows[].action_values[].value | string可選/陣列項目 |
|
rows[].action_values[].1d_click | string可選/陣列項目 |
|
rows[].action_values[].7d_click | string可選/陣列項目 |
|
rows[].action_values[].1d_view | string可選/陣列項目 |
|
完整 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)$"
},
"source_kind": {
"type": "string",
"enum": [
"customer_import",
"official_meta_api"
]
},
"source_id": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"provider_api_version": {
"type": "string",
"const": "v26.0"
},
"provider_account_id": {
"type": "string",
"pattern": "^[1-9]\\d{1,24}$"
},
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"timezone": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"level": {
"type": "string",
"enum": [
"campaign",
"adset",
"ad"
]
},
"start_date": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
},
"end_date": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
},
"action_attribution_windows": {
"minItems": 1,
"maxItems": 1,
"type": "array",
"items": {
"type": "string",
"enum": [
"1d_click",
"7d_click",
"1d_view"
]
}
},
"action_report_time": {
"type": "string",
"enum": [
"impression",
"conversion"
]
},
"conversion_action_type": {
"type": "string",
"pattern": "^[a-z][a-z0-9_.]{0,99}$"
},
"revenue_action_type": {
"type": "string",
"pattern": "^[a-z][a-z0-9_.]{0,99}$"
},
"complete": {
"type": "boolean"
},
"rows": {
"maxItems": 500,
"type": "array",
"items": {
"type": "object",
"properties": {
"account_id": {
"type": "string",
"pattern": "^[1-9]\\d{1,24}$"
},
"account_currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"campaign_id": {
"type": "string",
"pattern": "^[1-9]\\d{1,24}$"
},
"campaign_name": {
"type": "string",
"maxLength": 200
},
"adset_id": {
"type": "string",
"pattern": "^[1-9]\\d{1,24}$"
},
"ad_id": {
"type": "string",
"pattern": "^[1-9]\\d{1,24}$"
},
"date_start": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
},
"date_stop": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
},
"spend": {
"type": "string",
"pattern": "^\\d{1,12}(?:\\.\\d{1,6})?$"
},
"clicks": {
"type": "string",
"pattern": "^\\d{1,15}$"
},
"actions": {
"maxItems": 100,
"type": "array",
"items": {
"type": "object",
"properties": {
"action_type": {
"type": "string",
"pattern": "^[a-z][a-z0-9_.]{0,99}$"
},
"value": {
"type": "string",
"pattern": "^\\d{1,12}(?:\\.\\d{1,6})?$"
},
"1d_click": {
"type": "string",
"pattern": "^\\d{1,12}(?:\\.\\d{1,6})?$"
},
"7d_click": {
"type": "string",
"pattern": "^\\d{1,12}(?:\\.\\d{1,6})?$"
},
"1d_view": {
"type": "string",
"pattern": "^\\d{1,12}(?:\\.\\d{1,6})?$"
}
},
"required": [
"action_type"
],
"additionalProperties": false
}
},
"action_values": {
"maxItems": 100,
"type": "array",
"items": {
"type": "object",
"properties": {
"action_type": {
"type": "string",
"pattern": "^[a-z][a-z0-9_.]{0,99}$"
},
"value": {
"type": "string",
"pattern": "^\\d{1,12}(?:\\.\\d{1,6})?$"
},
"1d_click": {
"type": "string",
"pattern": "^\\d{1,12}(?:\\.\\d{1,6})?$"
},
"7d_click": {
"type": "string",
"pattern": "^\\d{1,12}(?:\\.\\d{1,6})?$"
},
"1d_view": {
"type": "string",
"pattern": "^\\d{1,12}(?:\\.\\d{1,6})?$"
}
},
"required": [
"action_type"
],
"additionalProperties": false
}
}
},
"required": [
"account_id",
"account_currency",
"campaign_id",
"date_start",
"date_stop"
],
"additionalProperties": false
}
}
},
"required": [
"workspace_id",
"source_kind",
"source_id",
"provider_api_version",
"provider_account_id",
"currency",
"timezone",
"level",
"start_date",
"end_date",
"action_attribution_windows",
"action_report_time",
"conversion_action_type",
"revenue_action_type",
"complete",
"rows"
],
"additionalProperties": false
}回應及完成條件
成功 HTTP 狀態碼: 200. 完成依據: synchronous_http_response.
HTTP 成功只表示本次操作的回應。背景工作須保留回傳 ID,並讀取同一操作,直至達到文件指定的終態。接受請求、排程成功或客戶端逾時,均不代表已發佈。
必填表示在所屬物件及所選分支內必須提供;子欄位必填不代表可選的父物件亦變成必填。以下欄位名稱及規則直接來自 contract。
| 欄位/分支 | 類型/必填 | 限制 |
|---|---|---|
$ | object父物件內必填 | — |
contract_version | string父物件內必填 |
|
source_id | string父物件內必填 |
|
source_sha256 | string父物件內必填 |
|
identity_verification | string父物件內必填 |
|
currency | string父物件內必填 |
|
timezone | string父物件內必填 |
|
selection | object父物件內必填 | — |
selection.provider_api_version | string父物件內必填 |
|
selection.provider_account_id | string父物件內必填 |
|
selection.currency | string父物件內必填 |
|
selection.timezone | string父物件內必填 |
|
selection.level | string父物件內必填 |
|
selection.start_date | string父物件內必填 |
|
selection.end_date | string父物件內必填 |
|
selection.action_attribution_windows | array父物件內必填 |
|
selection.action_attribution_windows[] | string可選/陣列項目 |
|
selection.action_report_time | string父物件內必填 |
|
selection.conversion_action_type | string父物件內必填 |
|
selection.revenue_action_type | string父物件內必填 |
|
complete | boolean父物件內必填 | — |
rows | array父物件內必填 |
|
rows[] | object可選/陣列項目 | — |
rows[].row_id | string父物件內必填 |
|
rows[].metrics | object父物件內必填 | — |
rows[].metrics.spend | object父物件內必填 | — |
rows[].metrics.spend.value | string | null父物件內必填 | — |
rows[].metrics.spend.valueanyOf 1 | string父物件內必填 |
|
rows[].metrics.spend.valueanyOf 2 | null父物件內必填 | — |
rows[].metrics.spend.unit | string父物件內必填 |
|
rows[].metrics.spend.availability | string父物件內必填 |
|
rows[].metrics.spend.reason | string | null父物件內必填 | — |
rows[].metrics.spend.reasonanyOf 1 | string父物件內必填 |
|
rows[].metrics.spend.reasonanyOf 2 | null父物件內必填 | — |
rows[].metrics.spend.input_refs | array父物件內必填 |
|
rows[].metrics.spend.input_refs[] | string可選/陣列項目 |
|
rows[].metrics.clicks | object父物件內必填 | — |
rows[].metrics.clicks.value | string | null父物件內必填 | — |
rows[].metrics.clicks.valueanyOf 1 | string父物件內必填 |
|
rows[].metrics.clicks.valueanyOf 2 | null父物件內必填 | — |
rows[].metrics.clicks.unit | string父物件內必填 |
|
rows[].metrics.clicks.availability | string父物件內必填 |
|
rows[].metrics.clicks.reason | string | null父物件內必填 | — |
rows[].metrics.clicks.reasonanyOf 1 | string父物件內必填 |
|
rows[].metrics.clicks.reasonanyOf 2 | null父物件內必填 | — |
rows[].metrics.clicks.input_refs | array父物件內必填 |
|
rows[].metrics.clicks.input_refs[] | string可選/陣列項目 |
|
rows[].metrics.conversions | object父物件內必填 | — |
rows[].metrics.conversions.value | string | null父物件內必填 | — |
rows[].metrics.conversions.valueanyOf 1 | string父物件內必填 |
|
rows[].metrics.conversions.valueanyOf 2 | null父物件內必填 | — |
rows[].metrics.conversions.unit | string父物件內必填 |
|
rows[].metrics.conversions.availability | string父物件內必填 |
|
rows[].metrics.conversions.reason | string | null父物件內必填 | — |
rows[].metrics.conversions.reasonanyOf 1 | string父物件內必填 |
|
rows[].metrics.conversions.reasonanyOf 2 | null父物件內必填 | — |
rows[].metrics.conversions.input_refs | array父物件內必填 |
|
rows[].metrics.conversions.input_refs[] | string可選/陣列項目 |
|
rows[].metrics.attributed_revenue | object父物件內必填 | — |
rows[].metrics.attributed_revenue.value | string | null父物件內必填 | — |
rows[].metrics.attributed_revenue.valueanyOf 1 | string父物件內必填 |
|
rows[].metrics.attributed_revenue.valueanyOf 2 | null父物件內必填 | — |
rows[].metrics.attributed_revenue.unit | string父物件內必填 |
|
rows[].metrics.attributed_revenue.availability | string父物件內必填 |
|
rows[].metrics.attributed_revenue.reason | string | null父物件內必填 | — |
rows[].metrics.attributed_revenue.reasonanyOf 1 | string父物件內必填 |
|
rows[].metrics.attributed_revenue.reasonanyOf 2 | null父物件內必填 | — |
rows[].metrics.attributed_revenue.input_refs | array父物件內必填 |
|
rows[].metrics.attributed_revenue.input_refs[] | string可選/陣列項目 |
|
rows[].metrics.cpc | object父物件內必填 | — |
rows[].metrics.cpc.value | string | null父物件內必填 | — |
rows[].metrics.cpc.valueanyOf 1 | string父物件內必填 |
|
rows[].metrics.cpc.valueanyOf 2 | null父物件內必填 | — |
rows[].metrics.cpc.unit | string父物件內必填 |
|
rows[].metrics.cpc.availability | string父物件內必填 |
|
rows[].metrics.cpc.reason | string | null父物件內必填 | — |
rows[].metrics.cpc.reasonanyOf 1 | string父物件內必填 |
|
rows[].metrics.cpc.reasonanyOf 2 | null父物件內必填 | — |
rows[].metrics.cpc.input_refs | array父物件內必填 |
|
rows[].metrics.cpc.input_refs[] | string可選/陣列項目 |
|
rows[].metrics.cpa | object父物件內必填 | — |
rows[].metrics.cpa.value | string | null父物件內必填 | — |
rows[].metrics.cpa.valueanyOf 1 | string父物件內必填 |
|
rows[].metrics.cpa.valueanyOf 2 | null父物件內必填 | — |
rows[].metrics.cpa.unit | string父物件內必填 |
|
rows[].metrics.cpa.availability | string父物件內必填 |
|
rows[].metrics.cpa.reason | string | null父物件內必填 | — |
rows[].metrics.cpa.reasonanyOf 1 | string父物件內必填 |
|
rows[].metrics.cpa.reasonanyOf 2 | null父物件內必填 | — |
rows[].metrics.cpa.input_refs | array父物件內必填 |
|
rows[].metrics.cpa.input_refs[] | string可選/陣列項目 |
|
rows[].metrics.attributed_roas | object父物件內必填 | — |
rows[].metrics.attributed_roas.value | string | null父物件內必填 | — |
rows[].metrics.attributed_roas.valueanyOf 1 | string父物件內必填 |
|
rows[].metrics.attributed_roas.valueanyOf 2 | null父物件內必填 | — |
rows[].metrics.attributed_roas.unit | string父物件內必填 |
|
rows[].metrics.attributed_roas.availability | string父物件內必填 |
|
rows[].metrics.attributed_roas.reason | string | null父物件內必填 | — |
rows[].metrics.attributed_roas.reasonanyOf 1 | string父物件內必填 |
|
rows[].metrics.attributed_roas.reasonanyOf 2 | null父物件內必填 | — |
rows[].metrics.attributed_roas.input_refs | array父物件內必填 |
|
rows[].metrics.attributed_roas.input_refs[] | string可選/陣列項目 |
|
totals | object父物件內必填 | — |
totals.spend | object父物件內必填 | — |
totals.spend.value | string | null父物件內必填 | — |
totals.spend.valueanyOf 1 | string父物件內必填 |
|
totals.spend.valueanyOf 2 | null父物件內必填 | — |
totals.spend.unit | string父物件內必填 |
|
totals.spend.availability | string父物件內必填 |
|
totals.spend.reason | string | null父物件內必填 | — |
totals.spend.reasonanyOf 1 | string父物件內必填 |
|
totals.spend.reasonanyOf 2 | null父物件內必填 | — |
totals.spend.input_refs | array父物件內必填 |
|
totals.spend.input_refs[] | string可選/陣列項目 |
|
totals.clicks | object父物件內必填 | — |
totals.clicks.value | string | null父物件內必填 | — |
totals.clicks.valueanyOf 1 | string父物件內必填 |
|
totals.clicks.valueanyOf 2 | null父物件內必填 | — |
totals.clicks.unit | string父物件內必填 |
|
totals.clicks.availability | string父物件內必填 |
|
totals.clicks.reason | string | null父物件內必填 | — |
totals.clicks.reasonanyOf 1 | string父物件內必填 |
|
totals.clicks.reasonanyOf 2 | null父物件內必填 | — |
totals.clicks.input_refs | array父物件內必填 |
|
totals.clicks.input_refs[] | string可選/陣列項目 |
|
totals.conversions | object父物件內必填 | — |
totals.conversions.value | string | null父物件內必填 | — |
totals.conversions.valueanyOf 1 | string父物件內必填 |
|
totals.conversions.valueanyOf 2 | null父物件內必填 | — |
totals.conversions.unit | string父物件內必填 |
|
totals.conversions.availability | string父物件內必填 |
|
totals.conversions.reason | string | null父物件內必填 | — |
totals.conversions.reasonanyOf 1 | string父物件內必填 |
|
totals.conversions.reasonanyOf 2 | null父物件內必填 | — |
totals.conversions.input_refs | array父物件內必填 |
|
totals.conversions.input_refs[] | string可選/陣列項目 |
|
totals.attributed_revenue | object父物件內必填 | — |
totals.attributed_revenue.value | string | null父物件內必填 | — |
totals.attributed_revenue.valueanyOf 1 | string父物件內必填 |
|
totals.attributed_revenue.valueanyOf 2 | null父物件內必填 | — |
totals.attributed_revenue.unit | string父物件內必填 |
|
totals.attributed_revenue.availability | string父物件內必填 |
|
totals.attributed_revenue.reason | string | null父物件內必填 | — |
totals.attributed_revenue.reasonanyOf 1 | string父物件內必填 |
|
totals.attributed_revenue.reasonanyOf 2 | null父物件內必填 | — |
totals.attributed_revenue.input_refs | array父物件內必填 |
|
totals.attributed_revenue.input_refs[] | string可選/陣列項目 |
|
totals.cpc | object父物件內必填 | — |
totals.cpc.value | string | null父物件內必填 | — |
totals.cpc.valueanyOf 1 | string父物件內必填 |
|
totals.cpc.valueanyOf 2 | null父物件內必填 | — |
totals.cpc.unit | string父物件內必填 |
|
totals.cpc.availability | string父物件內必填 |
|
totals.cpc.reason | string | null父物件內必填 | — |
totals.cpc.reasonanyOf 1 | string父物件內必填 |
|
totals.cpc.reasonanyOf 2 | null父物件內必填 | — |
totals.cpc.input_refs | array父物件內必填 |
|
totals.cpc.input_refs[] | string可選/陣列項目 |
|
totals.cpa | object父物件內必填 | — |
totals.cpa.value | string | null父物件內必填 | — |
totals.cpa.valueanyOf 1 | string父物件內必填 |
|
totals.cpa.valueanyOf 2 | null父物件內必填 | — |
totals.cpa.unit | string父物件內必填 |
|
totals.cpa.availability | string父物件內必填 |
|
totals.cpa.reason | string | null父物件內必填 | — |
totals.cpa.reasonanyOf 1 | string父物件內必填 |
|
totals.cpa.reasonanyOf 2 | null父物件內必填 | — |
totals.cpa.input_refs | array父物件內必填 |
|
totals.cpa.input_refs[] | string可選/陣列項目 |
|
totals.attributed_roas | object父物件內必填 | — |
totals.attributed_roas.value | string | null父物件內必填 | — |
totals.attributed_roas.valueanyOf 1 | string父物件內必填 |
|
totals.attributed_roas.valueanyOf 2 | null父物件內必填 | — |
totals.attributed_roas.unit | string父物件內必填 |
|
totals.attributed_roas.availability | string父物件內必填 |
|
totals.attributed_roas.reason | string | null父物件內必填 | — |
totals.attributed_roas.reasonanyOf 1 | string父物件內必填 |
|
totals.attributed_roas.reasonanyOf 2 | null父物件內必填 | — |
totals.attributed_roas.input_refs | array父物件內必填 |
|
totals.attributed_roas.input_refs[] | string可選/陣列項目 |
|
gaps | array父物件內必填 |
|
gaps[] | string可選/陣列項目 |
|
suggestions | array父物件內必填 |
|
suggestions[] | object可選/陣列項目 | — |
suggestions[].rule_id | string父物件內必填 |
|
suggestions[].rule_version | number父物件內必填 |
|
suggestions[].proposal | string父物件內必填 |
|
suggestions[].input_refs | array父物件內必填 |
|
suggestions[].input_refs[] | string可選/陣列項目 |
|
suggestions[].limitations | string父物件內必填 |
|
完整 JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"contract_version": {
"type": "string",
"const": "ad-performance/v1"
},
"source_id": {
"type": "string",
"maxLength": 100
},
"source_sha256": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
},
"identity_verification": {
"type": "string",
"enum": [
"customer_supplied",
"accepted_provider_grant"
]
},
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"timezone": {
"type": "string",
"maxLength": 100
},
"selection": {
"type": "object",
"properties": {
"provider_api_version": {
"type": "string",
"const": "v26.0"
},
"provider_account_id": {
"type": "string",
"pattern": "^[1-9]\\d{1,24}$"
},
"currency": {
"type": "string",
"pattern": "^[A-Z]{3}$"
},
"timezone": {
"type": "string",
"maxLength": 100
},
"level": {
"type": "string",
"enum": [
"campaign",
"adset",
"ad"
]
},
"start_date": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
},
"end_date": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
},
"action_attribution_windows": {
"minItems": 1,
"maxItems": 1,
"type": "array",
"items": {
"type": "string",
"enum": [
"1d_click",
"7d_click",
"1d_view"
]
}
},
"action_report_time": {
"type": "string",
"enum": [
"impression",
"conversion"
]
},
"conversion_action_type": {
"type": "string",
"maxLength": 100
},
"revenue_action_type": {
"type": "string",
"maxLength": 100
}
},
"required": [
"provider_api_version",
"provider_account_id",
"currency",
"timezone",
"level",
"start_date",
"end_date",
"action_attribution_windows",
"action_report_time",
"conversion_action_type",
"revenue_action_type"
]
},
"complete": {
"type": "boolean"
},
"rows": {
"maxItems": 500,
"type": "array",
"items": {
"type": "object",
"properties": {
"row_id": {
"type": "string",
"maxLength": 100
},
"metrics": {
"type": "object",
"properties": {
"spend": {
"type": "object",
"properties": {
"value": {
"anyOf": [
{
"type": "string",
"pattern": "^\\d{1,24}(?:\\.\\d{1,6})?$"
},
{
"type": "null"
}
]
},
"unit": {
"type": "string",
"enum": [
"currency",
"count",
"currency_per_click",
"currency_per_conversion",
"ratio"
]
},
"availability": {
"type": "string",
"enum": [
"available",
"missing_input",
"zero_denominator",
"incompatible",
"partial"
]
},
"reason": {
"anyOf": [
{
"type": "string",
"maxLength": 300
},
{
"type": "null"
}
]
},
"input_refs": {
"maxItems": 2000,
"type": "array",
"items": {
"type": "string",
"maxLength": 300
}
}
},
"required": [
"value",
"unit",
"availability",
"reason",
"input_refs"
]
},
"clicks": {
"type": "object",
"properties": {
"value": {
"anyOf": [
{
"type": "string",
"pattern": "^\\d{1,24}(?:\\.\\d{1,6})?$"
},
{
"type": "null"
}
]
},
"unit": {
"type": "string",
"enum": [
"currency",
"count",
"currency_per_click",
"currency_per_conversion",
"ratio"
]
},
"availability": {
"type": "string",
"enum": [
"available",
"missing_input",
"zero_denominator",
"incompatible",
"partial"
]
},
"reason": {
"anyOf": [
{
"type": "string",
"maxLength": 300
},
{
"type": "null"
}
]
},
"input_refs": {
"maxItems": 2000,
"type": "array",
"items": {
"type": "string",
"maxLength": 300
}
}
},
"required": [
"value",
"unit",
"availability",
"reason",
"input_refs"
]
},
"conversions": {
"type": "object",
"properties": {
"value": {
"anyOf": [
{
"type": "string",
"pattern": "^\\d{1,24}(?:\\.\\d{1,6})?$"
},
{
"type": "null"
}
]
},
"unit": {
"type": "string",
"enum": [
"currency",
"count",
"currency_per_click",
"currency_per_conversion",
"ratio"
]
},
"availability": {
"type": "string",
"enum": [
"available",
"missing_input",
"zero_denominator",
"incompatible",
"partial"
]
},
"reason": {
"anyOf": [
{
"type": "string",
"maxLength": 300
},
{
"type": "null"
}
]
},
"input_refs": {
"maxItems": 2000,
"type": "array",
"items": {
"type": "string",
"maxLength": 300
}
}
},
"required": [
"value",
"unit",
"availability",
"reason",
"input_refs"
]
},
"attributed_revenue": {
"type": "object",
"properties": {
"value": {
"anyOf": [
{
"type": "string",
"pattern": "^\\d{1,24}(?:\\.\\d{1,6})?$"
},
{
"type": "null"
}
]
},
"unit": {
"type": "string",
"enum": [
"currency",
"count",
"currency_per_click",
"currency_per_conversion",
"ratio"
]
},
"availability": {
"type": "string",
"enum": [
"available",
"missing_input",
"zero_denominator",
"incompatible",
"partial"
]
},
"reason": {
"anyOf": [
{
"type": "string",
"maxLength": 300
},
{
"type": "null"
}
]
},
"input_refs": {
"maxItems": 2000,
"type": "array",
"items": {
"type": "string",
"maxLength": 300
}
}
},
"required": [
"value",
"unit",
"availability",
"reason",
"input_refs"
]
},
"cpc": {
"type": "object",
"properties": {
"value": {
"anyOf": [
{
"type": "string",
"pattern": "^\\d{1,24}(?:\\.\\d{1,6})?$"
},
{
"type": "null"
}
]
},
"unit": {
"type": "string",
"enum": [
"currency",
"count",
"currency_per_click",
"currency_per_conversion",
"ratio"
]
},
"availability": {
"type": "string",
"enum": [
"available",
"missing_input",
"zero_denominator",
"incompatible",
"partial"
]
},
"reason": {
"anyOf": [
{
"type": "string",
"maxLength": 300
},
{
"type": "null"
}
]
},
"input_refs": {
"maxItems": 2000,
"type": "array",
"items": {
"type": "string",
"maxLength": 300
}
}
},
"required": [
"value",
"unit",
"availability",
"reason",
"input_refs"
]
},
"cpa": {
"type": "object",
"properties": {
"value": {
"anyOf": [
{
"type": "string",
"pattern": "^\\d{1,24}(?:\\.\\d{1,6})?$"
},
{
"type": "null"
}
]
},
"unit": {
"type": "string",
"enum": [
"currency",
"count",
"currency_per_click",
"currency_per_conversion",
"ratio"
]
},
"availability": {
"type": "string",
"enum": [
"available",
"missing_input",
"zero_denominator",
"incompatible",
"partial"
]
},
"reason": {
"anyOf": [
{
"type": "string",
"maxLength": 300
},
{
"type": "null"
}
]
},
"input_refs": {
"maxItems": 2000,
"type": "array",
"items": {
"type": "string",
"maxLength": 300
}
}
},
"required": [
"value",
"unit",
"availability",
"reason",
"input_refs"
]
},
"attributed_roas": {
"type": "object",
"properties": {
"value": {
"anyOf": [
{
"type": "string",
"pattern": "^\\d{1,24}(?:\\.\\d{1,6})?$"
},
{
"type": "null"
}
]
},
"unit": {
"type": "string",
"enum": [
"currency",
"count",
"currency_per_click",
"currency_per_conversion",
"ratio"
]
},
"availability": {
"type": "string",
"enum": [
"available",
"missing_input",
"zero_denominator",
"incompatible",
"partial"
]
},
"reason": {
"anyOf": [
{
"type": "string",
"maxLength": 300
},
{
"type": "null"
}
]
},
"input_refs": {
"maxItems": 2000,
"type": "array",
"items": {
"type": "string",
"maxLength": 300
}
}
},
"required": [
"value",
"unit",
"availability",
"reason",
"input_refs"
]
}
},
"required": [
"spend",
"clicks",
"conversions",
"attributed_revenue",
"cpc",
"cpa",
"attributed_roas"
]
}
},
"required": [
"row_id",
"metrics"
]
}
},
"totals": {
"type": "object",
"properties": {
"spend": {
"type": "object",
"properties": {
"value": {
"anyOf": [
{
"type": "string",
"pattern": "^\\d{1,24}(?:\\.\\d{1,6})?$"
},
{
"type": "null"
}
]
},
"unit": {
"type": "string",
"enum": [
"currency",
"count",
"currency_per_click",
"currency_per_conversion",
"ratio"
]
},
"availability": {
"type": "string",
"enum": [
"available",
"missing_input",
"zero_denominator",
"incompatible",
"partial"
]
},
"reason": {
"anyOf": [
{
"type": "string",
"maxLength": 300
},
{
"type": "null"
}
]
},
"input_refs": {
"maxItems": 2000,
"type": "array",
"items": {
"type": "string",
"maxLength": 300
}
}
},
"required": [
"value",
"unit",
"availability",
"reason",
"input_refs"
]
},
"clicks": {
"type": "object",
"properties": {
"value": {
"anyOf": [
{
"type": "string",
"pattern": "^\\d{1,24}(?:\\.\\d{1,6})?$"
},
{
"type": "null"
}
]
},
"unit": {
"type": "string",
"enum": [
"currency",
"count",
"currency_per_click",
"currency_per_conversion",
"ratio"
]
},
"availability": {
"type": "string",
"enum": [
"available",
"missing_input",
"zero_denominator",
"incompatible",
"partial"
]
},
"reason": {
"anyOf": [
{
"type": "string",
"maxLength": 300
},
{
"type": "null"
}
]
},
"input_refs": {
"maxItems": 2000,
"type": "array",
"items": {
"type": "string",
"maxLength": 300
}
}
},
"required": [
"value",
"unit",
"availability",
"reason",
"input_refs"
]
},
"conversions": {
"type": "object",
"properties": {
"value": {
"anyOf": [
{
"type": "string",
"pattern": "^\\d{1,24}(?:\\.\\d{1,6})?$"
},
{
"type": "null"
}
]
},
"unit": {
"type": "string",
"enum": [
"currency",
"count",
"currency_per_click",
"currency_per_conversion",
"ratio"
]
},
"availability": {
"type": "string",
"enum": [
"available",
"missing_input",
"zero_denominator",
"incompatible",
"partial"
]
},
"reason": {
"anyOf": [
{
"type": "string",
"maxLength": 300
},
{
"type": "null"
}
]
},
"input_refs": {
"maxItems": 2000,
"type": "array",
"items": {
"type": "string",
"maxLength": 300
}
}
},
"required": [
"value",
"unit",
"availability",
"reason",
"input_refs"
]
},
"attributed_revenue": {
"type": "object",
"properties": {
"value": {
"anyOf": [
{
"type": "string",
"pattern": "^\\d{1,24}(?:\\.\\d{1,6})?$"
},
{
"type": "null"
}
]
},
"unit": {
"type": "string",
"enum": [
"currency",
"count",
"currency_per_click",
"currency_per_conversion",
"ratio"
]
},
"availability": {
"type": "string",
"enum": [
"available",
"missing_input",
"zero_denominator",
"incompatible",
"partial"
]
},
"reason": {
"anyOf": [
{
"type": "string",
"maxLength": 300
},
{
"type": "null"
}
]
},
"input_refs": {
"maxItems": 2000,
"type": "array",
"items": {
"type": "string",
"maxLength": 300
}
}
},
"required": [
"value",
"unit",
"availability",
"reason",
"input_refs"
]
},
"cpc": {
"type": "object",
"properties": {
"value": {
"anyOf": [
{
"type": "string",
"pattern": "^\\d{1,24}(?:\\.\\d{1,6})?$"
},
{
"type": "null"
}
]
},
"unit": {
"type": "string",
"enum": [
"currency",
"count",
"currency_per_click",
"currency_per_conversion",
"ratio"
]
},
"availability": {
"type": "string",
"enum": [
"available",
"missing_input",
"zero_denominator",
"incompatible",
"partial"
]
},
"reason": {
"anyOf": [
{
"type": "string",
"maxLength": 300
},
{
"type": "null"
}
]
},
"input_refs": {
"maxItems": 2000,
"type": "array",
"items": {
"type": "string",
"maxLength": 300
}
}
},
"required": [
"value",
"unit",
"availability",
"reason",
"input_refs"
]
},
"cpa": {
"type": "object",
"properties": {
"value": {
"anyOf": [
{
"type": "string",
"pattern": "^\\d{1,24}(?:\\.\\d{1,6})?$"
},
{
"type": "null"
}
]
},
"unit": {
"type": "string",
"enum": [
"currency",
"count",
"currency_per_click",
"currency_per_conversion",
"ratio"
]
},
"availability": {
"type": "string",
"enum": [
"available",
"missing_input",
"zero_denominator",
"incompatible",
"partial"
]
},
"reason": {
"anyOf": [
{
"type": "string",
"maxLength": 300
},
{
"type": "null"
}
]
},
"input_refs": {
"maxItems": 2000,
"type": "array",
"items": {
"type": "string",
"maxLength": 300
}
}
},
"required": [
"value",
"unit",
"availability",
"reason",
"input_refs"
]
},
"attributed_roas": {
"type": "object",
"properties": {
"value": {
"anyOf": [
{
"type": "string",
"pattern": "^\\d{1,24}(?:\\.\\d{1,6})?$"
},
{
"type": "null"
}
]
},
"unit": {
"type": "string",
"enum": [
"currency",
"count",
"currency_per_click",
"currency_per_conversion",
"ratio"
]
},
"availability": {
"type": "string",
"enum": [
"available",
"missing_input",
"zero_denominator",
"incompatible",
"partial"
]
},
"reason": {
"anyOf": [
{
"type": "string",
"maxLength": 300
},
{
"type": "null"
}
]
},
"input_refs": {
"maxItems": 2000,
"type": "array",
"items": {
"type": "string",
"maxLength": 300
}
}
},
"required": [
"value",
"unit",
"availability",
"reason",
"input_refs"
]
}
},
"required": [
"spend",
"clicks",
"conversions",
"attributed_revenue",
"cpc",
"cpa",
"attributed_roas"
]
},
"gaps": {
"maxItems": 1000,
"type": "array",
"items": {
"type": "string",
"maxLength": 300
}
},
"suggestions": {
"maxItems": 3,
"type": "array",
"items": {
"type": "object",
"properties": {
"rule_id": {
"type": "string",
"enum": [
"supply_revenue",
"review_comparable_creative_test",
"complete_coverage"
]
},
"rule_version": {
"type": "number",
"const": 1
},
"proposal": {
"type": "string",
"maxLength": 600
},
"input_refs": {
"maxItems": 2000,
"type": "array",
"items": {
"type": "string",
"maxLength": 300
}
},
"limitations": {
"type": "string",
"const": "Observational comparison only; no causal uplift or profitability claim. Human review required."
}
},
"required": [
"rule_id",
"rule_version",
"proposal",
"input_refs",
"limitations"
]
}
}
},
"required": [
"contract_version",
"source_id",
"source_sha256",
"identity_verification",
"currency",
"timezone",
"selection",
"complete",
"rows",
"totals",
"gaps",
"suggestions"
]
}錯誤及安全重試
請檢查 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",
"source_kind": "customer_import",
"source_id": "example",
"provider_api_version": "v26.0",
"provider_account_id": "12345",
"currency": "USD",
"timezone": "UTC",
"level": "campaign",
"start_date": "2099-01-15",
"end_date": "2099-01-15",
"action_attribution_windows": [
"1d_click"
],
"action_report_time": "impression",
"conversion_action_type": "example",
"revenue_action_type": "example",
"complete": false,
"rows": []
}cURL
curl --request POST \
"https://gqeshlawtcexsapabaui.supabase.co/functions/v1/advertising-api/performance/analyze" \
-H "Authorization: Bearer $SOSOAPI_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
--data-binary @request.jsonJavaScript
// 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/performance/analyze", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: "Bearer " + token },
body: JSON.stringify({
"workspace_id": "11111111-1111-4111-8111-111111111111",
"source_kind": "customer_import",
"source_id": "example",
"provider_api_version": "v26.0",
"provider_account_id": "12345",
"currency": "USD",
"timezone": "UTC",
"level": "campaign",
"start_date": "2099-01-15",
"end_date": "2099-01-15",
"action_attribution_windows": [
"1d_click"
],
"action_report_time": "impression",
"conversion_action_type": "example",
"revenue_action_type": "example",
"complete": false,
"rows": []
})
});
const result = await response.json();
// Check response.ok, the operation-specific body and completion state before continuing.CLI
npx sosoapi api post /advertising-api/performance/analyze < request.json虛構回應範例
{
"contract_version": "ad-performance/v1",
"source_id": "example",
"source_sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"identity_verification": "customer_supplied",
"currency": "USD",
"timezone": "UTC",
"selection": {
"provider_api_version": "v26.0",
"provider_account_id": "12345",
"currency": "USD",
"timezone": "UTC",
"level": "campaign",
"start_date": "2099-01-15",
"end_date": "2099-01-15",
"action_attribution_windows": [
"1d_click"
],
"action_report_time": "impression",
"conversion_action_type": "example",
"revenue_action_type": "example"
},
"complete": false,
"rows": [],
"totals": {
"spend": {
"value": null,
"unit": "currency",
"availability": "available",
"reason": null,
"input_refs": []
},
"clicks": {
"value": null,
"unit": "currency",
"availability": "available",
"reason": null,
"input_refs": []
},
"conversions": {
"value": null,
"unit": "currency",
"availability": "available",
"reason": null,
"input_refs": []
},
"attributed_revenue": {
"value": null,
"unit": "currency",
"availability": "available",
"reason": null,
"input_refs": []
},
"cpc": {
"value": null,
"unit": "currency",
"availability": "available",
"reason": null,
"input_refs": []
},
"cpa": {
"value": null,
"unit": "currency",
"availability": "available",
"reason": null,
"input_refs": []
},
"attributed_roas": {
"value": null,
"unit": "currency",
"availability": "available",
"reason": null,
"input_refs": []
}
},
"gaps": [],
"suggestions": []
}