Skip to content

Latest commit

 

History

History
150 lines (98 loc) · 6.86 KB

File metadata and controls

150 lines (98 loc) · 6.86 KB

CustomsItems

(customs_items)

Overview

Customs declarations are relevant information, including one or multiple customs items, you need to provide for customs clearance for your international shipments.

Available Operations

  • list - List all customs items
  • create - Create a new customs item
  • get - Retrieve a customs item

list

Returns a list all customs items objects.

Example Usage

from shippo import Shippo


with Shippo(
    api_key_header="<YOUR_API_KEY_HERE>",
    shippo_api_version="2018-02-08",
) as s_client:

    res = s_client.customs_items.list()

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
page Optional[int] The page number you want to select
results Optional[int] The number of results to return per page (max 100)
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

components.CustomsItemPaginatedList

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

create

Creates a new customs item object.

Example Usage

from shippo import Shippo
from shippo.models import components


with Shippo(
    api_key_header="<YOUR_API_KEY_HERE>",
    shippo_api_version="2018-02-08",
) as s_client:

    res = s_client.customs_items.create(request={
        "description": "T-Shirt",
        "mass_unit": components.WeightUnitEnum.LB,
        "net_weight": "5",
        "origin_country": "<value>",
        "quantity": 20,
        "value_amount": "200",
        "value_currency": "USD",
        "metadata": "Order ID \"123454\"",
        "sku_code": "HM-123",
        "hs_code": "0901.21",
    })

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
request components.CustomsItemCreateRequest ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

components.CustomsItem

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

get

Returns an existing customs item using an object ID

Example Usage

from shippo import Shippo


with Shippo(
    api_key_header="<YOUR_API_KEY_HERE>",
    shippo_api_version="2018-02-08",
) as s_client:

    res = s_client.customs_items.get(customs_item_id="<id>")

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
customs_item_id str ✔️ Object ID of the customs item
page Optional[int] The page number you want to select
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

components.CustomsItem

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*