DOCS

Retrieve customs documentation

/

Retrieve customs documentation

Retrieve one or multiple customs documents for one or mutiple orders.

GraphQL

Once a customsSpec has been generated or created for a particular shipment, it can be queried. These queries can be used by anyone who is looking to pull back a customsSpec based on id, dateTimeRange, or trackingNumber.

Retrieve a single document

Supply information needed to retrieve a single Zonos-generated customs document.

To retrieve a single customsSpec, a user can query by the ID of the customsSpec they want to return.

Query

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
query CustomsSpec($id: ID!) {
  customsSpec(id: $id) {
    id
    deliveryDutyPaid
    declarationStatement
    amountSubtotals {
      duties
      fees
      insurance
      shipping
    }
    customsItems {
      items {
        id
      }
    }
  }
}

Variables

1
2
3
{
  "id": "customs_spec_66b544c9-439f-4a82-b5bb-1a00274e8a61"
}

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
  "data": {
    "customsSpec": {
      "id": "customs_spec_66b544c9-439f-4a82-b5bb-1a00274e8a61",
      "declarationStatement": "I declare this is a declaration statement",
      "amountSubtotals": {
        "duties": 10.0,
        "fees": 5.0,
        "insurance": 10.0,
        "shipping": 15.99
      },
      "customsItems": [
        {
          "items": [
            {
              "id": "test_item_123"
            }
          ]
        }
      ]
    }
  }
}

Retrieve multiple documents

Supply information needed to retrieve multiple Zonos-generated customs documents.

In scenarios where a user would like to pull back multiple customsSpecs by DateTimeRange and trackingNumber, the following query can be used.

Query

1
2
3
4
5
6
7
8
9
10
11
12
13
14
query CustomsSpecs($first: Int, $filter: CustomsSpecFilter) {
  customsSpecs(first: $first, filter: $filter) {
    edges {
      node {
        id
        amountSubtotals {
          duties
          fees
          insurance
        }
      }
    }
  }
}

Variables

1
2
3
4
5
6
7
8
9
10
{
  "first": 5,
  "filter": {
    "between": {
      "before": "2022-09-25T12:00:00Z",
      "after": null
    },
    "trackingNumber": null
  }
}

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
  "data": {
    "customsSpecs": {
      "edges": [
        {
          "node": {
            "id": "customs_spec_ee8eae49-64cd-440e-ac92-3cd90ce4be5b",
            "amountSubtotals": {
              "duties": 143.0,
              "fees": 2.0,
              "insurance": 100.0
            }
          }
        },
        {
          "node": {
            "id": "customs_spec_da0015aa-78cc-46c0-9006-bf25e0d7c57f",
            "amountSubtotals": {
              "duties": 143.0,
              "fees": 2.0,
              "insurance": 100.0
            }
          }
        },
        {
          "node": {
            "id": "customs_spec_8e8039f5-2e8c-4958-922f-f4dad0bc190f",
            "amountSubtotals": {
              "duties": 143.0,
              "fees": 2.0,
              "insurance": 100.0
            }
          }
        },
        {
          "node": {
            "id": "customs_spec_30e31150-13fe-423f-952a-13582454744a",
            "amountSubtotals": {
              "duties": 143.0,
              "fees": 2.0,
              "insurance": 100.0
            }
          }
        }
      ]
    }
  }
}

Retrieve customs specs

Users of the Zonos Customs API also have the ability to retrieve a customsSpec based on the accountOrderNumber, DateTimeRange, order id, and the Zonos storeId. In this scenario, a user will query the orders DGS as opposed to customsSpec.

Retrieve documents for orders

Supply information needed to retrieve Zonos-generated customs documentation for a single order.

To retrieve a single customsSpec, a user can query by the ID of the order tied to the customsSpec.

Query

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
query OrderQuery($id: String!) {
  order(orderId: $id) {
    id
    customsSpecs {
      id
      amountSubtotals {
        taxes
        shipping
        duties
        fees
        insurance
        items
      }
      clearanceType
      currency
    }
  }
}

Variables

1
2
3
{
  "id": "order_ad8dfd1f-5776-425f-8e4d-a0bd4e7d86e3"
}

Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{
  "data": {
    "order": {
      "id": "order_ad8dfd1f-5776-425f-8e4d-a0bd4e7d86e3",
      "customsSpecs": [
        {
          "id": "customs_spec_6a4aed06-5303-4e83-965d-2accdb00b600",
          "amountSubtotals": {
            "taxes": 10.21,
            "shipping": 25.99,
            "duties": 143,
            "fees": 2,
            "insurance": 100,
            "items": 30.2
          },
          "clearanceType": "COMMERCIAL",
          "currency": "USD"
        },
        {
          "id": "customs_spec_dcbc618c-7480-4651-b59b-d634b0e68e9c",
          "amountSubtotals": {
            "taxes": 10.21,
            "shipping": 25.99,
            "duties": 143,
            "fees": 2,
            "insurance": 100,
            "items": 30.2
          },
          "clearanceType": "COMMERCIAL",
          "currency": "USD"
        }
      ]
    }
  }
}

Was this page helpful?