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

# Industry Hierarchy

> Retrieve an industry's top-level classification and lower-level industry categories.

## Plan Access

| Plan | Available |
| - | :-: |
| Free | ❌ |
| Starter | ❌ |
| Professional | ✅ |
| Full-Market Plans (A-Shares, HK Stocks, US Stocks) | ✅ |
| Enterprise | ✅ |

## Notes

* Obtain `industry_counter_id` from Industry Metric Rankings. Industry nodes from different markets cannot be mixed.
* `market` is case-insensitive. This documentation uses uppercase market codes consistently.

## Supported Markets

| Market | Examples |
| - | - |
| US Stocks | US |
| HK Stocks | HK |
| A-Shares | CN |

## Request Parameters

| Parameter | Required | Description |
| - | :-: | - |
| `market` | Yes | Market code: `US` US stocks, `HK` Hong Kong stocks, or `CN` A-shares |
| `industry_counter_id` | Yes | Industry node ID returned by Industry Metric Rankings |

## Request Example

```bash theme={null}
curl -H "X-API-Key: YOUR_API_KEY" \
  "https://api.tickdb.ai/v1/fundamentals/industries/tree?market=US&industry_counter_id=BK%2FUS%2FIN00260"
```

## Response Fields

The table below lists fields in `data`; an outer `code=0` indicates success.

| Field | Description |
| - | - |
| market | Queried market. |
| industry\_counter\_id | Industry node ID. |
| top | Top-level industry classification. |
| └─ name | Top-level industry name. |
| └─ market | Top-level industry market. |
| chain | Hierarchy containing the current industry and its children. |
| └─ name | Node name. |
| └─ counter\_id | Industry node ID. |
| └─ level | Node level. |
| └─ parent\_code | Parent node code. |
| └─ market | Market. |
| └─ stock\_num | Number of stocks. |
| └─ chg | Change value. |
| └─ ytd\_chg | Year-to-date change. |
| └─ symbol | Associated node symbol. |
| └─ sharelist\_id | Stock-list ID. |
| └─ next | Child industry categories; each element recursively uses the same node structure. |

Returns the industry's top-level parent, current classification, and child classifications for exploring industry relationships.


## OpenAPI

````yaml openapi.en.yaml GET /v1/fundamentals/industries/tree
openapi: 3.1.0
info:
  title: TickDB API
  description: TickDB unified real-time market data API via REST and WebSocket.
  version: 1.0.3
  contact:
    email: support@tickdb.ai
servers:
  - url: https://api.tickdb.ai
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /v1/fundamentals/industries/tree:
    get:
      tags:
        - fundamentals-valuation-industry
      summary: Industry Hierarchy
      description: >-
        Retrieve an industry's top-level classification and lower-level industry
        categories.
      operationId: getFundamentalsIndustriesTree
      parameters:
        - $ref: '#/components/parameters/RequiredMarketQuery'
        - $ref: '#/components/parameters/IndustryCounterIDQuery'
      responses:
        '200':
          $ref: '#/components/responses/IndustriesTreeResponse'
        default:
          $ref: '#/components/responses/ErrorResponse'
components:
  parameters:
    RequiredMarketQuery:
      name: market
      in: query
      required: true
      schema:
        type: string
        enum:
          - US
          - HK
          - CN
      description: 'Market code: `US` US stocks, `HK` Hong Kong stocks, or `CN` A-shares'
    IndustryCounterIDQuery:
      name: industry_counter_id
      in: query
      required: true
      schema:
        type: string
      description: Industry node ID returned by Industry Metric Rankings
  responses:
    IndustriesTreeResponse:
      description: Industry Hierarchy response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/IndustriesTreeEnvelope'
    ErrorResponse:
      description: >-
        Error response. Common HTTP statuses include 400 (invalid parameters),
        401 (authentication failed), 403 (permission or quota restriction), 404
        (no matching data), 429 (rate limit), and 503 (service temporarily
        unavailable).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          examples:
            missingAPIKey:
              summary: Missing API key
              value:
                code: '1002'
                message: API key is required. Provide via X-API-Key header
                error: '1002'
            missingKind:
              summary: Missing required parameter
              value:
                code: 40001
                message: kind is required
                data: null
            endpointForbidden:
              summary: API key cannot access this endpoint
              value:
                code: 3009
                message: This endpoint is not allowed for your API key
                data: null
            marketForbidden:
              summary: API key cannot access this market
              value:
                code: 3010
                message: Fundamentals market not allowed for your API key
                data:
                  market: US
            noAvailableSource:
              summary: Data temporarily unavailable
              value:
                code: 5003
                message: Data is temporarily unavailable
                data: null
            notFound:
              summary: No matching data
              value:
                code: 40404
                message: shareholder detail not found
                data: null
            businessNoData:
              summary: No business data matches the query
              value:
                code: 40405
                message: valuation time series not found
                data: null
  schemas:
    IndustriesTreeEnvelope:
      allOf:
        - $ref: '#/components/schemas/SuccessEnvelope'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/IndustriesTreeData'
    ErrorEnvelope:
      type: object
      required:
        - code
        - message
      properties:
        code:
          description: >-
            TickDB API business error code; may be an integer or string. Convert
            it to a string before comparing.
          oneOf:
            - type: integer
            - type: string
        message:
          type: string
          description: Error description.
        error:
          type: string
          description: >-
            Compatibility error identifier; present only in some error
            responses.
        data:
          description: Optional error context; may be null, an object, or an array.
          oneOf:
            - type: 'null'
            - type: object
              additionalProperties: true
            - type: array
              items: {}
    SuccessEnvelope:
      type: object
      required:
        - code
        - data
      properties:
        code:
          type: integer
          const: 0
          description: Business status code; `0` means success.
    IndustriesTreeData:
      type: object
      required:
        - market
        - industry_counter_id
        - top
        - chain
      properties:
        market:
          type: string
          description: Queried market.
        industry_counter_id:
          type: string
          description: Industry node ID.
        top:
          $ref: '#/components/schemas/IndustryTop'
        chain:
          $ref: '#/components/schemas/IndustryChainNode'
      additionalProperties: true
    IndustryTop:
      type: object
      required:
        - name
        - market
      properties:
        name:
          type: string
          description: Top-level industry name.
        market:
          type: string
          description: Queried market.
      additionalProperties: false
    IndustryChainNode:
      type: object
      required:
        - name
        - level
        - market
        - counter_id
        - next
      properties:
        name:
          type: string
          description: Industry name.
        level:
          type: integer
          description: Node level.
        market:
          type: string
          description: Queried market.
        counter_id:
          type: string
          description: Industry node ID.
        parent_code:
          type: string
          description: Parent node code.
        sharelist_id:
          type: string
          description: Stock-list ID.
        symbol:
          type: string
          description: Associated node symbol.
        stock_num:
          type: integer
          minimum: 0
          description: Number of stocks.
        chg:
          type:
            - string
            - number
            - 'null'
          description: Change value.
        ytd_chg:
          type:
            - string
            - number
            - 'null'
          description: Year-to-date change.
        next:
          type: array
          description: >-
            Child industry categories; each element recursively uses the same
            node structure.
          items:
            $ref: '#/components/schemas/IndustryChainNode'
      additionalProperties: false
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````

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