広告
広告インサイトを検索
日付、タイムゾーン、通貨、アトリビューション期間、コンバージョンアクションを明示し、公式の有料広告実績を件数制限付きで取得します。欠損指標は欠損のままです。
POST /advertising-api/insights/query契約確認日: · sha256:9aedef8d43dd4514
概要
日付、タイムゾーン、通貨、アトリビューション期間、コンバージョンアクションを明示し、公式の有料広告実績を件数制限付きで取得します。欠損指標は欠損のままです。
HTTP成功は完了ではなく受理の場合があります。バックグラウンド処理はIDを保存し、同じ処理を完了まで確認します。予約・受理された投稿はプラットフォーム確認後のみ公開済みです。タイムアウトだけでは結果を判断できません。
認証と権限
トークンは所有者の権利内でのみ使えます。各要求で所属、リソース所有権、選択ワークスペース、付与機能を確認します。coreとfullは表示だけを変え、アクセスは付与しません。
リクエストのフィールド
必須とは、親オブジェクトと選択分岐内で必須という意味です。必須の子があっても任意の親は必須になりません。以下のルールとフィールド名は契約から転記しています。
| フィールド/分岐 | 型/必須 | 制約 |
|---|---|---|
$ | object親要素内で必須 |
|
workspace_id | string親要素内で必須 |
|
advertising_account_id | 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親要素内で必須 |
|
after | string任意/項目 |
|
limit | integer任意/項目 |
|
完全な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)$"
},
"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)$"
},
"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}$"
},
"after": {
"type": "string",
"maxLength": 2048
},
"limit": {
"default": 25,
"type": "integer",
"minimum": 1,
"maximum": 50
}
},
"required": [
"workspace_id",
"advertising_account_id",
"level",
"start_date",
"end_date",
"action_attribution_windows",
"action_report_time",
"conversion_action_type",
"revenue_action_type"
],
"additionalProperties": false
}レスポンスと完了条件
成功時のHTTPステータス: 200. 操作完了時: synchronous_http_response.
HTTP成功は完了ではなく受理の場合があります。バックグラウンド処理はIDを保存し、同じ処理を完了まで確認します。予約・受理された投稿はプラットフォーム確認後のみ公開済みです。タイムアウトだけでは結果を判断できません。
必須とは、親オブジェクトと選択分岐内で必須という意味です。必須の子があっても任意の親は必須になりません。以下のルールとフィールド名は契約から転記しています。
| フィールド/分岐 | 型/必須 | 制約 |
|---|---|---|
$ | 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親要素内で必須 |
|
advertising_account_id | string親要素内で必須 |
|
next_cursor | string | null親要素内で必須 | — |
next_cursoranyOf 1 | string親要素内で必須 |
|
next_cursoranyOf 2 | null親要素内で必須 | — |
完全な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"
]
}
},
"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)$"
},
"next_cursor": {
"anyOf": [
{
"type": "string",
"maxLength": 2048
},
{
"type": "null"
}
]
}
},
"required": [
"contract_version",
"source_id",
"source_sha256",
"identity_verification",
"currency",
"timezone",
"selection",
"complete",
"rows",
"totals",
"gaps",
"suggestions",
"advertising_account_id",
"next_cursor"
]
}エラーと安全な再試行
HTTPステータスとレスポンス本文を確認します。400の検証エラーにはZodErrorが含まれる場合があります。ハンドラーエラーはerror、message、codeを使用します。診断用にrequest_idまたはx-request-idを保持し、認証情報は含めないでください。401/403はアクセス問題を解消してから再試行し、429はRetry-Afterに従います。書き込み結果が不確か、または5xxの場合は、まず既存の結果を取得してください。冪等性キーは対応する操作でのみ再利用します。再試行の挙動は操作ごとに異なり、厳密に一回の配信は保証しません。
トラブルシューティングガイド例
スキーマ確認済みの架空値の例です。認可されたID、準備済みメディア、確認済みの公開日時に置き換え、書き込み前に適格性を確認してください。このページはAPIを呼びません。
サーバーのSOSOAPI_ACCESS_TOKENに操作が受け付ける認証情報を設定し、ブラウザーコードに含めないでください。AIエージェントはsosoapi auth loginでブラウザーログインし、CLIに更新を任せます。
request.json
{
"workspace_id": "11111111-1111-4111-8111-111111111111",
"advertising_account_id": "11111111-1111-4111-8111-111111111111",
"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"
}cURL
curl --request POST \
"https://gqeshlawtcexsapabaui.supabase.co/functions/v1/advertising-api/insights/query" \
-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/insights/query", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: "Bearer " + token },
body: JSON.stringify({
"workspace_id": "11111111-1111-4111-8111-111111111111",
"advertising_account_id": "11111111-1111-4111-8111-111111111111",
"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"
})
});
const result = await response.json();
// Check response.ok, the operation-specific body and completion state before continuing.CLI
npx sosoapi api post /advertising-api/insights/query < 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": [],
"advertising_account_id": "11111111-1111-4111-8111-111111111111",
"next_cursor": null
}