# HS Codes API
> The World Customs Organization Harmonized System (HS) as an API — 6,900+ commodity classification codes used for customs, tariffs and international trade. Look up any HS code (2-digit chapter, 4-digit heading or 6-digit subheading) with its description and full ancestor chain, search the nomenclature by product, or drill into the sub-codes of a code. Ideal for logistics, customs, e-commerce and trade-compliance tooling.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/hscodes-api/..."
```

## Pricing
- **Free** (Free) — 2,000 calls/Mo, 2 req/s
- **Starter** ($9/Mo) — 45,000 calls/Mo, 8 req/s
- **Pro** ($25/Mo) — 275,000 calls/Mo, 20 req/s
- **Mega** ($65/Mo) — 1,100,000 calls/Mo, 50 req/s

## Endpoints

### HS Codes

#### `GET /v1/children` — The direct sub-codes of an HS code

**Parameters:**
- `hscode` (query, required, string) — Parent HS code Example: `0901`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/hscodes-api/v1/children?hscode=0901"
```

**Response:**
```json
{
    "data": {
        "count": 5,
        "hscode": "0901",
        "children": [
            {
                "level": "6",
                "hscode": "090111",
                "parent": "0901",
                "section": "II",
                "description": "Coffee; not roasted or decaffeinated"
            },
            {
                "level": "6",
                "hscode": "090112",
                "parent": "0901",
                "section": "II",
                "description": "Coffee; decaffeinated, not roasted"
            },
            {
                "level": "6",
                "hscode": "090121",
                "parent": "0901",
                "section": "II",
                "description": "Coffee; roasted, not decaffeinated"
            },
            {
                "level": "6",
                "hscode": "090122",
                "parent": "0901",
                "section": "II",
                "description": "Coffee; roasted, decaffeinated"
            },
            {
                "level": "6",
                "hscode": "090190",
                "parent": "0901",
                "section": "II",
                "description": "Coffee; husks and skins, coffee substitutes containing coffee in any proportion"
            }
        ],
        "description": "Coffee, whether or not roasted or decaffeinated; husks and skins; coffee substitutes containing coffee in any proportion"
    },
    "meta": {
        "timestamp": "2026-05-31T02:53:35.048Z
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/code` — An HS code with its description & ancestor chain

**Parameters:**
- `hscode` (query, required, string) — HS code: 2, 4 or 6 digits Example: `090111`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/hscodes-api/v1/code?hscode=090111"
```

**Response:**
```json
{
    "data": {
        "level": "6",
        "hscode": "090111",
        "parent": "0901",
        "section": "II",
        "ancestors": [
            {
                "level": "4",
                "hscode": "0901",
                "parent": "09",
                "section": "II",
                "description": "Coffee, whether or not roasted or decaffeinated; husks and skins; coffee substitutes containing coffee in any proportion"
            },
            {
                "level": "2",
                "hscode": "09",
                "parent": "TOTAL",
                "section": "II",
                "description": "Coffee, tea, mate and spices"
            },
            {
                "level": "5",
                "hscode": "TOTAL",
                "parent": "TOTAL",
                "section": "TOTAL",
                "description": "Total of all HS2022 commodities"
            }
        ],
        "description": "Coffee; not roasted or decaffeinated"
    },
    "meta": {
        "timestamp": "2026-05-31T02:53:35.119Z",
        "request_id": "9ce47e12-d007-4778-9abf-2a35ce6ab937"
    },
    "status": "ok",
    "message": "HS code retrieved",
    "success": true
}
```

#### `GET /v1/search` — Search HS codes by product/description

**Parameters:**
- `q` (query, required, string) — Search text Example: `coffee`
- `level` (query, optional, string) — Level: 2 (chapter), 4 (heading), 6 (subheading)
- `limit` (query, optional, string) — Results per page (1-100, default 20) Example: `20`
- `offset` (query, optional, string) — Pagination offset Example: `0`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/hscodes-api/v1/search?q=coffee&limit=20&offset=0"
```

**Response:**
```json
{
    "data": {
        "count": 12,
        "level": null,
        "limit": 20,
        "query": "coffee",
        "total": 12,
        "offset": 0,
        "results": [
            {
                "level": "2",
                "hscode": "09",
                "parent": "TOTAL",
                "section": "II",
                "description": "Coffee, tea, mate and spices"
            },
            {
                "level": "4",
                "hscode": "0901",
                "parent": "09",
                "section": "II",
                "description": "Coffee, whether or not roasted or decaffeinated; husks and skins; coffee substitutes containing coffee in any proportion"
            },
            {
                "level": "6",
                "hscode": "090111",
                "parent": "0901",
                "section": "II",
                "description": "Coffee; not roasted or decaffeinated"
            },
            {
                "level": "6",
                "hscode": "090112",
                "parent": "0901",
                "section": "II",
                "description": "Coffee; decaffeinated, not roasted"
            },
            {
                "level": "6",
                "hscode": "090121",
                "parent": "0901",
                "section": "II",
                "description": "Coffee; roasted, not decaffeinated"
            },
            {
                "level": "6",
                "hscode": "090122",
                "parent"
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Totals, levels & source

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/hscodes-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "total": 6940,
        "fields": [
            "hscode",
            "description",
            "section",
            "parent",
            "level"
        ],
        "levels": [
            {
                "count": 97,
                "label": "chapter",
                "level": "2"
            },
            {
                "count": 1229,
                "label": "heading",
                "level": "4"
            },
            {
                "count": 1,
                "label": "code",
                "level": "5"
            },
            {
                "count": 5613,
                "label": "subheading",
                "level": "6"
            }
        ],
        "source": "WCO Harmonized System (HS) nomenclature"
    },
    "meta": {
        "timestamp": "2026-05-31T02:53:35.262Z",
        "request_id": "029b99c6-f53c-480a-87e3-711a6859ae72"
    },
    "status": "ok",
    "message": "Meta retrieved",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/hscodes-api
OpenAPI spec: https://www.oanor.com/api/hscodes-api/openapi.json
