> ## Documentation Index
> Fetch the complete documentation index at: https://docs.landedfees.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Classify to HS or HTS

> Accepts either a single description or a batch of up to 50 lines.
Returns the recommended 6-digit HS code, a 10-digit HTS suggestion
when available, and a confidence score. Optional
`hs_code_printed` lets you pass the code your supplier printed on
the commercial invoice; the classifier compares it and flags
disagreements.




## OpenAPI

````yaml POST /v1/classify
openapi: 3.1.0
info:
  title: LandedFees API
  version: 1.0.0
  summary: Landed-cost, HS classification, and origin-comparison API.
  description: |
    LandedFees exposes five stable v1 endpoints for landed-cost calculation,
    HS classification, multi-origin comparison, and rate lookup. All requests
    require a bearer API key (format `sk_live_...`). Every response returns
    JSON. Rate limits are surfaced via `X-RateLimit-*` headers.

    Data provenance: rates resolve against the same live tables the
    LandedFees UI uses (USITC HTS, EU TARIC, HMRC UK Trade Tariff, WCO HS,
    CBP weekly FX per 19 CFR 141.62). No estimates.

    Idempotency: mutation-like endpoints (calc, calc/bulk, classify,
    compare) accept an `Idempotency-Key` header. Repeating the same key
    within 24 hours returns the cached response.
  contact:
    name: LandedFees Support
    url: https://www.landedfees.com/support
    email: support@landedfees.com
  license:
    name: Proprietary
    url: https://www.landedfees.com/terms
servers:
  - url: https://www.landedfees.com
    description: Production (v1)
security:
  - bearerAuth: []
tags:
  - name: Calculate
    description: Landed-cost calculation for single and bulk shipments.
  - name: Classify
    description: HS / HTS code classification from a product description.
  - name: Compare
    description: Side-by-side landed-cost comparison across origins.
  - name: Rates
    description: Duty and tax rate lookup by country and HS code.
paths:
  /v1/classify:
    post:
      tags:
        - Classify
      summary: Classify a product description to an HS / HTS code.
      description: |
        Accepts either a single description or a batch of up to 50 lines.
        Returns the recommended 6-digit HS code, a 10-digit HTS suggestion
        when available, and a confidence score. Optional
        `hs_code_printed` lets you pass the code your supplier printed on
        the commercial invoice; the classifier compares it and flags
        disagreements.
      operationId: classify
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/ClassifySingleRequest'
                - $ref: '#/components/schemas/ClassifyBatchRequest'
            examples:
              single:
                summary: Single product description
                value:
                  description: Wireless bluetooth earbuds with charging case
                  destination_country: US
              batch:
                summary: Batch of 3 lines
                value:
                  destination_country: US
                  lines:
                    - description: USB-C charging cable
                    - description: Silicone phone case
                      hs_code_printed: '3926.90'
                    - description: Bluetooth earbuds
      responses:
        '200':
          description: Classification completed.
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/XRateLimitLimit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/XRateLimitRemaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/XRateLimitReset'
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ClassificationResult'
                  - $ref: '#/components/schemas/BatchClassificationResult'
              examples:
                single:
                  summary: Single-line result
                  value:
                    hs_6_code: '851762'
                    recommended_10_digit: 8517.62.00.90
                    confidence: 0.92
                    reason: >-
                      Wireless communication apparatus, other reception
                      apparatus
                    needs_review: false
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: |
        Client-generated unique string (recommended UUID v4). Repeating the
        same key within 24 hours returns the cached response for the original
        request body. Different bodies with the same key return HTTP 409.
      schema:
        type: string
        minLength: 8
        maxLength: 128
        example: e4c1d2a0-8f6b-4c9d-a123-2f8b7c5e9d10
  schemas:
    ClassifySingleRequest:
      type: object
      required:
        - description
        - destination_country
      properties:
        description:
          type: string
          minLength: 3
          maxLength: 2000
        destination_country:
          type: string
          minLength: 2
          maxLength: 2
        hs_code_printed:
          type: string
          maxLength: 64
          nullable: true
        confidence_threshold:
          type: number
          minimum: 0
          maximum: 1
    ClassifyBatchRequest:
      type: object
      required:
        - lines
        - destination_country
      properties:
        lines:
          type: array
          minItems: 1
          maxItems: 50
          items:
            $ref: '#/components/schemas/ClassifyBatchLine'
        destination_country:
          type: string
          minLength: 2
          maxLength: 2
        confidence_threshold:
          type: number
          minimum: 0
          maximum: 1
    ClassificationResult:
      type: object
      properties:
        hs_6_code:
          type: string
          example: '851762'
        recommended_10_digit:
          type: string
          nullable: true
          example: 8517.62.00.90
        confidence:
          type: number
          minimum: 0
          maximum: 1
        reason:
          type: string
        needs_review:
          type: boolean
        candidates:
          type: array
          items:
            type: object
            properties:
              hts_code:
                type: string
              description:
                type: string
              score:
                type: number
        disagreement_with_printed:
          type: boolean
          description: >-
            True when a supplied hs_code_printed differs from the
            recommendation.
    BatchClassificationResult:
      type: object
      properties:
        results:
          type: array
          items:
            $ref: '#/components/schemas/ClassificationResult'
        needs_review:
          type: array
          items:
            type: integer
        consistency:
          type: object
          properties:
            common_chapter:
              type: string
            outlier_indices:
              type: array
              items:
                type: integer
    ClassifyBatchLine:
      type: object
      required:
        - description
      properties:
        description:
          type: string
          minLength: 3
          maxLength: 2000
        hs_code_printed:
          type: string
          maxLength: 64
          nullable: true
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        code:
          type: string
        message:
          type: string
        detail:
          type: string
        issues:
          type: array
          items:
            type: object
  headers:
    XRateLimitLimit:
      description: Total requests allowed in the current window.
      schema:
        type: integer
        example: 1000
    XRateLimitRemaining:
      description: Requests remaining in the current window.
      schema:
        type: integer
        example: 987
    XRateLimitReset:
      description: Unix epoch seconds when the window resets.
      schema:
        type: integer
        example: 1755273600
  responses:
    BadRequest:
      description: Request body failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: invalid body
            issues:
              - path:
                  - destination_country
                message: String must contain exactly 2 character(s)
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: unauthorized
    PaymentRequired:
      description: >-
        Quota exhausted for the current plan. Upgrade or wait for the monthly
        reset.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: quota_exceeded
            code: QUOTA_EXCEEDED
            message: >-
              Monthly quota exhausted. Upgrade at
              https://www.landedfees.com/pricing.
    TooManyRequests:
      description: Rate limit exceeded. Retry after the reset window.
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: rate_limited
            code: RATE_LIMITED
            message: Too many requests. Retry after 60 seconds.
    InternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: internal
            detail: engine error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: sk_live
      description: |
        API key issued from the LandedFees dashboard under Settings > API keys.
        Format: `sk_live_...` (production) or `sk_test_...` (sandbox). Pass in
        the `Authorization: Bearer <key>` header.

````