Skip to main content
GET
/
stats
Dataset Statistics
curl --request GET \
  --url https://htsapi.com/v1/stats
import requests

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

response = requests.get(url)

print(response.text)
const options = {method: 'GET'};

fetch('https://htsapi.com/v1/stats', 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/stats",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);

$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/stats"

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

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/stats")
.asString();
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
{
  "dataset": {
    "total_codes": 123,
    "chapters": 123,
    "breakdown": {},
    "version": {
      "name": "<string>",
      "year": 123,
      "revision": "<string>"
    },
    "country": "<string>",
    "last_updated": "<string>"
  },
  "api": {
    "version": "<string>",
    "status": "<string>"
  }
}
Returns dataset and API statistics. This endpoint does not require authentication.

Example Request

curl -X GET "https://htsapi.com/v1/stats"

Example Response

{
  "dataset": {
    "total_codes": 34377,
    "chapters": 99,
    "breakdown": {
      "chapters": 99,
      "headings": 1247,
      "subheadings": 5201,
      "statistical_suffixes": 27830
    },
    "version": {
      "name": "HTS 2020 Revision 18",
      "year": 2020,
      "revision": "18"
    },
    "country": "US",
    "last_updated": "2024-01-15"
  },
  "api": {
    "version": "1.0.0",
    "status": "healthy"
  }
}

Response Fields

  • dataset.total_codes: Total number of HTS codes in the database
  • dataset.chapters: Number of chapters (2-digit codes)
  • dataset.breakdown: Breakdown by code level
  • dataset.version: HTS data version information
  • dataset.country: Country code (US for HTS)
  • dataset.last_updated: Date when data was last updated
  • api.version: API version
  • api.status: API health status

Use Cases

  • Display dataset information
  • Health checks
  • Version verification
  • Data freshness checks

Response

200 - application/json

Statistics

dataset
object
api
object