> For the complete documentation index, see [llms.txt](https://developer.goshiip.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.goshiip.com/api-references/international-hscode.md).

# International HsCode

To retrieve the HS Code for your international shipment payload, particularly within the items object, follow these two steps:

1. Call the **Chapters** endpoint to obtain a preliminary categorization of the goods.
2. Use the response from the Chapters endpoint to call the **Categories** endpoint, from which you can retrieve the specific HS Code.

## HsCode Request

### 1. Get Chapters Request

{% tabs %}
{% tab title="Curl" %}

```javascript
curl --location 'https://delivery-staging.apiideraos.com/api/v2/token/hscode/chapters' \
--header 'Authorization: Bearer Secret Key'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://delivery-staging.apiideraos.com/api/v2/token/hscode/chapters"

payload = {}
headers = {
  'Authorization': 'Bearer Secret Key'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require "uri"
require "net/http"

url = URI("https://delivery-staging.apiideraos.com/api/v2/token/hscode/chapters")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer Secret Key"

response = https.request(request)
puts response.read_body

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://delivery-staging.apiideraos.com/api/v2/token/hscode/chapters',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer Secret Key'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Javascript" %}

```javascript
const myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer Secret Key");

const requestOptions = {
  method: "GET",
  headers: myHeaders,
  redirect: "follow"
};

fetch("https://delivery-staging.apiideraos.com/api/v2/token/hscode/chapters", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

{% endtab %}

{% tab title="Golang" %}

```go
package main

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

func main() {

  url := "https://delivery-staging.apiideraos.com/api/v2/token/hscode/chapters"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "Bearer Secret Key")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}
{% endtabs %}

### Get Chapters Response

{% tabs %}
{% tab title="200" %}

```json
{
    "data": [
        "Fertilizers",
        "Manufactures of Straw, of Esparto or of Other Plaiting Materials; Basketware and Wickerwork",
        "Pulp of Wood or of Other Fibrous Cellulosic Material; Recovered (Waste and Scrap) Paper or Paperboard",
        "Paper and Paperboard; Articles of Paper Pulp, of Paper or of Paperboard",
        "Printed Books, Newspapers, Pictures and Other Products of the Printing Industry; Manuscripts, Typescripts, and Plans",
        "Silk",
        "Articles of Apparel and Clothing Accessories, Knitted or Crocheted",
        "Articles of Apparel and Clothing Accessories, Not Knitted or Crocheted",
        "Other Made-Up Textile Articles; Sets; Worn Clothing and Worn Textile Articles; Rags",
        "Footwear, Gaiters, and the Like; Parts of Such Articles",
        "Headgear and Parts Thereof",
        "Umbrellas, Sun Umbrellas, Walking-Sticks, Seat-Sticks, Whips, Riding-Crops, and Parts Thereof",
        "Prepared Feathers and Down and Articles Made of Feathers or of Down; Artificial Flowers; Articles of Human Hair"
    ],
    "status": true,
    "message": "Chapters retrieved",
    "status_code": 200
}
```

{% endtab %}

{% tab title="404" %}

```json
{
    "status": false,
    "message": "Invalid route or endpoint not found",
    "status_code": 404
}
```

{% endtab %}
{% endtabs %}

### 2. Get Categories Request

{% hint style="info" %}
chapter\_id is the name of the chapter selected above.
{% endhint %}

{% tabs %}
{% tab title="Curl" %}

```javascript
curl --location 'https://delivery-staging.apiideraos.com/api/v2/token/hscode/categories?chapter_id=Fertilizers' \
--header 'Authorization: Bearer Secret Key'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://delivery-staging.apiideraos.com/api/v2/token/hscode/categories?chapter_id=Fertilizers"

payload = {}
headers = {
  'Authorization': 'Bearer Secret Key'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require "uri"
require "net/http"

url = URI("https://delivery-staging.apiideraos.com/api/v2/token/hscode/categories?chapter_id=Fertilizers")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer Secret Key"

response = https.request(request)
puts response.read_body

```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://delivery-staging.apiideraos.com/api/v2/token/hscode/categories?chapter_id=Fertilizers',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer Secret Key'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Javascript" %}

```javascript
const myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer Secret Key");

const requestOptions = {
  method: "GET",
  headers: myHeaders,
  redirect: "follow"
};

fetch("https://delivery-staging.apiideraos.com/api/v2/token/hscode/categories?chapter_id=Fertilizers", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
```

{% endtab %}

{% tab title="Golang" %}

```go
package main

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

func main() {

  url := "https://delivery-staging.apiideraos.com/api/v2/token/hscode/categories?chapter_id=Fertilizers"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "Bearer Secret Key")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}
{% endtabs %}

### Get Categories Response

{% tabs %}
{% tab title="404" %}

```json
{
    "status": false,
    "message": "Invalid route or endpoint not found",
    "status_code": 404
}
```

{% endtab %}

{% tab title="200" %}

```json
{
    "data": [
        {
            "chapter": 31,
            "category_code": "3101",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310100",
            "description": "Animal vegetable fertilizers, mixed treated"
        },
        {
            "chapter": 31,
            "category_code": "3102",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310210",
            "description": "Urea, aqueous or solid"
        },
        {
            "chapter": 31,
            "category_code": "3102",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310221",
            "description": "Ammonium sulfate"
        },
        {
            "chapter": 31,
            "category_code": "3102",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310229",
            "description": "Other nitrogenous fertilizers"
        },
        {
            "chapter": 31,
            "category_code": "3102",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310230",
            "description": "Ammonium nitrate"
        },
        {
            "chapter": 31,
            "category_code": "3102",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310240",
            "description": "Ammonium nitrate mixtures, inorganic substances"
        },
        {
            "chapter": 31,
            "category_code": "3102",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310250",
            "description": "Sodium nitrate"
        },
        {
            "chapter": 31,
            "category_code": "3102",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310260",
            "description": "Calcium ammonium nitrate mixtures"
        },
        {
            "chapter": 31,
            "category_code": "3102",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310280",
            "description": "Urea ammonium nitrate mixtures, aqueous ammoniacal"
        },
        {
            "chapter": 31,
            "category_code": "3102",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310290",
            "description": "Other nitrogenous fertilizers"
        },
        {
            "chapter": 31,
            "category_code": "3103",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310310",
            "description": "Superphosphates"
        },
        {
            "chapter": 31,
            "category_code": "3103",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310320",
            "description": "Basic slag"
        },
        {
            "chapter": 31,
            "category_code": "3103",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310390",
            "description": "Other phosphatic fertilizers"
        },
        {
            "chapter": 31,
            "category_code": "3104",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310410",
            "description": "Crude potassium salts"
        },
        {
            "chapter": 31,
            "category_code": "3104",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310420",
            "description": "Potassium chloride"
        },
        {
            "chapter": 31,
            "category_code": "3104",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310430",
            "description": "Potassium sulfate"
        },
        {
            "chapter": 31,
            "category_code": "3104",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310490",
            "description": "Other potassic fertilizers"
        },
        {
            "chapter": 31,
            "category_code": "3105",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310510",
            "description": "Fertilizers, tablets packages ≤ 10 kg"
        },
        {
            "chapter": 31,
            "category_code": "3105",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310520",
            "description": "Fertilizers with N, P, K elements"
        },
        {
            "chapter": 31,
            "category_code": "3105",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310530",
            "description": "Diammonium phosphate"
        },
        {
            "chapter": 31,
            "category_code": "3105",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310540",
            "description": "Monoammonium phosphate, mixed with diammonium phosphate"
        },
        {
            "chapter": 31,
            "category_code": "3105",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310551",
            "description": "Fertilizers with nitrates phosphates"
        },
        {
            "chapter": 31,
            "category_code": "3105",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310559",
            "description": "Other fertilizers with nitrogen phosphorus"
        },
        {
            "chapter": 31,
            "category_code": "3105",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310560",
            "description": "Fertilizers with phosphorus potassium"
        },
        {
            "chapter": 31,
            "category_code": "3105",
            "category": "Chemicals & Allied Industries",
            "subcategory": "Fertilizers",
            "hscode": "310590",
            "description": "Other fertilizers"
        }
    ],
    "status": true,
    "message": "Categories retrieved",
    "status_code": 200
}
```

{% endtab %}

{% tab title="422" %}

```json
{
    "status": false,
    "message": "The chapter id field is required."
}
```

{% endtab %}
{% endtabs %}

Choose any category from the response, and include it in the items payload when booking international shipments.
