# Tariff Classificaiton

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

```bash
curl -X 'POST' \
  'https://dev.api.digicust.com/generic/api/<YOUR CUSTOMER ID>/<YOUR PROJECT ID>/tariff-classification/classify_cn' \
  -H 'accept: application/json' \
  -H 'accept-language: en-US,en;q=0.9' \
  -H 'Authorization: Bearer <YOUR ACCESS TOKEN>' \
  -H 'content-type: application/json' \
  -d '{
        "description": "Schokolade",
        "remark": "Manufacturer, Designation",
        "barCode": "EAN code"
      }'
```

{% endtab %}

{% tab title="JavaScript (native)" %}

```javascript
var xhr = new XMLHttpRequest();
xhr.open('POST', 'https://dev.api.digicust.com/generic/api/<YOUR CUSTOMER ID>/<YOUR PROJECT ID>/tariff-classification/classify_cn', true);
xhr.setRequestHeader('Accept', 'application/json');
xhr.setRequestHeader('Accept-Language', 'en-US,en;q=0.9');
xhr.setRequestHeader('Authorization', 'Bearer <YOUR ACCESS TOKEN>');
xhr.setRequestHeader('Content-Type', 'application/json');

xhr.onreadystatechange = function () {
  if (xhr.readyState === XMLHttpRequest.DONE) {
    if (xhr.status === 200) {
      console.log('Response:', xhr.responseText);
    } else {
      console.error('Error:', xhr.statusText);
    }
  }
};

var data = JSON.stringify({
  description: "Schokolade",
  remark: "Manufacturer, Designation",
  barCode: "EAN code"
});

xhr.send(data);

```

{% endtab %}

{% tab title="JavaScript (axios)" %}

```javascript
const axios = require('axios');

const config = {
  method: 'post',
  url: 'https://dev.api.digicust.com/generic/api/<YOUR CUSTOMER ID>/<YOUR PROJECT ID>/tariff-classification/classify_cn',
  headers: { 
    'Accept': 'application/json', 
    'Accept-Language': 'en-US,en;q=0.9', 
    'Authorization': 'Bearer <YOUR ACCESS TOKEN>', 
    'Content-Type': 'application/json'
  },
  data: {
    description: "Schokolade",
    remark: "Manufacturer, Designation",
    barCode: "EAN code"
  }
};

axios(config)
  .then(function (response) {
    console.log('Response:', response.data);
  })
  .catch(function (error) {
    console.error('Error:', error.response ? error.response.data : error.message);
  });

```

{% endtab %}

{% tab title="Visual Basic.NET" %}

```visual-basic
Imports System.Net.Http
Imports System.Text
Imports System.Threading.Tasks

Module Program
    Sub Main()
        ' Call the asynchronous method
        Task.Run(Function() PostRequest()).Wait()
    End Sub

    ' Asynchronous function to send the HTTP POST request
    Async Function PostRequest() As Task
        Dim client As New HttpClient()

        ' Set the request URL
        Dim url As String = "https://dev.api.digicust.com/generic/api/<YOUR CUSTOMER ID>/<YOUR PROJECT ID>/tariff-classification/classify_cn"

        ' Set the headers
        client.DefaultRequestHeaders.Add("Accept", "application/json")
        client.DefaultRequestHeaders.Add("Accept-Language", "en-US,en;q=0.9")
        client.DefaultRequestHeaders.Add("Authorization", "Bearer <YOUR ACCESS TOKEN>")

        ' Prepare the request body data
        Dim jsonData As String = "{
            ""description"": ""Schokolade"",
            ""remark"": ""Manufacturer, Designation"",
            ""barCode"": ""EAN code""
        }"
        Dim content As New StringContent(jsonData, Encoding.UTF8, "application/json")

        ' Send the POST request
        Try
            Dim response As HttpResponseMessage = Await client.PostAsync(url, content)
            If response.IsSuccessStatusCode Then
                ' Read the response content
                Dim responseBody As String = Await response.Content.ReadAsStringAsync()
                Console.WriteLine("Response: " & responseBody)
            Else
                Console.WriteLine("Error: " & response.StatusCode.ToString())
            End If
        Catch ex As Exception
            Console.WriteLine("Exception: " & ex.Message)
        End Try
    End Function
End Module

```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

# Define the URL
url = 'https://dev.api.digicust.com/generic/api/<YOUR CUSTOMER ID>/<YOUR PROJECT ID>/tariff-classification/classify_cn'

# Define the headers
headers = {
    'Accept': 'application/json',
    'Accept-Language': 'en-US,en;q=0.9',
    'Authorization': 'Bearer <YOUR ACCESS TOKEN>',
    'Content-Type': 'application/json'
}

# Define the payload
data = {
    "description": "Schokolade",
    "remark": "Manufacturer, Designation",
    "barCode": "EAN code"
}

# Send the POST request
response = requests.post(url, headers=headers, data=json.dumps(data))

# Check the response
if response.status_code == 200:
    print('Response:', response.json())
else:
    print('Error:', response.status_code, response.text)

```

{% endtab %}
{% endtabs %}

Make sure to replace the placeholders.

Sometimes the service runs into status 500 errors. Often, retry of these errors helps. We work on making our tariff classification API more and more stable.

Use remark for any additional information, such as:

1. Material information
2. Info if standalone item or part of a machine
3. Intended use or industry
4. Whether the product can be of general use

We recommend the total description to not be longer than 30 and 50 words.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guide.digicust.com/developer-api/tariff-classificaiton.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
