Zonos logo
DOCS

Create a label

/

Generate a label with the Zonos API

Learn how to create and void labels using the Zonos API.

COMING SOON

In order to faciliate the Landed Cost guarantee, you are typically required to ship orders via Dashboard. If using Dashboard to print labels does not work with your existing processes, you can now generate labels via the Zonos Label API.

Create a label with a shipment 

In order to create a label, you are required to create a shipment that the label will be associated with. You can choose to create a label at the same time as the shipment or after using the shipment ID.

During shipment
Post-shipment

Mutation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
mutation CreateShipment($createShipment: ShipmentCreateInput!) {
	shipmentCreate(input: $createShipment) {
		id
		shipmentCartons {
			tracking {
				id
				label {
					id
					trackingNumber
					createdAt
					url
				}
			}
			carton {
				id
			}
		}
	}
}

Variables

1
2
3
4
5
6
7
8
{
  "createShipment": {
    "orderId": "order_3a369733-3046-4390-b0a4-99a2f8a1c2a2",
    "generateLabel": true,
    "serviceLevel": "service_level_56489602-42fb-4f47-afb3-2135e87d215d",
    "generateCustoms": false
  }
}

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": {
    "shipmentCreate": {
      "id": "shipment_235ac4a5-9e8f-43be-9483-6cf1640c386b",
      "shipmentCartons": [
        {
          "tracking": {
            "id": "tracking_544f408e-54f6-478e-84d3-79c02353a065",
            "label": {
              "id": "label_bd402891-4ec2-4de0-921a-da9b1e5d5963",
              "trackingNumber": "CM289918636US",
              "createdAt": "2023-04-20T15:29:59.925-06:00",
              "url": "https://zonos-prod.s3.amazonaws.com/public/files/label_images/20230420/a2924ff8-d4ce-4480-87c5-e9decd5f2378.pdf"
            }
          },
          "carton": {
            "id": "carton_cba16718-452f-4e55-b8f8-370c76849263"
          }
        }
      ]
    }
  }
}

Voiding a label 

In the event that you wish to cancel a label that has been created, you can use the following mutation to void the label.

Mutation

1
2
3
mutation LabelVoid($input: LabelVoidInput!) {
	labelVoid(input: $input)
}

Variables

1
2
3
4
5
{
  "input": {
    "id": "label_58a9811d-a602-4443-9461-1b656d13afdf"
  }
}

Response

1
2
3
4
5
{
  "data": {
    "labelVoid": "SUCCESS"
  }
}