# Target 类别爬虫 API：REST、Python 和 Node | Scrapier (https://scrapier.io/zh/scrapers/target/category/api/)

> 用 cURL、Python 或 Node.js 调用 Target 类别爬虫 REST API。一个 GET，一个请求头，返回类型化 JSON。每次调用 10 积分。失败的调用免费。

Last updated: 2026-11-28

**GET**/api/v2/target-category/

## Target 类别爬虫 _API_

最后更新：2026 年11月 9 日 · REST · JSON

简要回答

发送 `GET https://api.scrapier.io/api/v2/target-category/?urls=https://www.target.com/c/kitchen-dining/-/N-hz89j`，并在 `X-API-Key` 头中放入你的密钥。你会以 JSON 形式拿到这一页商品。每页商品 10 积分；失败的调用免费。

- 每页商品 10 积分
- 失败的调用免费
- 没有速率限制

[获取免费 API 密钥 →](https://app.scrapier.io/sign-up)[跳转到试用区](#playground)

复制给 你的 AI 智能体

API

## 调用 Target 类别爬虫 API

在你自己的应用、脚本或代理中使用 Target 类别爬虫 API。你需要一个 Scrapier 账户，以及仪表盘中的 API 密钥。选择一种语言。

category.py

import requests\# Replace YOUR\_API\_KEY with the key from your Scrapier dashboardAPI\_KEY = "YOUR\_API\_KEY"params = {    "urls": "https://www.target.com/c/kitchen-dining/-/N-hz89j",    "sort\_by": "featured",    "store\_id": "3991",    "zip": "55403",    "enrich\_details": "true",    "include\_sponsored": "false",}r = requests.get(    "https://api.scrapier.io/api/v2/target-category/",    headers={"X-API-Key": API\_KEY},    params=params,    timeout=210,)r.raise\_for\_status()\# The result sits under data.productsresult = r.json()\["data"\]\["products"\]print(result)

### Python 版 Target 类别爬虫 API

只需普通的 `requests`，无需 SDK。每个响应都是类型化 JSON。

安装

**$** pip install requests

其他调用方式

试用区

## Target 类别爬虫 API 交互式试用

编辑请求，观察代码更新，然后运行。没有密钥时它显示目录示例，不计费。使用你的密钥时，它会从浏览器发出真实调用；密钥只会发送到 api.scrapier.io，从不存储。

就绪延迟 **—**已计费积分：**0**

请求已就绪`GET /api/v2/target-category/?urls=https://www.target.com/c/kitchen-dining/-/N-hz89j`

点击**运行请求**发送。没有密钥时你得到的是目录示例。

正在发送请求…

**错误**

失败的调用不计费。

[导入到 Postman](https://docs.scrapier.io/integrations/openapi.md)[OpenAPI 规范](https://api.scrapier.io/api/v2/openapi.json)

无论输入什么，示例都相同：它展示的是响应结构，而不是你输入的账户。

### 示例响应，目录示例，2026 年11月 9 日

{
  "success": true,
  "data": {
    "urls": "https://www.target.com/c/kitchen-dining/contigo/-/N-hz89jZ5v3gb",
    "category\_id": "hz89j",
    "page": 1,
    "page\_size": 24,
    "total\_results": 66,
    "products": \[
      {
        "input\_url": "https://www.target.com/c/kitchen-dining/contigo/-/N-hz89jZ5v3gb",
        "category\_id": "hz89j",
        "facets": "5v3gb",
        "position": 2,
        "page": 1,
        "id": "1004801191",
        "url": "https://www.target.com/p/contigo-cortland-chill-2-0-24oz-stainless-steel-water-bottle-with-autoseal-lid/-/A-1004801191",
        "title": "Contigo Cortland Chill 2.0, 24 oz, Stainless Steel Water Bottle with AUTOSEAL Lid",
        "description": "Press, sip, and seal your way to better hydration. The AUTOSEAL Stainless Steel Water Bottle lets you sip easily with just the push of a button...",
        "seller": "CPGIO",
        "brand": "Contigo",
        "price": {
          "current": 28.49,
          "original": 35,
          "currency": "USD"
        },
        "rating": {
          "average": 4.86,
          "count": 34
        },
        "image\_urls": \[
          "https://target.scene7.com/is/image/Target/GUEST\_779483a4-5e59-473e-93cc-3445e4d35511"
        \],
        "availability": "IN\_STOCK",
        "reviews\_count": 32,
        "features": \[
          "Push AUTOSEAL button for 100% spill-proof one-handed drinking; spout automatically seals when button is released",
          "Double-wall vacuum-insulated stainless steel keeps drinks cold for 24 hours and hot for 6 hours"
        \],
        "scraped\_at": "2026-09-23T11:29:59.623Z"
      }
    \],
    "next\_cursor": "eyJjIjoiaHo4OWoiLCJmIjoiNXYzZ2IiLCJuIjoyNCwibnAiOjIsInAiOjJ9"
  }
}

数据

## 你可以提取的数据

Target 类别爬虫读取一个 Target 类别页面（以类别 URL 或单独的类别 ID 给出），并逐页返回其中的商品。下方每个字段都来自目录中的示例响应，为类型化 JSON。

产品

响应中有 7 个字段。

- id
- url
- title
- description
- brand
- seller
- features

价格、评分和库存

响应中有 4 个字段。

- price
- rating
- reviews\_count
- availability

媒体

响应中有 1 个字段。

- image\_urls

在列表中的位置

响应中有 6 个字段。

- position
- page
- category\_id
- facets
- input\_url
- scraped\_at

响应结构与分页

响应中有 7 个字段。

- success
- data.urls
- data.category\_id
- data.page
- data.page\_size
- data.total\_results
- data.next\_cursor

结构

## 响应结构参考

示例响应中的每个字段。字段名每次调用都保持不变。

| 字段 | 类型 | 示例 | 说明 |
| --- | --- | --- | --- |
| `products.id` | string | `"1004801191"` | 商品 ID（TCIN） |
| `products.url` | string | `"https://www.target.com/p/contigo-cortland-c…"` | 商品页面的 URL |
| `products.title` | string | `"Contigo Cortland Chill 2.0, 24 oz, Stainles…"` | 商品标题 |
| `products.description` | string | `"Press, sip, and seal your way to better hyd…"` | 商品描述文本 |
| `products.brand` | string | `"Contigo"` | 品牌名称 |
| `products.seller` | string | `"CPGIO"` | 卖家名称，例如市场卖家 |
| `products.features` | array | `2 items` | 特点要点列表 |
| `products.price` | object | `{…}` | 包含当前价、原价和币种的对象 |
| `products.rating` | object | `{…}` | 包含平均分和数量的对象 |
| `products.reviews_count` | integer | `32` | 文字评论数量 |
| `products.availability` | string | `"IN_STOCK"` | 库存状态，例如 IN\_STOCK |
| `products.image_urls` | array | `1 items` | 商品的图片链接 |
| `products.position` | integer | `2` | 商品在列表中的位置 |
| `products.page` | integer | `1` | 商品所在的页码 |
| `products.category_id` | string | `"hz89j"` | 商品的类别 ID |
| `products.facets` | string | `"5v3gb"` | 来自输入 URL 的分面筛选代码 |
| `products.input_url` | string | `"https://www.target.com/c/kitchen-dining/con…"` | 读取该商品所用的输入 URL |
| `products.scraped_at` | string | `"2026-09-23T11:29:59.623Z"` | 商品被抓取的时间（ISO 8601） |
| `success` | boolean | `true` | 每个 200 响应都为 true |
| `data.urls` | string | `"https://www.target.com/c/kitchen-dining/con…"` | 你的输入，原样返回 |
| `data.category_id` | string | `"hz89j"` | Target 类别 ID |
| `data.page` | integer | `1` | 本次响应的页码 |
| `data.page_size` | integer | `24` | 每页商品数量 |
| `data.total_results` | integer | `66` | 该查询下类别中的商品总数 |
| `data.next_cursor` | string | `"eyJjIjoiaHo4OWoiLCJmIjoiNXYzZ2IiLCJuIjoyNCw…"` | 作为 cursor 传回即可获取下一页；最后一页为 null |

参数

## 请求参数参考

| 名称 | 类型 | 必填 | 默认值 | 说明 | 示例 |
| --- | --- | --- | --- | --- | --- |
| `urls` | string | 是 | — | Target 分类 URL 或纯分类 ID。每次调用一个。首次调用必填。别名：`url`、`category_url`、`category_id`、`category` | `https://www.target.com/c/kitchen-dining/-/N-hz89j` |
| `cursor` | string | 否 | — | 传回上一个响应的 `data.next_cursor` 以获取下一页；`null` 表示最后一页 | — |
| `sort_by` | string | 否 | `featured` | 排序：`featured`（默认）、`price_low`、`price_high`、`rating`、`bestselling` 或 `newest`。锁定在游标中 | `featured` |
| `store_id` | string | 否 | `3991` | 用于库存的 Target 门店 ID（目录默认 3991）。锁定在游标中 | `3991` |
| `zip` | string | 否 | `55403` | 用于库存的门店邮编（目录默认 55403）。锁定在游标中 | `55403` |
| `enrich_details` | boolean | 否 | `true` | true 或 false：为每个商品添加详情（默认 true）。锁定在游标中 | `true` |
| `include_sponsored` | boolean | 否 | `false` | true 或 false：包含赞助商品（默认 false）。锁定在游标中 | `true` |
| `use_proxy` | boolean | 否 | `true` | 为 true 时使用 Scrapier 的住宅代理池（默认 true）。保持默认 | `true` |
| `raw_data` | boolean | 否 | `false` | 在 `raw_responses` 下返回 Target 的原始上游数据，而不是格式化后的条目 | `true` |

每次调用只接受一个值：要读取十个类别，就调用十次，并用 `cursor` 为每个类别翻页。布尔值是字符串 `true` 或 `false`。

### Target 类别爬虫 API 的分页

Target 类别爬虫 API 分页返回结果。把 `data.next_cursor` 作为 `cursor` 传回即可获取下一页；当它为 `null` 时就没有更多了。每次成功调用，无论首页还是后续页，都消耗 10 积分。

访问

## 无需 Target 登录即可访问

Target 类别爬虫 API 不需要 Target 账户、登录或会话 Cookie。你在 `X-API-Key` 头中发送 Scrapier 密钥，即可得到 JSON。它只读取公开数据：任何访客无需登录就能看到的内容。

性能

## 速度、成本和并发

| 指标 | 数值 | 来源 |
| --- | --- | --- |
| 成功调用的成本 | 10 积分 | Scrapier 目录 |
| 失败调用的成本 | 0 积分 | 任何非 2xx 响应 |
| 每个密钥的并行请求数 | 无限制 | 所有套餐均无速率限制 |
| 建议的客户端超时 | 210 秒 | Scrapier 文档，适用于每个端点 |

### Target 类别爬虫 API 的延迟

Scrapier 不公布该端点的延迟或成功率数据。每次调用都在调用时读取 Target，因此响应时间取决于 Target 和结果的大小。请按文档对所有端点的建议，将客户端超时设为 210 秒。

限制

## 端点的限制

Target 类别爬虫 API 的实际限制。

- 仅限公开数据。
- 失败的调用，例如缺失或不可用的商品页，会返回非 2xx 状态码，且 0 积分。
- 数据在调用时实时读取。
- 没有速率限制，因此需要多少并行请求，就发多少。
- 较大的结果分页返回；把 `data.next_cursor` 作为 `cursor` 传回。
- Target 没有显示的字段不会返回。

对比

## Scrapier 与 Target 官方 API 对比

只有当你需要 Target 登录后才能看到的数据，或想自己控制每个请求时，自建才是更好的选择。

| 功能 | Scrapier {unit} 爬虫 | 自建 Target 爬虫 |
| --- | --- | --- |
| 所需权限 | 一个 Scrapier API 密钥 | 代理、请求头，以及应对封锁的方法 |
| 你能得到什么 | 一页类别商品，含价格、评分和库存 | 取决于你为哪些内容编写解析器 |
| 返回的字段 | 每个条目 18 个字段，每次调用命名都相同 | 需要你自己提取并不断修复的字段 |
| 速率限制 | 无：需要多少并行请求，就发多少 | 取决于你的代理能承载多少流量 |
| 设置 | 注册，复制密钥，发送请求 | 搭建、托管并监控一个爬虫 |
| 成本 | 每次调用 10 积分，每 1,000 次调用低至 $1.20 | 代理、服务器和维护时间 |

错误

## 错误与重试处理

| 状态 | 含义 | 是否计费 | 解决办法 |
| --- | --- | --- | --- |
| 200 | 商品页数据在 `data.products` 中返回 | 是 | — |
| 400 | 输入有误或缺失 | 否 | 请检查 `urls`：每次调用一个值 |
| 401 | 缺少 `X-API-Key` 请求头 | 否 | 添加该请求头 |
| 402 | 积分用完（响应体含 `balance`） | 否 | 充值；重试无济于事 |
| 403 | API 密钥无效或已撤销 | 否 | 在控制台中检查密钥 |
| 429 | 被限流 | 否 | 等待 `Retry-After` 秒后重试 |
| 5xx | 上游故障或超时 | 否 | 退避重试；把客户端超时设为 210 s |

来自[错误参考](https://docs.scrapier.io/errors/)。任何非 2xx 响应消耗 0 积分。

### Target 类别爬虫 API 的重试逻辑

retry.py

import time, requests

def get\_category(value, key, tries=5):
    for attempt in range(tries):
        r = requests.get(
            "https://api.scrapier.io/api/v2/target-category/",
            headers={"X-API-Key": key},
            params={"urls": value},
            timeout=210,
        )
        if r.status\_code == 429:
            time.sleep(int(r.headers.get("Retry-After", 2 \*\* attempt)))
        elif r.status\_code >= 500:
            time.sleep(2 \*\* attempt)
        else:
            r.raise\_for\_status()
            return r.json()
    raise RuntimeError("gave up after retries")

价格

## 价格与速率限制

| 套餐 | 月费 | 包含的商品页数 | 每 1,000 次成本 |
| --- | --- | --- | --- |
| Hobby | $29 | 15,000 | $1.93 |
| Pro | $79 | 50,000 | $1.58 |
| Scale | $299 | 250,000 | $1.20 |

[查看所有套餐 →](https://scrapier.io/zh/pricing/)

### Target 类别爬虫 API 的计费规则

Target Category Scraper API 按每个成功获取的商品页收取 10 积分。失败的调用（即任何非 2xx 状态）消耗 0 积分。所有套餐都没有速率限制。付费前可以先用免费额度试用。

批量

## 批量查询与 CSV

`urls` 每次调用只接受一个值。对于列表，循环并行调用（没有速率限制），然后把每一行展平为一行 CSV。

bulk.py

import csv, requests
from concurrent.futures import ThreadPoolExecutor

values = \["https://www.target.com/c/kitchen-dining/-/N-hz89j"\]  \# your list

def fetch(value):
    r = requests.get(
        "https://api.scrapier.io/api/v2/target-category/",
        headers={"X-API-Key": "YOUR\_API\_KEY"},
        params={"urls": value},
        timeout=210,
    )
    r.raise\_for\_status()
    out = r.json()\["data"\]\["products"\]
    return out if isinstance(out, list) else \[out\]

\# no rate limits: use as many workers as you need
with ThreadPoolExecutor(max\_workers=3) as pool:
    rows = \[row for part in pool.map(fetch, values) for row in part\]

cols = \["id", "title", "brand", "seller", "availability", "reviews\_count"\]
with open("out.csv", "w", newline="") as f:
    w = csv.DictWriter(f, fieldnames=cols, extrasaction="ignore")
    w.writeheader()
    w.writerows(rows)

### 从 Target 类别爬虫 API 导出 CSV

out.csv目录示例 · 1 行

id,title,brand,seller,availability,reviews\_count
1004801191,Contigo Cortland Chill 2.0, 24 oz, Stainless Steel Water Bottle with AUTOSEAL Lid,Contigo,CPGIO,IN\_STOCK,32

智能体

## 通过 MCP 供 AI 智能体访问

### Target 类别爬虫 API 的 MCP

AI 代理也可以通过 `https://mcp.scrapier.io/mcp` 的 Scrapier MCP 服务器使用同一个端点。一条命令即可在 Claude Code 中注册：`claude mcp add -t http scrapier https://mcp.scrapier.io/mcp --header "X-API-Key: YOUR_API_KEY"`。代理用 `search_endpoints` 找到该端点，再用 `run_scrape` 和端点 id `target-category` 调用它。它接受相同的 `urls` 输入，每页商品同样消耗 10 积分。各客户端的设置见 [Target 类别爬虫 MCP 页面](https://scrapier.io/zh/scrapers/target/category/mcp/)。

集成

## 按角色划分的集成路径

无代码

### n8n 和 Make

1. 添加一个 HTTP Request 步骤
2. 带上你的 `X-API-Key` 请求头，对该端点发送 GET
3. 把 `data.products` 字段映射到你的列

开发者

### 循环并翻页

for value in values: rows += get(value) while cur := page\["data"\]\["next\_cursor"\]: page = get(cursor=cur)

AI 智能体

### 智能体中的 MCP 工具

在 Claude、Cursor 或 Windsurf 中，用端点 `target-category` 调用 `run_scrape`。设置方法见 [MCP 页面](https://scrapier.io/zh/scrapers/target/category/mcp/)。

分析师

### CSV 和展平的 JSON

把每一行展平为一行 CSV，每个字段一列，可直接用于 Sheets、Excel 或 BI 工具。

法律

## 法律与合规说明

在许多国家，抓取公开可得的 Target 数据通常是合法的，但答案取决于你收集什么、你身处何地以及如何使用。在美国，关于公开数据抓取最常被引用的案例是 hiQ Labs v. LinkedIn。Scrapier 只返回任何访客无需登录即可看到的公开商品列表。根据 GDPR 及类似法律，可以收集公开数据，但你如何存储和使用个人数据（例如评论者姓名）仍须遵守当地数据保护规定，并且 Target 的条款同样适用。如果你的用例涉及大量存储个人数据，请咨询法律顾问。这不构成法律意见；请参阅我们的[使用条款](https://scrapier.io/zh/terms/)。

常见问题

## 常见问题

### 有 Target 商品页 API 吗？

有。Scrapier's Target 类别爬虫 API 只需一个 GET 请求和一个 X-API-Key 头，就能以 JSON 返回任何公开商品页。无需 Target 应用或登录。

### 如何从 Python 调用？

对 \<code>https://api.scrapier.io/api/v2/target-category/\</code> 使用 \<code>requests.get\</code>，传入 \<code>params={'urls': 'https://www.target.com/c/kitchen-dining/-/N-hz89j'}\</code> 和 \<code>headers={"X-API-Key": KEY}\</code>。读取 \<code>r.json()\["data"\]\["products"\]\</code>。

### 调用失败时会怎样？

任何非 200 响应都免费。对 429 和 5xx 请退避重试；API 已经会重试上游故障。

### 多少钱？

每次成功调用 10 积分，在 Pro 套餐下每 1,000 页商品约 $1.58。失败的调用免费。

### 有 OpenAPI 规范吗？

有。获取它无需密钥，并且涵盖每个 Scrapier 端点。

相关

## 相关的 Target API

[### 单个商品 API

按 URL 或 TCIN 获取一个商品：价格、评分分布、属性、变体和库存。](https://scrapier.io/zh/scrapers/target/product/)[### 评论 API

一个商品的评论，每页 50 条，含评分汇总、已验证标记和情感标签。](https://scrapier.io/zh/scrapers/target/reviews/)[### 门店 API

某个邮编、城市或州附近的 Target 门店：地址、电话、营业时间、距离和坐标。](https://scrapier.io/zh/scrapers/target/stores/)[### 全部 Target API

全部 5 个 Target 端点。](https://scrapier.io/zh/scrapers/target/)

## 一次请求，以类型化 JSON 获取 Target 公开商品页

每页商品 10 积分 · 失败调用免费

[获取免费 API 密钥 →](https://app.scrapier.io/sign-up)

---
Canonical page: https://scrapier.io/zh/scrapers/target/category/api/
Site index for AI agents: https://scrapier.io/llms.txt
