Amazon Trends API について
Amazon Trends APIは、Python・JavaScriptクライアントまたはHTTP経由で、商品検索関心の推移、成長率、ベストセラー情報を提供します。EC調査向けで、キーワードの履歴データと現在のランキング情報を区別しています。
主な機能
- 01キーワード関心の時系列取得
- 02期間別の成長率測定
- 03リアルタイムのベストセラー情報
- 04カテゴリによるフィード絞り込み
- 05非同期Pythonクライアント
- 06HTTP API経由のアクセス
活用シーン
- 01Amazon商品語の検索関心の追跡
- 02期間ごとのキーワード成長率の比較
- 03現在のベストセラー順位の確認
- 04Pandasによる時系列分析
設定
リモートサーバーはインストール不要です。クライアントを選んで設定をコピーするか、ワンクリックで導入できます。
https://amazon.api.trendsapi.ai/mcpclaude mcp add --transport http ai-trendsapi-amazon https://amazon.api.trendsapi.ai/mcp{"mcpServers":{"ai-trendsapi-amazon":{"type":"http","url":"https://amazon.api.trendsapi.ai/mcp"}}}Cursor で開く{"servers":{"ai-trendsapi-amazon":{"type":"http","url":"https://amazon.api.trendsapi.ai/mcp"}}}VS Code で開く{"mcpServers":{"ai-trendsapi-amazon":{"type":"http","url":"https://amazon.api.trendsapi.ai/mcp"}}}{"mcpServers":{"ai-trendsapi-amazon":{"serverUrl":"https://amazon.api.trendsapi.ai/mcp"}}}コマンドはターミナルで実行し、JSON は各クライアントの MCP 設定に貼り付けて再起動します。認可が必要なサーバーは初回接続時にログインを求めます。
https://amazon.api.trendsapi.ai/mcp認証が必要ツール
詳細
Amazon の商品検索需要 API
Trends API による Amazon の検索関心度とベストセラーフィード。スクレイパーを使わない EC 調査です。
キー:trendsapi.ai/#get-key。HTTP コントラクトとすべてのソース:trendsapi-ai/trendsapi。
認証
pip install trendsapi-amazon
export TRENDSAPI_KEY=your_key
Python 3.9 以降。HTTP API と同じキーを使用します。
from trendsapi_amazon import TrendsAPI
client = TrendsAPI() # TRENDSAPI_KEY
# client = TrendsAPI(api_key="YOUR_KEY")
キーワードヘルパーの既定値は source: "amazon" です。同じクライアントでほかのプラットフォームを利用するには、source= を渡します。公式の完全版クライアント(すべてのソース、プリセットなし):trendsapi。
メソッド
| メソッド | REST mode | 戻り値 |
|---|---|---|
get_time_series(keyword, source=, data_mode=) | get_time_series | list[TrendsDataPoint] |
get_growth(keyword, percent_growth=, source=, data_mode=) | get_growth | GetGrowthResponse |
get_live(limit=, offset=, category=) | get_top_trends | GetTopTrendsResponse |
get_top_trends(type=, ...) | get_top_trends | GetTopTrendsResponse |
source は小文字です(amazon)。type は正確に指定してください(Amazon Best Sellers Top Rated)。両方を混在させると 400 エラーになります。
from trendsapi_amazon import TrendsAPI
client = TrendsAPI() # TRENDSAPI_KEY
# client = TrendsAPI(api_key="YOUR_KEY")
series = client.get_time_series("standing desk")
print(series[-1].date, series[-1].value)
growth = client.get_growth("standing desk", percent_growth=["3M", "12M"])
print(growth.results[0].growth, growth.results[0].direction)
hot = client.get_live(limit=10)
print(hot.data) # [[1, "..."], ...]
get_time_series
points = client.get_time_series("standing desk")
各ポイント:
| フィールド | 常に有無 | 意味 |
|---|---|---|
date | はい | YYYY-MM-DD |
value | はい | この系列の 0~100 の指数 |
keyword | はい | エコー |
volume | いいえ | 利用可能な場合の絶対ボリューム |
source または datatype | いいえ | パイプラインのラベル |
Python では list[TrendsDataPoint] が返されます。["date"] ではなく .date と .value を使用してください。
JS では同じフィールドがオブジェクトプロパティとして返されます。
get_growth
g = client.get_growth("standing desk", percent_growth=["12M", "3M", "YTD"])
print(g.results[0].growth, g.results[0].direction)
percent_growth の既定値:["12M"]。プリセット:7D 14D 30D 1M 2M 3M 6M 9M 12M/1Y 18M 24M/2Y 36M/3Y 48M 60M/5Y MTD QTD YTD。カスタム指定:{"name": "Launch", "recent": "2024-06-01", "baseline": "2024-01-01"}。
| フィールド | 意味 |
|---|---|
search_term | キーワード |
data_source | ソース |
results | 期間ごとに 1 つのオブジェクト(period、growth、direction、日付、値) |
metadata | 件数/成功フラグ |
複数の期間を指定しても、リクエスト数は 1 件としてカウントされます。Python:growth.results[0].growth。JS:growth.results[0].growth。
get_live
hot = client.get_live(limit=10)
| フィールド | 意味 |
|---|---|
as_of_ts | スナップショット時刻 |
type | フィード名 |
limit、offset、count | ページネーション |
data | [rank, label] の行 |
Python:hot.data。JS:hot.data。offset= と category= は任意です(Amazon Best Sellers by Category、Top Websites のみ)。
非同期
import asyncio
from trendsapi_amazon import AsyncTrendsAPI
async def main():
c = AsyncTrendsAPI()
return await asyncio.gather(
c.get_time_series("standing desk"),
c.get_time_series("standing desk", source="google search"),
)
asyncio.run(main())
200 応答ごとに 1 件のリクエストとして課金されます。
Pandas
from dataclasses import asdict
import pandas as pd
from trendsapi_amazon import TrendsAPI
df = pd.DataFrame(asdict(p) for p in TrendsAPI().get_time_series("standing desk"))
df["date"] = pd.to_datetime(df["date"])
print(df.set_index("date")["value"].resample("ME").mean().tail())
JavaScript / TypeScript
npm install trendsapi-amazon
Node 18 以降、Deno、Bun、Workers に対応しています。同じ API キーを使用します。上記のフィールド一覧が適用されます。
メソッド
| メソッド | REST mode | 戻り値 |
|---|---|---|
getTimeSeries(keyword, { source, data_mode }) | get_time_series | 週次ポイント |
getGrowth(keyword, { percent_growth, source, data_mode }) | get_growth | 成長オブジェクト |
getLive({ limit, offset, category }) | get_top_trends | ライブフィード |
getTopTrends({ type, ... }) | get_top_trends | ライブフィード |
import { TrendsAPI } from "trendsapi-amazon";
const client = new TrendsAPI({ apiKey: process.env.TRENDSAPI_KEY! });
const series = await client.getTimeSeries("standing desk");
console.log(series.at(-1)?.date, series.at(-1)?.value);
const growth = await client.getGrowth("standing desk", {
percent_growth: ["3M", "12M"],
});
console.log(growth.results[0].growth, growth.results[0].direction);
const live = await client.getLive({ limit: 10 });
console.log(live.data); // [[1, "..."], ...]
呼び出し(curl)
| フィールド | 値 |
|---|---|
| エンドポイント | POST https://api.trendsapi.ai/api |
| 認証 | Authorization: Bearer $TRENDSAPI_KEY |
| 履歴 | get_time_series または get_growth で source: amazon |
| キーワード | 商品名のフレーズ。例:スタンディングデスク |
ライブ type | Amazon Best Sellers Top Rated、Amazon Best Sellers by Category |
curl -sS -X POST https://api.trendsapi.ai/api \
-H "Authorization: Bearer $TRENDSAPI_KEY" \
-H "Content-Type: application/json" \
-d '{"mode":"get_time_series","source":"amazon","keyword":"standing desk"}'
ソースに関する注意事項
valueは検索関心度を示す 0〜100 の指数であり、販売個数ではありません。- フィードでは現在売れている商品がわかります。キーワード系列では検索されている内容がわかります。
- Google Shopping は別の
source(google shopping)です。
エラー
| HTTP | クライアント |
|---|---|
| 200 | ペイロードを解析しました。Python のデータクラス/JS の型付きオブジェクト |
| 400 | エラーが発生します。source または type の綴りを修正してください |
| 401 | エラーが発生します。TRENDSAPI_KEY を確認してください |
| 404 | エラーが発生します。そのキーワードの系列はありません。再試行しないでください |
| 429 | エラーが発生します。クォータに達しました |
| 5xx | クライアントが再試行した後、エラーが発生します |
HTTP の body フィールドは JSON 文字列です。SDK はこれをデコードします。curl を直接使う場合は、body をもう一度解析する必要があります。
サイト:https://trendsapi.ai/trends/amazon-trends。
ライセンス
MIT。詳細は LICENSE をご覧ください。
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。