> ## Documentation Index
> Fetch the complete documentation index at: https://docs.querying.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Shopping API

> Google Shopping の商品を検索し、商品ページを読み取って JSON で受け取ります。検索結果の順位と価格、評価、レビュー数、販売店、商品ページの価格、在庫、販売者、画像、仕様を返します。

Google Shopping（shopping.google.com）の商品を検索し、商品ページを非同期タスク API で読み取ります。`COMMERCE_SERP` に `site` `google_shopping` を指定すると検索結果の商品をストアの順に受け取り、`COMMERCE_PRODUCT` に商品の `url` を渡すとその商品を 1 つ読み取ります。完了した検索または商品ページ 1 件につき **2 クレジット**です。

## 検索

```bash theme={"theme":"css-variables"}
curl -X POST https://api.querying.ai/v1/async/task \
  -H "Authorization: Bearer $QUERYING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "taskType": "COMMERCE_SERP", "payload": { "site": "google_shopping", "query": "wireless earbuds", "limit": 3 } }'
```

タスクを送信したあと、`GET /v1/async/task/{id}` をポーリングするか Webhook で受け取ります。[非同期タスク](https://docs.querying.ai/ja/concepts/async-tasks.md)を参照してください。

### パラメータ

* `site`: 必須。`google_shopping` です。
* `query`: 必須。検索語で、1-500 文字です。
* `limit`: 任意の整数、1-40。デフォルトは 20 です。
* `country`: 任意。デフォルトはストアの国の `US` です。ほかの国は `422 REGION_UNSUPPORTED` で拒否されます。

受け付けるペイロードフィールドは上記のみです。`include` は省略してください。`include: {}` でも、クレジットを確保する前に `payload.include` の `422 VALIDATION_ERROR` を返します。

### レスポンス例

```json theme={"theme":"css-variables"}
{
  "site": "google_shopping",
  "query": "wireless earbuds",
  "country": "US",
  "returnedCount": 3,
  "products": [
    {
      "rank": 1,
      "productId": "1067219252613399794",
      "title": "JLab Go Air Sport True Wireless Earbuds",
      "url": "https://www.google.com/search?q=wireless+earbuds&udm=28&gl=us&hl=en#product=1067219252613399794&title=JLab+Go+Air+Sport+True+Wireless+Earbuds",
      "price": 9.88,
      "currency": "USD",
      "rating": 4.1,
      "seller": "Walmart"
    },
    {
      "rank": 2,
      "productId": "5295866786049939613",
      "title": "JBL Vibe Beam 2 Noise Cancelling True Wireless Earbuds",
      "url": "https://www.google.com/search?q=wireless+earbuds&udm=28&gl=us&hl=en#product=5295866786049939613&title=JBL+Vibe+Beam+2+Noise+Cancelling+True+Wireless+Earbuds",
      "price": 39.95,
      "currency": "USD",
      "rating": 4.2,
      "seller": "Best Buy",
      "imageUrl": "https://encrypted-tbn0.gstatic.com/shopping?q=tbn:ANd9GcTxk4D_LlWLl4n-ponPRc2ihvXVxc8LIg5CGbLCdzmKDbN8zVii50zLQ0tUpH6TwjuCdY2RS3wRw93no9--JdlU6yG_udswoQ"
    },
    {
      "rank": 3,
      "productId": "549048356659243400",
      "title": "Beats Solo Buds True Wireless Earbuds",
      "url": "https://www.google.com/search?q=wireless+earbuds&udm=28&gl=us&hl=en#product=549048356659243400&title=Beats+Solo+Buds+True+Wireless+Earbuds",
      "price": 69.99,
      "currency": "USD",
      "rating": 3.8,
      "seller": "Target",
      "imageUrl": "https://encrypted-tbn2.gstatic.com/shopping?q=tbn:ANd9GcSQnGg6ee9gh0KOOWZFMqbmbUGjWa3kZ5V5EBOzJjb6JRM9z6TdPAoGlSi5_f6cPsEXle-oiBJ8EJ-FaREc98Wqt8jC8WzmfQ"
    }
  ]
}
```

### 結果フィールド

* `site`、`query`、`country` はリクエストの値です。`returnedCount` は `products` の件数です。
* 各商品は `rank`、`productId`、`title`、`url` を含みます。`productId` は Google の商品 ID で、Google が商品にまとめていない出品はオファー ID です。`rank` はストアのデフォルトの並び順で、ストアが広告と表示した商品は除きます。
* `price`、`rating`、`reviewCount`、`imageUrl`、`seller` は、検索結果の画面に表示されている場合に含みます。`price` は商品ごとの `currency`（ISO 4217）の数値で、容量ごとに価格が異なる場合は最も低い価格です。
* `rating` は 5 点満点です。 999+ のように省略表示されたレビュー数は含みません。 `reviewCount` は、Google が正確な件数（1,000 件未満）を表示する場合だけ含みます。
* 検索ごとに、ストアの検索結果の 1 ページ目から商品を取得します。
* Google のページには商品や販売店のページへのリンクがないため、`url` は商品が表示された Google Shopping の検索結果ページの末尾に `#product={productId}&title={title}` を付けたアドレスです。この `url` を `COMMERCE_PRODUCT` に渡すと、商品の販売店、仕様、説明を読み取ります。`seller` は Google が最初に表示する販売店です。

## 商品ページ

```bash theme={"theme":"css-variables"}
curl -X POST https://api.querying.ai/v1/async/task \
  -H "Authorization: Bearer $QUERYING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "taskType": "COMMERCE_PRODUCT", "payload": { "url": "https://www.google.com/search?q=wireless+earbuds&udm=28&gl=us&hl=en#product=5295866786049939613&title=JBL+Vibe+Beam+2+Noise+Cancelling+True+Wireless+Earbuds" } }'
```

### パラメータ

* `url`: 必須。Google Shopping の検索が返した商品の `url` で、2,048 文字以内です。形式は `google.com/search?q={query}&udm=28&gl={market}#product={productId}&title={title}` です。[Google 検索](https://docs.querying.ai/ja/engines/google-serp.md)、[Google AIによる概要](https://docs.querying.ai/ja/engines/google-ai-overviews.md)、[Google AIモード](https://docs.querying.ai/ja/engines/google-ai-mode.md) の結果にある商品の `productDetailUrl` もそのまま使えます。
* `country`: 任意。デフォルトは `url` の `gl` で、`US`、`GB`、`AU`、`CA`、`KR`、`JP`、`TW`、`HK`、`DE`、`FR`、`ES`、`IT`、`PL`、`PT`、`BR`、`IN`、`ID`、`TH`、`VN` のいずれかです。ほかの国は `422 REGION_UNSUPPORTED` で拒否されます。

受け付けるペイロードフィールドは上記のみです。`include` は省略してください。`include: {}` でも、クレジットを確保する前に `payload.include` の `422 VALIDATION_ERROR` を返します。

### レスポンス例

```json theme={"theme":"css-variables"}
{
  "site": "google_shopping",
  "country": "US",
  "url": "https://www.google.com/search?q=wireless+earbuds&udm=28&gl=us&hl=en#product=5295866786049939613&title=JBL+Vibe+Beam+2+Noise+Cancelling+True+Wireless+Earbuds",
  "productId": "5295866786049939613",
  "title": "JBL Vibe Beam 2 Noise Cancelling True Wireless Earbuds",
  "brand": "JBL",
  "price": 39.95,
  "listPrice": 65,
  "currency": "USD",
  "inStock": true,
  "seller": "Scheels",
  "rating": 4.2,
  "images": [
    "https://encrypted-tbn0.gstatic.com/shopping?q=tbn:ANd9GcTxk4D_LlWLl4n-ponPRc2ihvXVxc8LIg5CGbLCdzmKDbN8zVii50zLQ0tUpH6TwjuCdY2RS3wRw93no9--JdlU6yG_udswoQ",
    "https://encrypted-tbn2.gstatic.com/shopping?q=tbn:ANd9GcQ64EZlooEjcI4GdHBULPySzyZvLSCxjsMi8raMFjbWdZv_KK0cL6P2pIc7nts3uk7G0_XBWBBhVjcuz92sCo2lcDw4hW2H"
  ],
  "description": "The JBL Vibe Beam 2 is a true wireless in-ear earbud system designed to deliver strong audio performance, effective noise control, and seamless everyday usability. Equipped with Bluetooth 5.3, it…",
  "specs": [
    { "name": "Brand", "value": "JBL" },
    { "name": "Noise Canceling", "value": "Yes" },
    { "name": "With Microphone", "value": "Yes" }
  ],
  "offers": [
    {
      "price": 39.95,
      "title": "JBL Vibe Beam 2 headphones",
      "seller": "Scheels",
      "inStock": true,
      "currency": "USD",
      "listPrice": 65
    },
    {
      "url": "https://www.walmart.com/ip/JBL-Vibe-Beam-2-True-Wireless-Noise-Cancelling-In-Ear-Earbuds-Black/21106652379?wmlspartner=wlpa&selectedSellerId=609&veh=seo_fpl&cn=google",
      "price": 39.77,
      "title": "Jbl Vibe Beam 2 True Wireless Noise Cancelling In-Ear Earbuds, Black",
      "seller": "Walmart - Electronics Expo (Authorized Dealer)",
      "inStock": true,
      "currency": "USD"
    }
  ]
}
```

### 結果フィールド

* `site`、`country`、`url`、`productId` でページを識別します。`url` は読み取ったページで、`productId` は検索結果の ID と同じです。
* `title` は常に含みます。`brand`、`price`、`listPrice`、`currency`、`inStock`、`seller`、`rating`、`reviewCount`、`images`、`description`、`specs`、`offers` は、ページに表示されている場合に含みます。
* `price` は、クーポンと送料を適用する前にページが最初に表示する購入価格で、`currency`（ISO 4217）の値です。 `listPrice` はページが取り消し線で表示する通常価格で、`price` より高い場合だけ含みます。 `inStock` は在庫の有無です。 `seller` は販売者です。
* `rating` は小数第 2 位までの 5 点満点の評価です。 `reviewCount` はレビュー数です。 `reviewCount` は、Google が正確な件数（1,000 件未満）を表示する場合だけ含みます。
* `images` は商品ギャラリーの写真を、ページの順に最大 30 枚含みます。
* `description` は段落ごとに 1 行のプレーンテキストで、最大 10,000 文字です。画像の中にしかない文字は含みません。
* `specs` は商品詳細の `{ name, value }` の組を最大 100 個含みます。
* 読み取りでは `url` の検索語をその市場の Google Shopping で再び検索し、Google がその検索語で商品を表示しなくなった場合は商品名で検索して、商品パネルを開きます。そのためストアのページより時間がかかります。どちらの検索にも商品がない場合、タスクは `PAGE_UNAVAILABLE` で終了します。
* `offers` は Google が表示する販売店を、Google が最安値と示す販売店から順に含みます。各販売店には `seller`、`title`（販売店の商品名）、`url`（Google がリンクする場合は販売店の商品ページ）、`price`、`listPrice`、`currency`、`inStock` があります。商品の `price`、`listPrice`、`seller`、`inStock` は最初の販売店のものです。価格は表示言語に関係なく、その市場の Shopping タブの通貨（ISO 4217）です。
* Google AIによる概要や AIモードの商品の `productDetailUrl` は商品名で検索し、結果にその商品の `productDocid` を含みます。

## エラーと課金

* 商品が 1 つもない検索は、失敗したタスクとして終了します。
* 課金は完了したタスクだけで、検索または商品ページ 1 件につき 2 クレジットです。

## 関連

* [Google 検索](https://docs.querying.ai/ja/engines/google-serp.md)
* [Google AIによる概要](https://docs.querying.ai/ja/engines/google-ai-overviews.md)
* [Google AIモード](https://docs.querying.ai/ja/engines/google-ai-mode.md)
* [Commerce のストア一覧](https://docs.querying.ai/ja/engines/overview.md#commerce)
* [クレジットと上限](https://docs.querying.ai/ja/concepts/credits-and-limits.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.