---
title: "Categories"
description: "列出 Amazon 类目树的一层：各部门，或某个类目的子类目。"
---

> Every apinoa docs page as markdown: https://apinoa.com/llms.txt (all in one file: https://apinoa.com/llms-full.txt; this API family in one file: https://apinoa.com/docs/marketplace/llms.txt)

```http
GET | POST /v1/amazon/categories
```

参数可以用 `GET` 的查询字符串发送，也可以用 `POST` 的 JSON 请求体发送，两者等价。

## 请求

```bash tab="cURL"
curl "https://gateway.apinoa.com/v1/amazon/categories" \
  -H "x-api-key: $APINOA_API_KEY"
```

```js tab="JavaScript"
const res = await fetch("https://gateway.apinoa.com/v1/amazon/categories", {
  headers: { "x-api-key": process.env.APINOA_API_KEY },
});
const { success, data, error } = await res.json();
```

```python tab="Python"
import os

import requests

res = requests.get(
    "https://gateway.apinoa.com/v1/amazon/categories",
    headers={"x-api-key": os.environ["APINOA_API_KEY"]},
)
body = res.json()
```

## 参数

| Parameter | Type | Required | Notes |
|---|---|---|---|
| `categoryId` | string |  | Omit for the 40 departments; give a browse node (`172541`) or a department slug (`electronics`) to list that category's children. This is the one endpoint that takes either kind of id. |
| `region` | enum |  | Which Amazon marketplace to query, by buyer country: US, CA, MX, BR, FR, IT, ES, NL, SE, TR, AE, SA, IN, JP, SG, AU. Defaults to US. Prices come back in that marketplace's own currency (JP in JPY, FR in EUR). `US` `CA` `MX` `BR` `FR` `IT` `ES` `NL` `SE` `TR` `AE` `SA` `IN` `JP` `SG` `AU` |

The same parameters, and every response type, are in the OpenAPI document: https://apinoa.com/openapi.json

## 响应

在 `data` 中返回 [`CategoryList`](/docs/api-reference/marketplaces/response-schema#categorylist)。 真实响应的节选：数组只保留前几项，长文本已截断。

```json
{
  "success": true,
  "data": {
    "marketplace": "amazon",
    "path": [],
    "categories": [
      {
        "id": "amazon-devices",
        "name": "Amazon Devices & Accessories",
        "browsable": false
      },
      {
        "id": "amazon-renewed",
        "name": "Amazon Renewed",
        "browsable": false
      }
    ]
  }
}
```

## 错误

| 状态 | 代码 | 含义 |
|---|---|---|
| 400 | `INVALID_PARAMS` | 参数缺失、未知或超出范围。消息中会指出是哪一个。 |
| 401 | `UNAUTHORIZED` | 缺少 `x-api-key` 请求头，或密钥已吊销或未知。 |
| 402 | `INSUFFICIENT_BALANCE` | 余额不足以支付本次调用。请在控制台充值。 |
| 429 | `MARKETPLACE_SATURATED` | 并发调用过多。请等待 `Retry-After` 秒后重试。 |
| 502 | `UPSTREAM_ERROR` | 平台返回了无法使用的内容。请退避后重试。 |

全部错误代码见 [Errors](/docs/errors)。失败的调用不计费。

## 价格

**Price** $0.001 per call. [List price](https://apinoa.com/en/pricing); the rate steps down above 1,000 calls a day.

## 说明

- **省略 `categoryId` 返回各部门。** 传入一个 id 则列出其子类目，可逐层向下。
- **两种 id。** 部门是店铺 slug（`electronics`）；部门以下都是数字浏览节点（`172541`）。部门返回 `"browsable": false`，因为 [Browse](/docs/api-reference/amazon/browse) 需要的是节点。向下一层，即可得到它接受的 id。
- 部门以下不报告 `browsable`，默认为可浏览；少数节点不列出任何商品（Camera & Photo 即是其一）。
- 响应包含 `path`（祖先类目，叶子在最后）和 `categories`。
