Get your API key
Get a Zonos account: In order to use the Zonos API you will need an API key. To get your key you will need to complete our sign-up form. Onboarding will begin once you have an account agreement in place. During onboarding, a representative will help you set up your account correctly so that you get the most accurate API responses.
Access your API key here if you have a Zonos account. This will allow you to authenticate with the Zonos API. If you don't have an account see the note above.
Decide what details to retrieve
You can query lists of orders based on similar accountOrderId
s or by providing a date range between which orders were published. For a complete list of available fields, consult the GraphQL API reference.
On each individual order you query, all normal Order
fields are available, e.g., the country, shipping information, landed cost totals, etc.. All possible fields are listed in the GraphQL API reference.
Query
query orders($ordersFilter: OrdersFilter, $first: Int) {
orders(filter: $ordersFilter, first: $first) {
edges {
node {
id
# ... field names here
}
}
}
}
Variables
{
"ordersFilter": {
"between": {
"before": "2022-10-01",
"after": "2022-09-01"
}
}
}
Send the pages to fetch
All queries that retrieve lists support Relay-style pagination. The first
variable allows you to specify how many objects are returned.
Query
query orders($filter: OrderFilter!, $first: Int) {
orders(orderFilter: $filter, first: $first) {
# ... field names here
}
}
Variables
{
"first": 20
}
Send your request
Now that you have built your request and configured it, you can send a POST
request to the Zonos API. Make sure to authenticate with your API key and provide the correct version header in your request.
POST https://api.zonos.com/graphql/
Query
query orders($ordersFilter: OrdersFilter, $first: Int) {
orders(filter: $ordersFilter, first: $first) {
edges {
node {
id
items {
description
hsCode
quantity
}
}
}
}
}
Variables
{
"ordersFilter": {
"between": {
"before": "2022-10-01",
"after": "2022-09-01"
}
},
"first": 20
}
Response
{
"data": [
{
"order": {
"id": "1000753",
"items": [
{
"description": "Blue Snorkle Set",
"hsCode": "9506290000",
"quantity": 2
}
]
}
}
]
}
Searching and filtering orders
Retrieve lists of orders with GraphQL.Using the
orders
query in GraphQL, you can retrieve paginated lists of orders with various criteria. This is useful when you need a list of orders by country, between specific dates, to build a search, etc.