APIClaw — Amazon Seller Data Analysis
AI-powered Amazon product research. From market discovery to daily operations.
Language rule: Always respond in the user's language. If the user asks in Chinese, reply in Chinese. If in English, reply in English. The language of this skill document does not affect output language.
All API calls go through scripts/apiclaw.py — one script, 5 endpoints, built-in error handling.
Credentials
- - Required: INLINECODE1
- Scope: used only for INLINECODE2
- Setup: Guide user to set the environment variable:
export APICLAW_API_KEY='hms_live_xxxxxx'
- - Fallback: The script also checks
config.json in the skill root directory if the env var is not set. - Do NOT write keys to disk files. Always recommend the environment variable approach.
- New keys may need 3-5 seconds to activate — if first call returns 403, wait 3 seconds and retry (max 2 retries).
File Map
| File | When to Load |
|---|
| INLINECODE4 (this file) | Start here — covers 80% of tasks |
| INLINECODE5 |
Execute for all API calls (do NOT read into context) |
|
references/reference.md | Need exact field names or filter parameter details |
|
references/scenarios-composite.md | Comprehensive recommendations (2.10) or Chinese seller cases (3.4) |
|
references/scenarios-eval.md | Product evaluation, risk assessment, review analysis (4.x) |
|
references/scenarios-pricing.md | Pricing strategy, profit estimation, listing reference (5.x) |
|
references/scenarios-ops.md | Market monitoring, competitor tracking, anomaly alerts (6.x) |
|
references/scenarios-expand.md | Product expansion, trends, discontinuation decisions (7.x) |
|
references/scenarios-listing.md | Listing writing, optimization, content creation (8.x) |
Don't guess field names — if uncertain, load reference.md first.
Execution Mode
| Task Type | Mode | Behavior |
|---|
| Single ASIN lookup, simple data query | Quick | Execute command, return key data. Skip evaluation criteria and output standard block. |
| Market analysis, product selection, competitor comparison, risk assessment |
Full | Complete flow: command → analysis → evaluation criteria → output standard block. |
Quick mode trigger: User asks for a single specific data point ("B09XXX monthly sales?", "how many brands in cat litter?") — no decision analysis needed.
⚠️ Pre-Execution Checklist (MANDATORY for Full Mode)
Before running any Full-mode product selection or market analysis, complete this checklist:
- - [ ] Step 1 — Mode Selection: Check the Product Selection Mode Mapping table below. If ANY of the 14 preset modes matches the user's intent, USE IT (
--mode xxx). Do NOT manually piece together filters when a preset mode exists. Common mappings:
- Small/lightweight/cheap products →
--mode low-price
- New seller / beginner →
--mode beginner
- Niche / long-tail →
--mode long-tail
- Trending / rising →
--mode emerging
- - [ ] Step 2 — Realtime Supplement: Plan to call
product --asin for the top 3-5 ASINs from results (see Realtime Data Supplementation below). - [ ] Step 3 — Review Analysis: Plan to call
analyze --asins for top ASINs to get consumer insights (especially painPoints, improvements, buyingFactors). - [ ] Step 4 — Output Blocks: Prepare to include both
📋 Data Source & Conditions and 📊 API Usage at the end.
Why this exists: In testing, AI agents repeatedly skipped preset modes, realtime supplements, and review analysis — even though the instructions below clearly describe them. This checklist forces a pause-and-verify before execution.
Execution Standards
Prioritize script execution for API calls. The script includes:
- - Parameter format conversion (e.g. topN auto-converted to string)
- Retry logic (429/timeout auto-retry)
- Standardized error messages
- INLINECODE23 metadata injection (for query traceability)
Fallback: If script fails and can't be quickly fixed, use curl directly. Note "using curl direct call" in output.
Realtime Data Supplementation
When products or competitors returns ASINs in Full-mode analysis, call product --asin for the top 3-5 most relevant ASINs to get current real-time data. For bulk lookups (>3 ASINs), confirm with the user before proceeding.
| Scenario | Supplement? | How many ASINs |
|---|
| Single ASIN lookup (Quick mode) | Already using realtime | — |
| Market overview (no specific ASINs) |
❌ No | — |
| Product selection / competitor analysis | ✅ Yes | Top 3 by sales |
| Risk assessment | ✅ Yes | Target ASIN + top 2 competitors |
| Multi-product comparison | ✅ Yes | All compared ASINs (max 5) |
| Listing analysis | Already using realtime | — |
Handling data conflicts — products/competitors has ~T+1 delay; realtime/product is live:
| Field | Use from | Reason |
|---|
| Price | realtime (buyboxWinner.price) | Changes frequently |
| BSR |
realtime (
bestsellersRank) | Updates hourly |
| Rating / ratingCount |
realtime | More current |
| Monthly Sales |
products/competitors | Realtime doesn't have this |
| Profit Margin / FBA Fee |
products/competitors | Realtime doesn't have this |
When realtime data differs significantly, note it: e.g. "⚡ Price updated: database $29.99 → realtime $24.99 (likely promotion)"
Script Usage
All commands output JSON. Progress messages go to stderr.
categories — Category tree lookup
CODEBLOCK1
Common fields: categoryName (not name), categoryPath, productCount, INLINECODE36
market — Market-level aggregate data
CODEBLOCK2
Key output fields: sampleAvgMonthlySales, sampleAvgPrice, topSalesRate (concentration), topBrandSalesRate, sampleNewSkuRate, sampleFbaRate, INLINECODE43
products — Product selection with filters
CODEBLOCK3
Available modes: fast-movers, emerging, single-variant, high-demand-low-barrier, long-tail, underserved, new-release, fbm-friendly, low-price, broad-catalog, selective-catalog, speculative, beginner, INLINECODE57
Keyword matching: Default is fuzzy (matches brand names too — e.g. "smart ring" matches "Smart Color Art" pens). Use --keyword-match-type exact or phrase for precise results. Always combine with --category when possible to reduce noise.
Category path with commas: Some category names contain commas (e.g. "Pacifiers, Teethers & Teething Relief"). Use > separator instead of , to avoid parsing errors:
CODEBLOCK4
competitors — Competitor lookup
CODEBLOCK5
Easily confused fields (products/competitors shared):
| ❌ Wrong | ✅ Correct | Note |
|---|
| INLINECODE64 | INLINECODE65 | Review count |
| INLINECODE66 |
bsrRank | BSR ranking (integer, only in products/competitors) |
|
monthlySales /
salesMonthly |
atLeastMonthlySales | Monthly sales (lower bound estimate, NOT in realtime/product) |
|
bestsellersRank |
bsrRank |
bestsellersRank is realtime/product only (array format); use
bsrRank for products/competitors |
|
price (in realtime) |
buyboxWinner.price | realtime/product nests price inside buyboxWinner object |
|
profitMargin (in realtime) | ❌ N/A | realtime/product does NOT return profitMargin; use products/competitors |
Complete field list: reference.md → Shared Product Object
product — Single ASIN real-time detail
CODEBLOCK6
Returns: title, brand, rating, ratingBreakdown, features, topReviews, specifications, variants, bestsellersRank, buyboxWinner
analyze — Review analysis (sentiment + consumer insights)
CODEBLOCK7
Returns: totalReviews, avgRating, sentimentDistribution, ratingDistribution, consumerInsights (by labelType), topKeywords, INLINECODE85
Available labelType: scenarios, issues, positives, improvements, buyingFactors, painPoints, keywords, userProfiles, usageTimes, usageLocations, INLINECODE96
report — Full market analysis (composite)
CODEBLOCK8
Runs: categories → market → products (top 50) → realtime detail (top 1).
opportunity — Product opportunity discovery (composite)
CODEBLOCK9
Runs: categories → market → products (filtered) → realtime detail (top 3).
⚠️ Interface Data Differences
The 4 types of interfaces return different fields. Do NOT assume they share the same structure.
| Data | INLINECODE97 | INLINECODE98 / INLINECODE99 | INLINECODE100 | INLINECODE101 |
|---|
| Monthly Sales | INLINECODE102 | ✅ INLINECODE103 | ❌ | ❌ |
| Revenue |
sampleAvgMonthlyRevenue |
salesRevenue | ❌ | ❌ |
| Price |
sampleAvgPrice |
price |
buyboxWinner.price | ❌ |
| BSR |
sampleAvgBsr |
bsrRank (integer) |
bestsellersRank (array) | ❌ |
| Rating |
sampleAvgRating |
rating |
rating |
avgRating |
| Review Count |
sampleAvgReviewCount |
ratingCount |
ratingCount |
totalReviews |
| Review Details | ❌ | ❌ | ✅
topReviews +
ratingBreakdown | ❌ (no raw reviews) |
| Sentiment Analysis | ❌ | ❌ | ❌ | ✅
sentimentDistribution |
| Consumer Insights | ❌ | ❌ | ❌ | ✅
consumerInsights (11 dimensions) |
| Pain Points/Issues | ❌ | ❌ | ❌ (manual from topReviews) | ✅ AI-analyzed |
| Top Keywords | ❌ | ❌ | ❌ | ✅
topKeywords |
| Seller | ❌ |
buyboxSeller (string) |
buyboxWinner (object) | ❌ |
| Profit Margin | ❌ |
profitMargin | ❌ | ❌ |
| FBA Fee | ❌ |
fbaFee | ❌ | ❌ |
| Seller Count | ❌ |
sellerCount | ❌ | ❌ |
| Features/Bullets | ❌ | ❌ | ✅
features | ❌ |
| Variants | ❌ |
variantCount (integer) |
variants (full list) | ❌ |
Usage rule:
- - Use
products / competitors for sales, pricing, and competition data - Use
realtime/product for review details, listing content, and seller info - Use
market for category-level aggregate metrics - Use
reviews/analyze for AI-powered review insights (sentiment, pain points, buying factors — covers all reviews, not just topReviews) - For reports: combine
products/competitors (quantitative) + realtime/product (qualitative) + reviews/analyze (consumer insights) as evidence
Data Structure Reminder
All interfaces return .data as an array. Use .data[0] to get the first record, NOT .data.fieldName.
Intent Routing
| User Says | Run This | Scenario File? |
|---|
| "which category has opportunity" | INLINECODE145 + INLINECODE146 | No |
| "check B09XXX" / "analyze ASIN" |
product --asin XXX | No |
| "Chinese seller cases" |
competitors --keyword XXX --page-size 50 |
scenarios-composite.md → 3.4 |
| "pain points" / "negative reviews" / "consumer insights" |
analyze --asin XXX +
product --asin XXX |
scenarios-eval.md → 4.2 |
| "category pain points" / "category user portrait" |
analyze --category XXX |
scenarios-eval.md → 4.6 |
| "compare products" |
competitors or multiple
product |
scenarios-eval.md → 4.3 |
| "risk assessment" / "can I do this" |
product +
market +
competitors |
scenarios-eval.md → 4.4 |
| "monthly sales" / "estimate sales" |
competitors --asin XXX |
scenarios-eval.md → 4.5 |
| "help me select products" / "find products" |
products --mode XXX (see mode table) | No |
| "comprehensive recommendations" / "what should I sell" |
products (multi-mode) +
market |
scenarios-composite.md → 2.10 |
| "pricing strategy" / "how much to price" |
market +
products |
scenarios-pricing.md → 5.1 |
| "profit estimation" |
competitors |
scenarios-pricing.md → 5.2 |
| "listing reference" |
product --asin XXX |
scenarios-pricing.md → 5.3 |
| "market changes" / "recent changes" |
market +
products |
scenarios-ops.md → 6.1 |
| "competitor updates" |
competitors --brand XXX |
scenarios-ops.md → 6.2 |
| "anomaly alerts" |
market +
products |
scenarios-ops.md → 6.4 |
| "what else can I sell" / "related products" |
categories +
market |
scenarios-expand.md → 7.1 |
| "trends" |
products --growth-min 0.2 |
scenarios-expand.md → 7.3 |
| "should I delist" |
competitors --asin XXX +
market |
scenarios-expand.md → 7.4 |
| "write listing" / "generate bullet points" / "write title" |
product --asin XXX (competitors) |
scenarios-listing.md → 8.2 |
| "analyze competitor listing" / "their selling points" |
product --asin XXX (multiple) |
scenarios-listing.md → 8.1 |
| "optimize my listing" / "listing diagnosis" |
product --asin XXX +
competitors |
scenarios-listing.md → 8.3 |
| Need exact filters or field names | — | Load
reference.md |
Product Selection Mode Mapping (14 types):
| User Intent | Mode | Key Filters |
|---|
| "beginner friendly" / "new seller" | INLINECODE199 | Sales≥300, growth≥3%, $15-60, FBA, ≤1yr, auto-excludes 150+ red ocean keywords |
| "fast turnover" / "hot selling" |
--mode fast-movers | Sales≥300, growth≥10% |
| "emerging" / "rising" |
--mode emerging | Sales≤600, growth≥10%, ≤180d |
| "single variant" / "small but beautiful" |
--mode single-variant | Growth≥20%, variants=1, ≤180d |
| "high demand low barrier" / "easy entry" |
--mode high-demand-low-barrier | Sales≥300, reviews≤50, ≤180d |
| "long tail" / "niche" |
--mode long-tail | Sales≤300, BSR 10K-50K, ≤$30, sellers≤1 |
| "underserved" / "has pain points" |
--mode underserved | Sales≥300, rating≤3.7, ≤180d |
| "new products" / "new release" |
--mode new-release | Sales≤500, NR tag, FBA+FBM |
| "FBM" / "self-fulfillment" / "low stock" |
--mode fbm-friendly | Sales≥300, FBM, ≤180d |
| "low price" / "cheap" |
--mode low-price | ≤$10 |
| "broad catalog" / "cast wide net" |
--mode broad-catalog | BSR growth≥99%, reviews≤10, ≤90d |
| "selective catalog" |
--mode selective-catalog | BSR growth≥99%, ≤90d |
| "speculative" / "piggyback" |
--mode speculative | Sales≥600, sellers≥3, ≤180d |
| "top sellers" / "best sellers" |
--mode top-bsr | Sub-category BSR≤1000 |
Quick Evaluation Criteria
Market Viability (from market output)
| Metric | Good | Medium | Warning |
|---|
| Market value (avgRevenue × skuCount) | > $10M | $5–10M | < $5M |
| Concentration (topSalesRate, topN=10) |
< 40% | 40–60% | > 60% |
| New SKU rate (sampleNewSkuRate) | > 15% | 5–15% | < 5% |
| FBA rate (sampleFbaRate) | > 50% | 30–50% | < 30% |
| Brand count (sampleBrandCount) | > 50 | 20–50 | < 20 |
Product Potential (from product output)
| Metric | High | Medium | Low |
|---|
| BSR | Top 1000 | 1000–5000 | > 5000 |
| Reviews |
< 200 | 200–1000 | > 1000 |
| Rating | > 4.3 | 4.0–4.3 | < 4.0 |
| Negative reviews (1-2★ %) | < 10% | 10–20% | > 20% |
Sales Estimation Fallback
When atLeastMonthlySales is null: Monthly sales ≈ 300,000 / BSR^0.65
⚠️ Output Standards (Full Mode — MANDATORY, DO NOT SKIP)
Two blocks are REQUIRED at the end of every Full-mode analysis: ① Data Source & Conditions, ② API Usage. Missing either one = violating the skill contract.
① Data Source & Conditions (Full Mode Only)
CODEBLOCK10
Rules:
- 1. Every Full-mode analysis MUST end with this block
- Filter conditions MUST list specific parameter values
- If multiple interfaces used, list each one
- If data has limitations, proactively explain
- ⚠️ Self-check: scan your response — if you don't see
📋 **Data Source & Conditions**, ADD IT before replying
⚠️ API Usage Summary (All Modes — MANDATORY, DO NOT SKIP)
This block is NON-NEGOTIABLE. Every single response — Quick or Full mode — MUST end with this table. No exceptions. If you forget, you are violating the skill contract.
CODEBLOCK11
Tracking rules:
- 1. Count each
apiclaw.py execution as 1 call to the corresponding interface - Sum
_credits.consumed from every API response for total consumed - Use
_credits.remaining from the last API response as remaining balance - If
_credits fields are null, show "N/A" - ⚠️ Self-check before sending: scan your response — if you don't see
📊 **API Usage** at the bottom, ADD IT before replying
Limitations
What This Skill Cannot Do
- - Keyword research / reverse ASIN / ABA data
- Traffic source analysis
- Historical sales trends (14-month curves)
- Historical price / BSR charts
- Raw individual review text export (use
realtime/product topReviews for specific review quotes)
API Coverage Boundaries
| Scenario | Coverage | Suggestion |
|---|
| Market data: Popular keywords | ✅ Has data | Use --keyword directly |
| Market data: Niche/long-tail keywords |
⚠️ May be empty | Use
--category instead |
| Product data: Active ASIN | ✅ Has data | — |
| Product data: Delisted/variant ASIN | ❌ No data | Try parent ASIN or realtime |
| Real-time data: US site | ✅ Full support | — |
| Real-time data: Non-US sites | ⚠️ Partial | Core fields OK, sales may be null |
Error Handling
HTTP errors (401/402/403/404/429) are handled by the script with structured JSON output.
Self-check: python3 scripts/apiclaw.py check
| Error | Fix |
|---|
| INLINECODE226 | Use .data[0].fieldName (.data is array) |
| Empty INLINECODE229 |
Use
categories to confirm category exists |
|
atLeastMonthlySales: null | BSR estimate: 300,000 / BSR^0.65 |
技能名称:亚马逊产品研究与卖家分析
详细描述:
APIClaw — 亚马逊卖家数据分析
基于AI的亚马逊产品研究。从市场发现到日常运营。
语言规则:始终以用户的语言回复。如果用户用中文提问,则用中文回复;如果用英文提问,则用英文回复。本技能文档的语言不影响输出语言。
所有API调用均通过 scripts/apiclaw.py 执行——一个脚本,5个端点,内置错误处理。
凭证
- - 必需:APICLAWAPIKEY
- 范围:仅用于 https://api.apiclaw.io
- 设置:引导用户设置环境变量:
bash
export APICLAW
APIKEY=hms
livexxxxxx
- - 备用方案:如果未设置环境变量,脚本也会检查技能根目录中的 config.json 文件。
- 不要将密钥写入磁盘文件。 始终推荐使用环境变量的方式。
- 新密钥可能需要3-5秒激活——如果首次调用返回403,请等待3秒后重试(最多重试2次)。
文件映射
| 文件 | 何时加载 |
|---|
| SKILL.md(本文件) | 从此处开始——覆盖80%的任务 |
| scripts/apiclaw.py |
执行所有API调用(不要读入上下文) |
| references/reference.md | 需要精确的字段名称或筛选参数详情 |
| references/scenarios-composite.md | 综合建议(2.10)或中国卖家案例(3.4) |
| references/scenarios-eval.md | 产品评估、风险评估、评论分析(4.x) |
| references/scenarios-pricing.md | 定价策略、利润估算、Listing参考(5.x) |
| references/scenarios-ops.md | 市场监控、竞争对手追踪、异常警报(6.x) |
| references/scenarios-expand.md | 产品扩展、趋势、下架决策(7.x) |
| references/scenarios-listing.md | Listing撰写、优化、内容创作(8.x) |
不要猜测字段名称——如果不确定,请先加载 reference.md。
执行模式
| 任务类型 | 模式 | 行为 |
|---|
| 单个ASIN查询、简单数据查询 | 快速 | 执行命令,返回关键数据。跳过评估标准和输出标准区块。 |
| 市场分析、选品、竞争对手对比、风险评估 |
完整 | 完整流程:命令 → 分析 → 评估标准 → 输出标准区块。 |
快速模式触发条件: 用户询问单个具体数据点(B09XXX月销量?、猫砂有多少个品牌?)——无需决策分析。
⚠️ 执行前检查清单(完整模式必做)
在执行任何完整模式的选品或市场分析之前,请完成此检查清单:
- - [ ] 步骤1 — 模式选择: 查看下方的选品模式映射表。如果14种预设模式中的任何一种与用户意图匹配,请使用它(--mode xxx)。当存在预设模式时,不要手动拼凑筛选条件。常见映射:
- 小型/轻量/低价产品 → --mode low-price
- 新卖家/新手 → --mode beginner
- 利基/长尾 → --mode long-tail
- 趋势/上升 → --mode emerging
- - [ ] 步骤2 — 实时数据补充: 计划对结果中排名前3-5的ASIN调用 product --asin(参见下方的实时数据补充)。
- [ ] 步骤3 — 评论分析: 计划对排名靠前的ASIN调用 analyze --asins,以获取消费者洞察(尤其是痛点、改进点、购买因素)。
- [ ] 步骤4 — 输出区块: 准备在末尾包含 📋 数据来源与条件 和 📊 API使用情况。
为何存在此清单: 在测试中,AI代理反复跳过预设模式、实时数据补充和评论分析——即使下方说明已清晰描述。此清单强制在执行前暂停并验证。
执行标准
优先执行脚本进行API调用。 脚本包含:
- - 参数格式转换(例如 topN 自动转换为字符串)
- 重试逻辑(429/超时自动重试)
- 标准化错误消息
- _query 元数据注入(用于查询可追溯性)
备用方案: 如果脚本失败且无法快速修复,请直接使用 curl。在输出中注明使用 curl 直接调用。
实时数据补充
当 products 或 competitors 在完整模式分析中返回ASIN时,请对最相关的3-5个ASIN调用 product --asin,以获取当前实时数据。对于批量查询(>3个ASIN),请先与用户确认后再进行。
| 场景 | 补充? | 多少ASIN |
|---|
| 单个ASIN查询(快速模式) | 已在使用实时数据 | — |
| 市场概览(无特定ASIN) |
❌ 否 | — |
| 选品/竞争对手分析 | ✅ 是 | 按销量排名前3 |
| 风险评估 | ✅ 是 | 目标ASIN + 前2名竞争对手 |
| 多产品对比 | ✅ 是 | 所有对比的ASIN(最多5个) |
| Listing分析 | 已在使用实时数据 | — |
处理数据冲突——products/competitors 约有T+1延迟;realtime/product 是实时数据:
| 字段 | 使用来源 | 原因 |
|---|
| 价格 | 实时数据(buyboxWinner.price) | 频繁变化 |
| BSR |
实时数据(bestsellersRank) | 每小时更新 |
| 评分/评分数量 |
实时数据 | 更及时 |
| 月销量 |
products/competitors | 实时数据不包含此字段 |
| 利润率/FBA费用 |
products/competitors | 实时数据不包含此字段 |
当实时数据差异显著时,请注明:例如⚡ 价格已更新:数据库 $29.99 → 实时 $24.99(可能是促销)
脚本使用
所有命令输出JSON。进度消息输出到stderr。
categories — 分类树查询
bash
python3 scripts/apiclaw.py categories --keyword pet supplies
python3 scripts/apiclaw.py categories --parent Pet Supplies
常用字段:categoryName(而非 name)、categoryPath、productCount、hasChildren
market — 市场级聚合数据
bash
python3 scripts/apiclaw.py market --category Pet Supplies,Dogs --topn 10
关键输出字段:sampleAvgMonthlySales、sampleAvgPrice、topSalesRate(集中度)、topBrandSalesRate、sampleNewSkuRate、sampleFbaRate、sampleBrandCount
products — 带筛选条件的选品
bash
预设模式(14种内置)
python3 scripts/apiclaw.py products --keyword yoga mat --mode beginner
显式筛选条件
python3 scripts/apiclaw.py products --keyword yoga mat --sales-min 300 --reviews-max 50
模式 + 覆盖(覆盖优先)
python3 scripts/apiclaw.py products --keyword yoga mat --mode beginner --price-max 30
可用模式:fast-movers、emerging、single-variant、high-demand-low-barrier、long-tail、underserved、new-release、fbm-friendly、low-price、broad-catalog、selective-catalog、speculative、beginner、top-bsr
关键词匹配: 默认为 fuzzy(也会匹配品牌名称——例如smart ring会匹配Smart Color Art笔)。使用 --keyword-match-type exact 或 phrase 以获得精确结果。尽可能与 --category 结合使用以减少噪音。
带逗号的分类路径: 某些分类名称包含逗号(例如Pacifiers, Teethers & Teething Relief)。使用 > 分隔符代替 , 以避免解析错误:
bash
❌ 错误——名称中的逗号会破坏解析
--category Baby Products,Baby Care,Pacifiers, Teethers & Teething Relief
✅ 正确——使用 > 分隔符
--category Baby Products > Baby Care > Pacifiers, Teethers & Teething Relief
competitors — 竞争对手查询
bash
python3 scripts/apiclaw.py competitors --keyword wireless earbuds
python3 scripts/apiclaw.py competitors --asin B09V