# PredictHSCode

Predict HS Code

`POST /hscode/classify`

**API:** HSCode classification service
**Tag:** public
**API Version:** 1.2.0
**Base URL:** https://hscode.api.avalara.com
**Authentication:** Bearer token

Source: https://developer.avalara.com/products/automated-tariff-code/api/methods/public/PredictHSCode/

## Description

Predicts the HS code using the provided product information for the specified country of destination.

**Performance and timeout guidance**
- `standard`: ~300 ms (typical).
- `enhanced_quick`: response time can vary from near-standard latency to ~8-12 seconds (p95 observed for slower requests).
- `enhanced_precise`: response time can vary from near-standard latency to ~25-30 seconds (p95 observed for slower requests).
- Actual latency varies by request and selected mode; not every request in an enhanced mode will be at the upper range.

**Client timeout recommendation**
- Configure your client timeout to at least **60 seconds** when using enhanced modes.

**Batch size limit**
- Send a maximum of **10 products per request** (applies to all prediction modes).

## Parameters

| Name | Type | In | Required | Description |
|---|---|---|---|---|
| `depth` | string | query | No | The length of the HS code to be predicted. `full` = 10 digits; `6` = 6 digits. |
| `api_version` | string | query | No | The API version to use. |
| `prediction_mode` | string | query | No | Customer-facing prediction strategy:
- `standard`: Default path; optimized for speed and efficiency.
- `enhanced_quick`: Enhanced path designed for improved capability (requires entitlement).
- `enhanced_precise`: Enhanced path designed for higher accuracy and quality (requires entitlement).
If entitlement is missing, enhanced modes return a forbidden response. |

## Request Body

**Content-Type:** `application/json`

## Responses

| Status | Description | Schema |
|---|---|---|
| 200 | Success |  |
| 401 | Unauthorized | `UnauthorizedErrorResponse` |
| 403 | Forbidden | `ForbiddenErrorResponse` |
| 422 | Validation Error |  |
| default | Internal Error | `InternalErrorResponse` |

## Example Request

```bash
curl -X POST "https://hscode.api.avalara.com/hscode/classify" \
  -H "Authorization: Basic <credentials>" \
  -H "Accept: application/json" \
  -d '[
  {
    "product_title": "LEWEL Men's Stylish Back Printed 3/4th Sleeve T-Shirt (Black)",
    "cod": "CA",
    "image_url": "https://your.web/image.jpeg",
    "product_url": "https://your.web/your_product.html",
    "price": "$10",
    "product_category": "mens > clothes",
    "product_description": "Stylish Back Printed 3/4th Sleeve T-Shirt",
    "attributes": [
      {
        "Weaving method": "Knitted"
      }
    ]
  },
  {
    "product_title": "GUESS Analog Rose Gold Dial Women's Watch-GW0359L2",
    "cod": "MX",
    "image_url": "https://your.web/image.jpeg",
    "product_url": "https://your.web/your_product.html",
    "price": "$100",
    "product_category": "womens > watches",
    "product_description": "GUESS Analog Rose Gold",
    "attributes": [
      {
        "material": "steel"
      }
    ]
  }
]'
```