linkfox-amazon-ads-report
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAmazon Ads 报告获取
Amazon Ads Report Retrieval
报告一站式获取:脚本自动完成报告的创建、等待(约 2–10 分钟)、下载和解压,直接返回可读的结构化数据。
脚本本身不做"该选哪些列 / 该怎么分组"的业务判断,这些由 agent 先查 下对应的 文件,再显式传给脚本。
references/report-types/.md依赖 (脚本启动自动检查;未安装时 exit 42,stderr 打 )。
linkfox-amazon-ads-authDEPENDENCY_MISSINGOne-stop report retrieval: The script automatically completes report creation, waiting (about 2–10 minutes), downloading, and decompression, and directly returns readable structured data. The script itself does not make business decisions such as "which columns to select / how to group"; these are first retrieved by the agent from the corresponding file under and then explicitly passed to the script.
.mdreferences/report-types/Depends on (Automatically checked when the script starts; exits with code 42 and outputs to stderr if not installed).
linkfox-amazon-ads-authDEPENDENCY_MISSING⚠️ 多账号场景:调用前必须解析好 profileId
⚠️ Multi-account scenario: Must resolve the profileId before calling
用户经常只说自然语言("美国站"、"日本站"、"我的店铺"),本 skill 的所有脚本都必须拿到数字 才能调。按下列顺序处理,不要跳过:
profileId- 先调 的
linkfox-amazon-ads-auth拉出用户已授权的账号 × 站点清单。authorized_stores.py - 根据用户提到的站点(映射到 ,如 美国→
countryCode)匹配候选 profile:US- 只有 1 个候选 → 静默取对应 profileId,继续调用;不要把 profileId 数字播报给用户。
- ≥ 2 个候选(同站点下多个授权账号) → 必须向用户澄清,用 问:"你在美国站授权了 A 和 B 两个账号,这次用哪个?"
accountName - 0 个候选 → 告知用户该站点未授权,引导去 做授权。
linkfox-amazon-ads-auth
- 严禁让用户直接报 profileId 数字。
- 严禁在歧义下"挑第一个"或"选默认"绕过澄清。
完整决策表见 SKILL.md 的 Usage Scenarios 第 4 节。
linkfox-amazon-ads-authUsers often use natural language (e.g., "US site", "Japan site", "my store"), and all scripts of this skill must obtain the numeric to execute. Follow the steps below in order, do not skip any:
profileId- First call of
authorized_stores.pyto pull the list of user-authorized accounts × sites.linkfox-amazon-ads-auth - Match candidate profiles based on the site mentioned by the user (mapped to , e.g., US→
countryCode):US- Only 1 candidate → Silently take the corresponding profileId and proceed with the call; do not announce the profileId number to the user.
- ≥ 2 candidates (multiple authorized accounts under the same site) → Must clarify with the user, using to ask: "You have authorized accounts A and B for the US site, which one would you like to use this time?"
accountName - 0 candidates → Inform the user that the site is not authorized, and guide them to complete authorization via .
linkfox-amazon-ads-auth
- Strictly prohibit asking users to directly provide the profileId number.
- Strictly prohibit bypassing clarification by "picking the first one" or "selecting default" when there is ambiguity.
The complete decision table can be found in Section 4 of Usage Scenarios in SKILL.md of .
linkfox-amazon-ads-authCore Concepts
Core Concepts
- 覆盖:SP / SB 全部报告类型(以 下存在的
references/report-types/为准;SD / ST / DSP 暂未覆盖).md - 一站式:脚本内部自动完成报告创建 → 等待生成(约 2–10 分钟)→ 下载 → 解压,调用方只需等最终结果
- 单脚本:(覆盖 SP / SB 全部 adProduct)
get_report.py - 元数据 vs. 运行参数:
- 每个报告类型的可用字段(timeUnit / groupBy / filters / 全部列名)集中在
references/report-types/<adProduct-dir>/<reportTypeId>.md - 脚本运行参数(等待间隔、访问链接时效等)见本文件和
references/api.md
- 每个报告类型的可用字段(timeUnit / groupBy / filters / 全部列名)集中在
- Coverage: All report types of SP / SB (based on the files under
.md; SD / ST / DSP are not covered yet)references/report-types/ - One-stop: The script internally and automatically completes report creation → waiting for generation (about 2–10 minutes) → downloading → decompression; the caller only needs to wait for the final result
- Single script: (covers all adProducts of SP / SB)
get_report.py - Metadata vs. Runtime Parameters:
- Available fields (timeUnit / groupBy / filters / all column names) for each report type are centralized in
references/report-types/<adProduct-dir>/<reportTypeId>.md - Script runtime parameters (polling interval, access link validity, etc.) can be found in this document and
references/api.md
- Available fields (timeUnit / groupBy / filters / all column names) for each report type are centralized in
可用脚本
Available Scripts
| 脚本 | 职责 |
|---|---|
| 一站式执行。必填 |
| 检测 linkfox-amazon-ads-auth 是否安装 |
完整脚本参数、响应结构见 。
references/api.md| Script | Responsibility |
|---|---|
| One-stop execution. Required parameters |
| Checks if linkfox-amazon-ads-auth is installed |
Complete script parameters and response structure can be found in .
references/api.mdAgent 调用流程
Agent Calling Flow
Agent 触达"拉取亚马逊广告报告"类需求时,必须按下列顺序:
- 定 reportTypeId:按用户意图挑选(如"上周花费"→ ;"哪个商品卖得好"→
spCampaigns/spAdvertisedProduct;"用户搜什么词找到我"→sbPurchasedProduct)spSearchTerm - 查 reference:打开
references/report-types/<adProduct-dir>/<reportTypeId>.md- frontmatter 给出:/
adProduct(Configuration 表推荐的) /groupBy(可枚举) /timeUnit/format/dateRangefilters - Base metrics 表 给出:此报告类型允许的全部列名
- frontmatter 给出:
- 向用户咨询可定制条件(用户答"默认/随便"时跳过,进入第 4 步的默认选择):
- :DAILY(按日拆分)还是 SUMMARY(汇总)
timeUnit - 扩展:是否要归因列(sales7d / purchases7d / acosClicks7d / roasClicks7d)、视频指标、newToBrand 等
columns - :是否过滤 campaignStatus / keywordType / adStatus 等
filters
- 按用户回复或默认构造 columns(见下节 "默认条件")
- 调脚本:/
adProduct/groupBy三个必填字段显式传入columns
When the Agent receives a request like "pull Amazon Ads reports", must follow the steps below in order:
- Determine reportTypeId: Select based on user intent (e.g., "last week's spend"→ ; "which products sold well"→
spCampaigns/spAdvertisedProduct; "what terms did users search to find me"→sbPurchasedProduct)spSearchTerm - Check reference: Open
references/report-types/<adProduct-dir>/<reportTypeId>.md- frontmatter provides: /
adProduct(recommended in Configuration table) /groupBy(enumerable) /timeUnit/format/dateRangefilters - Base metrics table provides: all column names allowed for this report type
- frontmatter provides:
- Consult user for customizable conditions (skip if user replies "default/whatever" and proceed to default selection in Step 4):
- : DAILY (split by day) or SUMMARY (aggregated)
timeUnit - extension: Whether to add attribution columns (sales7d / purchases7d / acosClicks7d / roasClicks7d), video metrics, newToBrand, etc.
columns - : Whether to filter campaignStatus / keywordType / adStatus, etc.
filters
- Construct columns based on user reply or default conditions (see "Default Conditions" section below)
- Call the script: Explicitly pass in the three required fields /
adProduct/groupBycolumns
默认条件(用户未指定时使用)
Default Conditions (Used when user does not specify)
| 条件 | 默认规则 |
|---|---|
| 日期跨度 ≤ 7 天 → |
| |
| |
| 仅当用户提到"销售/转化/ROI/ACOS"等意图时追加: |
| 不加(全量返回) |
| 取 frontmatter |
| Condition | Default Rule |
|---|---|
| Date range ≤ 7 days → |
| Must include |
| |
| Only add when user mentions intent like "sales/conversion/ROI/ACOS": |
| No filters applied (return full data) |
| Take the first value in the frontmatter |
请求示例
Request Examples
所有 example 都显式传入三个必填字段( / / )。
adProductgroupBycolumnsAll examples explicitly pass in the three required fields ( / / ).
adProductgroupBycolumns1. SP 广告活动报告(最常见)
1. SP Campaign Report (Most Common)
bash
python scripts/get_report.py '{
"profileId": 1234567890, "region": "NA",
"reportTypeId": "spCampaigns",
"adProduct": "SPONSORED_PRODUCTS",
"groupBy": ["campaign"],
"columns": ["date","campaignId","campaignName","impressions","clicks","cost"],
"startDate": "2026-04-27","endDate": "2026-05-03",
"timeUnit": "DAILY"
}'bash
python scripts/get_report.py '{
"profileId": 1234567890, "region": "NA",
"reportTypeId": "spCampaigns",
"adProduct": "SPONSORED_PRODUCTS",
"groupBy": ["campaign"],
"columns": ["date","campaignId","campaignName","impressions","clicks","cost"],
"startDate": "2026-04-27","endDate": "2026-05-03",
"timeUnit": "DAILY"
}'2. SP 搜索词报告(含归因)
2. SP Search Term Report (with Attribution)
bash
python scripts/get_report.py '{
"profileId": 1234567890, "region": "NA",
"reportTypeId": "spSearchTerm",
"adProduct": "SPONSORED_PRODUCTS",
"groupBy": ["searchTerm"],
"columns": ["searchTerm","keyword","matchType","impressions","clicks","cost",
"sales7d","sales14d","purchases7d","acosClicks14d","roasClicks14d",
"startDate","endDate"],
"startDate": "2026-04-01","endDate": "2026-04-30",
"timeUnit": "SUMMARY",
"filters": [{"field":"keywordType","values":["BROAD","PHRASE","EXACT"]}]
}'bash
python scripts/get_report.py '{
"profileId": 1234567890, "region": "NA",
"reportTypeId": "spSearchTerm",
"adProduct": "SPONSORED_PRODUCTS",
"groupBy": ["searchTerm"],
"columns": ["searchTerm","keyword","matchType","impressions","clicks","cost",
"sales7d","sales14d","purchases7d","acosClicks14d","roasClicks14d",
"startDate","endDate"],
"startDate": "2026-04-01","endDate": "2026-04-30",
"timeUnit": "SUMMARY",
"filters": [{"field":"keywordType","values":["BROAD","PHRASE","EXACT"]}]
}'3. SB 广告组报告
3. SB Ad Group Report
bash
python scripts/get_report.py '{
"profileId": 1234567890, "region": "NA",
"reportTypeId": "sbAdGroup",
"adProduct": "SPONSORED_BRANDS",
"groupBy": ["adGroup"],
"columns": ["adGroupId","adGroupName","impressions","clicks","cost","purchases","sales","startDate","endDate"],
"startDate": "2026-04-01","endDate": "2026-04-30"
}'bash
python scripts/get_report.py '{
"profileId": 1234567890, "region": "NA",
"reportTypeId": "sbAdGroup",
"adProduct": "SPONSORED_BRANDS",
"groupBy": ["adGroup"],
"columns": ["adGroupId","adGroupName","impressions","clicks","cost","purchases","sales","startDate","endDate"],
"startDate": "2026-04-01","endDate": "2026-04-30"
}'4. 轮询一个已有 reportId(救回上次超时 / 手工恢复)
4. Poll an Existing reportId (Recover from previous timeout / manual recovery)
当上次运行因为客户端轮询窗口太短退出、但报告在 Amazon 侧仍在跑时,直接传入 即可跳过创建,继续轮询并下载。此模式下只需 / / ,其余字段不必填。
reportIdprofileIdregionreportIdbash
python scripts/get_report.py '{
"profileId": 1234567890, "region": "NA",
"reportId": "7df1ef5d-45ba-40cc-b607-ff2148cf4f5e",
"maxAttempts": 60, "pollInterval": 30
}'自动恢复:如果调用方未传、且 Amazon 对同参数请求触发去重(返回 HTTP 425reportId),脚本会自动解析出老 reportId 并转为轮询该老报告,无需重试。The Request is a duplicate of : <uuid>
When the last run exited due to a too-short client polling window but the report is still being generated on Amazon's side, directly pass in to skip creation and continue polling and downloading. In this mode, only / / are required; other fields are optional.
reportIdprofileIdregionreportIdbash
python scripts/get_report.py '{
"profileId": 1234567890, "region": "NA",
"reportId": "7df1ef5d-45ba-40cc-b607-ff2148cf4f5e",
"maxAttempts": 60, "pollInterval": 30
}'Auto-recovery: If the caller does not passand Amazon triggers deduplication for the same parameter request (returns HTTP 425reportId), the script will automatically parse the old reportId and switch to polling that old report, no retry is needed.The Request is a duplicate of : <uuid>
响应格式
Response Format
成功:
json
{
"success": true,
"reportId": "4ee811a0-...",
"reportTypeId": "spCampaigns",
"startDate": "2026-04-28", "endDate": "2026-05-04",
"downloadPath": "C:/.../tmp/report_data.json",
"extractedFileHttpUrl": "http://127.0.0.1:51234/download",
"extractedFileHttpServeSeconds": 300
}失败:
json
{"error":"Upstream HTTP 400","httpStatus":400,
"body":"{\"code\":\"400\",\"detail\":\"startDate to endDate range (32 days) must not exceed maximum range (31 days)\"}"}Success:
json
{
"success": true,
"reportId": "4ee811a0-...",
"reportTypeId": "spCampaigns",
"startDate": "2026-04-28", "endDate": "2026-05-04",
"downloadPath": "C:/.../tmp/report_data.json",
"extractedFileHttpUrl": "http://127.0.0.1:51234/download",
"extractedFileHttpServeSeconds": 300
}Failure:
json
{"error":"Upstream HTTP 400","httpStatus":400,
"body":"{\"code\":\"400\",\"detail\":\"startDate to endDate range (32 days) must not exceed maximum range (31 days)\"}"}调用原则
Calling Principles
- 用户指定了 reportTypeId 就只拉那一种,不擅自替换
- 报告失败(非 2xx 或 status=FAILED)时如实告知错误原因,不盲目重试
- 成功后把报告的本地文件路径和访问链接完整展示给用户,并提醒访问链接有时效(默认 5 分钟内有效,过期需重新拉取)
- 超时不是失败:当脚本返回 (exit code=2),说明客户端已等满默认 10 分钟但报告仍在 Amazon 侧生成。此时 必须向用户说明情况并询问是否继续等待,绝不能当成失败处理。参考回复:"报告还在 Amazon 侧生成中(已等 10 分钟),要继续等吗?可以选:A. 再等 ~20 分钟(maxAttempts=60)、B. 再等 ~1 小时(maxAttempts=120)、C. 先停,我稍后用 reportId 回来。" 用户选 A/B → 用
status=STILL_PROCESSING切到仅轮询模式续跑resumeHint.params
- Only pull the specified reportTypeId if the user has specified it; do not replace it without permission
- When report generation fails (non-2xx or status=FAILED), truthfully inform the user of the error reason; do not retry blindly
- After success, fully display the local file path and access link of the report to the user, and remind them that the access link has a validity period (valid for 5 minutes by default, need to pull again if expired)
- Timeout is not failure: When the script returns (exit code=2), it means the client has waited the default 10 minutes but the report is still being generated on Amazon's side. At this time, must explain the situation to the user and ask if they want to continue waiting; never treat it as a failure. Reference reply: "The report is still being generated on Amazon's side (waited 10 minutes), do you want to continue waiting? You can choose: A. Wait another ~20 minutes (maxAttempts=60), B. Wait another ~1 hour (maxAttempts=120), C. Stop now, I'll come back with the reportId later." If the user selects A/B → use
status=STILL_PROCESSINGto switch to polling-only mode and continue runningresumeHint.params
常见错误
Common Errors
| 状态 | 含义 | 建议 |
|---|---|---|
| 调用方未显式传入三必填 | 回到 "Agent 调用流程" 第 2 步,从 |
| accessToken 过期 | 调 ads-auth 的 |
| 未关联广告账户或权限不足 | 到 Amazon Ads 后台检查经理账户/广告账户关联 |
| 日期跨度超限(多数 31 天) | 拆分拉取后本地合并;具体上限看对应 |
| 列名拼写错 / 与 reportTypeId 不匹配 / 超出 Base metrics | 对照 |
| 上游生成失败 | 多为日期窗口或权限问题,按 failureReason 具体处理 |
| 客户端轮询窗口耗尽但报告仍在生成 | 不是失败。stdout 已含 |
| 同参数已有在跑的报告 | 脚本自动解析并转为轮询该老 reportId,正常情况下调用方无需干预 |
| exit 42 | 依赖 skill 未安装 | 先装 |
| Status | Meaning | Suggestion |
|---|---|---|
| Caller did not explicitly pass in the three required parameters | Go back to Step 2 of "Agent Calling Flow", read and supplement the parameters from |
| accessToken expired | Call |
| No associated ad account or insufficient permissions | Check the manager account/ad account association in the Amazon Ads backend |
| Date range exceeds limit (most are 31 days) | Split the pull and merge locally; refer to the frontmatter |
| Column name misspelled / does not match reportTypeId / exceeds Base metrics | Check against the Base metrics table in the |
| Upstream generation failed | Mostly due to date window or permission issues; handle according to the specific failureReason |
| Client polling window exhausted but report is still being generated | Not a failure. stdout already contains |
| A report with the same parameters is already running | The script will automatically parse and switch to polling the old reportId; no intervention is needed from the caller under normal circumstances |
| exit 42 | Dependent skill not installed | Install |
日期与数据
Dates and Data
- 日期跨度上限:多数报告 31 天;是 731 天;
sbPurchasedProduct/spGrossAndInvalids/sbGrossAndInvalids是 365 天(以 frontmatter 为准)sdGrossAndInvalids - 回溯窗口:SP 默认 95 天、SB 60 天、GrossAndInvalids 365 天;具体以 frontmatter 为准
dateRange.dataRetentionDays - 数据延迟约 12 小时;脚本 stderr 警告但不拦截
endDate >= 今天 - 空数据不等于报错:账号当期无投放时报告会成功生成,JSON 可能为 或指标全 0
[]
- Date range limit: Most reports allow 31 days; allows 731 days;
sbPurchasedProduct/spGrossAndInvalids/sbGrossAndInvalidsallow 365 days (refer to frontmatter for details)sdGrossAndInvalids - Lookback window: SP defaults to 95 days, SB defaults to 60 days, GrossAndInvalids defaults to 365 days; refer to frontmatter for details
dateRange.dataRetentionDays - Data delay is about 12 hours; the script will output a warning to stderr but not block if
endDate >= today - Empty data does not equal error: If there is no campaign activity in the account during the period, the report will be generated successfully, and the JSON may be or all metrics are 0
[]
Not Applicable
Not Applicable
- Brand Analytics / Retail Analytics / Attribution 报告 → 不在本 skill
- 报告删除 / 修改 / 定时任务 → 不在本 skill
- 实体元数据(campaign 名、keyword 匹配类型等)→
linkfox-amazon-ads-entity - 授权 / token →
linkfox-amazon-ads-auth
Feedback:
Auto-detect and report feedback via the Feedback API when any of the following apply:
- The functionality or purpose described in this skill does not match actual behavior
- The skill's results do not match the user's intent
- The user expresses dissatisfaction or praise about this skill
- Anything you believe could be improved
Call the feedback API as specified in . Do not interrupt the user's flow.
references/api.mdFor more high-quality, professional cross-border e-commerce skills, visit LinkFox Skills.
- Brand Analytics / Retail Analytics / Attribution reports → Not covered by this skill
- Report deletion / modification / scheduled tasks → Not covered by this skill
- Entity metadata (campaign name, keyword match type, etc.) → Handled by
linkfox-amazon-ads-entity - Authorization / token → Handled by
linkfox-amazon-ads-auth
Feedback:
Auto-detect and report feedback via the Feedback API when any of the following apply:
- The functionality or purpose described in this skill does not match actual behavior
- The skill's results do not match the user's intent
- The user expresses dissatisfaction or praise about this skill
- Anything you believe could be improved
Call the feedback API as specified in . Do not interrupt the user's flow.
references/api.mdFor more high-quality, professional cross-border e-commerce skills, visit LinkFox Skills.