> For the complete documentation index, see [llms.txt](https://sharelink-docs.toss.im/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sharelink-docs.toss.im/developers/open-api/api/categories.md).

# 카테고리 조회

토스쇼핑 카테고리 트리를 조회합니다. 카테고리 베스트 조회에 필요한 ID를 여기서 얻습니다.

[카테고리 베스트 상품 조회](/developers/open-api/api/products.md)에 필요한 `categoryId`를 여기서 얻으실 수 있습니다.

```
GET /openapi/categories
```

필요 스코프: `sharelink:read`

***

## 요청

파라미터가 없습니다.

```bash
curl -H "Authorization: Bearer {액세스 토큰}" \
  "https://sharelink.toss.im/openapi/categories"
```

***

## 응답

```json
{
  "resultType": "SUCCESS",
  "success": {
    "categories": [
      {
        "categoryId": 100,
        "level": 1,
        "displayName": "패션",
        "children": [
          {
            "categoryId": 101,
            "level": 2,
            "displayName": "여성의류",
            "children": []
          },
          {
            "categoryId": 102,
            "level": 2,
            "displayName": "남성의류",
            "children": []
          }
        ]
      }
    ]
  }
}
```

### 필드

| 필드            | 타입     | 설명                                     |
| ------------- | ------ | -------------------------------------- |
| `categoryId`  | number | 카테고리 ID. 카테고리 베스트 조회에 사용합니다            |
| `level`       | number | 카테고리 깊이. 최상위가 `1`이며 **최대 5단계**까지 제공합니다 |
| `displayName` | string | 카테고리 이름                                |
| `children`    | array  | 하위 카테고리 목록. 하위가 없으면 빈 배열               |

`children`은 같은 구조가 중첩된 형태이므로, 재귀적으로 순회하시면 전체 트리를 얻으실 수 있습니다.

***

## 사용 팁

카테고리 구성은 자주 바뀌지 않습니다. **매번 호출하지 마시고 하루 한 번 정도 조회해 저장해 두고 사용하시는 것을 권장드립니다.**

상품 조회 응답의 `categoryIds`도 이 트리와 같은 ID 체계이므로, 저장해 둔 트리에서 ID로 이름을 찾아 쓰시면 됩니다. 빈 배열이 오는 경우 등 처리 방법은 [공통 규약](/developers/open-api/convention.md)의 **상품 카드 공통 필드**를 봐 주세요.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://sharelink-docs.toss.im/developers/open-api/api/categories.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
