Zonos logo
DOCS

Retrieve customs documentation graphql

/

Retrieve customs documentation 

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


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

POST https://api.zonos.com/graphql

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.0000,
    "fees": 5.0000,
    "insurance": 10.0000,
    "shipping": 15.9900
   },
   "customsItems": [
    {
     "items": [
      {
       "id": "test_item_123"
      }
     ]
    }
   ]
  }
 }
}

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.

POST https://api.zonos.com/graphql

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.0000,
       "fees": 2.0000,
       "insurance": 100.0000
      }
     }
    },
    {
     "node": {
      "id": "customs_spec_da0015aa-78cc-46c0-9006-bf25e0d7c57f",
      "amountSubtotals": {
       "duties": 143.0000,
       "fees": 2.0000,
       "insurance": 100.0000
      }
     }
    },
    {
     "node": {
      "id": "customs_spec_8e8039f5-2e8c-4958-922f-f4dad0bc190f",
      "amountSubtotals": {
       "duties": 143.0000,
       "fees": 2.0000,
       "insurance": 100.0000
      }
     }
    },
    {
     "node": {
      "id": "customs_spec_30e31150-13fe-423f-952a-13582454744a",
      "amountSubtotals": {
       "duties": 143.0000,
       "fees": 2.0000,
       "insurance": 100.0000
      }
     }
    }
   ]
  }
 }
}

Retrieve customs specs based on order details 

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.


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.

POST https://api.zonos.com/graphql

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"
    }
   }
  }
 }
}

Supply information needed to retrieve Zonos-generated customs documentation for multiple orders 

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

POST https://api.zonos.com/graphql

Query

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
query OrdersQuery($first: Int, $filter: OrdersFilter) {
 orders(first: $first, filter: $filter) {
  edges {
   node {
    id
    references {
     key
     value
    }
    customsSpecs {
     id
     amountSubtotals {
      taxes
      shipping
      duties
      fees
      insurance
      items
     }
     clearanceType
     currency
    }
   }
  }
 }
}

Variables

1
2
3
4
5
6
{
 "first": 5,
 "filter": {
  "storeId": "1234"
 }
}

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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
{
 "data": {
  "orders": {
   "edges": [
    {
     "node": {
      "id": "order_ad8dfd1f-5776-425f-8e4d-a0bd4e7d86e3",
      "references": [
       {
        "key": "storeId",
        "value": "1234"
       },
       {
        "key": "zonosOrderNumber",
        "value": "1234"
       }
      ],
      "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"
       },
       {
        "id": "customs_spec_c76d3fb8-8da1-4cdc-a179-44fbf4aac372",
        "amountSubtotals": {
         "taxes": 10.21,
         "shipping": 25.99,
         "duties": 143,
         "fees": 2,
         "insurance": 100,
         "items": 30.2
        },
        "clearanceType": "COMMERCIAL",
        "currency": "USD"
       },
       {
        "id": "customs_spec_74831f75-0c96-4b70-82f2-a414dc7fa8cd",
        "amountSubtotals": {
         "taxes": 10.21,
         "shipping": 25.99,
         "duties": 143,
         "fees": 2,
         "insurance": 100,
         "items": 30.2
        },
        "clearanceType": "COMMERCIAL",
        "currency": "USD"
       },
       {
        "id": "customs_spec_839def74-8491-4287-a18c-4a288e020d6b",
        "amountSubtotals": {
         "taxes": 10.21,
         "shipping": 25.99,
         "duties": 143,
         "fees": 2,
         "insurance": 100,
         "items": 30.2
        },
        "clearanceType": "COMMERCIAL",
        "currency": "USD"
       }
      ]
     }
    },
    {
     "node": {
      "id": "order_21cda40b-d5fa-4acc-90fd-017c9d250d4a",
      "references": [
       {
        "key": "storeId",
        "value": "1234"
       },
       {
        "key": "zonosOrderNumber",
        "value": "11212"
       }
      ],
      "customsSpecs": [
       {
        "id": "customs_spec_9c43dd9b-c545-4e21-b9f5-b3f666a3524e",
        "amountSubtotals": {
         "taxes": 10.21,
         "shipping": 25.99,
         "duties": 143,
         "fees": 2,
         "insurance": 100,
         "items": 30.2
        },
        "clearanceType": "COMMERCIAL",
        "currency": "USD"
       }
      ]
     }
    },
    {
     "node": {
      "id": "order_11bba40b-d5fa-4acc-90fd-017c9d250d4a",
      "references": [
       {
        "key": "storeId",
        "value": "1234"
       },
       {
        "key": "zonosOrderNumber",
        "value": "11212"
       }
      ],
      "customsSpecs": [
       {
        "id": "customs_spec_6349596e-7ea7-475f-85f5-0ce3681ab4b7",
        "amountSubtotals": {
         "taxes": 10.21,
         "shipping": 25.99,
         "duties": 143,
         "fees": 2,
         "insurance": 100,
         "items": 30.2
        },
        "clearanceType": "COMMERCIAL",
        "currency": "USD"
       }
      ]
     }
    }
   ]
  }
 }
}