Skip to main content
GET
/
categories
Browse Categories
curl --request GET \
  --url https://htsapi.com/v1/categories \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://htsapi.com/v1/categories"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://htsapi.com/v1/categories', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://htsapi.com/v1/categories",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://htsapi.com/v1/categories"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://htsapi.com/v1/categories")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://htsapi.com/v1/categories")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "data": [
    {
      "id": 123,
      "code": "<string>",
      "normalized_code": "<string>",
      "description": "<string>",
      "indent": 123,
      "has_children": true
    }
  ]
}
{
"error": "<string>",
"message": "<string>",
"retry_after": 123
}
Browse the hierarchical tree structure of codes. Returns top-level chapters or children of a specified parent code.

Parameters

ParameterTypeRequiredDescription
parentstringNoParent code to get children of (e.g., ‘8517’)
depthintegerNoHow many levels deep (default: 1, max: 3)

Example Request

Get top-level chapters:
curl -X GET "https://htsapi.com/v1/categories" \
  -H "Authorization: Bearer your_hts_api_key"
Get children of a specific code:
curl -X GET "https://htsapi.com/v1/categories?parent=8517&depth=1" \
  -H "Authorization: Bearer your_hts_api_key"

Example Response

{
  "data": [
    {
      "id": 1234,
      "code": "8517",
      "normalized_code": "8517",
      "description": "Telephone sets, including telephones for cellular networks or for other wireless networks",
      "indent": 0,
      "has_children": true
    },
    {
      "id": 1235,
      "code": "8518",
      "normalized_code": "8518",
      "description": "Microphones and stands therefor; loudspeakers, whether or not mounted in their enclosures",
      "indent": 0,
      "has_children": true
    }
  ]
}

Response Fields

  • has_children: Boolean indicating if the code has child codes
  • indent: Hierarchy level (0 = top level)

Use Cases

  • Build tree navigation interfaces
  • Explore code hierarchies
  • Display category structures
  • Implement breadcrumb navigation

Authorizations

Authorization
string
header
required

API key as Bearer token. Format: Bearer your_hts_api_key

Query Parameters

parent
string

Parent code to get children of

Maximum string length: 50
depth
integer
default:1

How many levels deep (default: 1, max: 3)

Required range: 1 <= x <= 3

Response

Category tree

data
object[]