Generate your first label using Postman

Note

If you would prefer to learn how to create your first shipping label using cURL, see our guide to create your first shipping label.

Use the Shippo API to programmatically create shipping labels from any supported carrier. Follow this guide and videos to learn how to create your first label using our Postman collection.

Note

Before starting this guide, follow the Authentication guide to generate your API Token.

When learning about and testing the Shippo API, we recommend using the test token. Using your test token means all the calls you make to the Shippo API are free.

Introduction

To retrieve all available rates and create a shipping label based on one of the rates, you need to follow two simple steps:

  1. Create the Shipment object , consisting of two Address objects (address from and address to) and a Parcel object (blue objects below). The Shipment response contains the list of available Rates and their associated object ID.
  2. Create the Transaction object , i.e. the actual label, for any of the Rates from the Shipment response (green object below).

Object Flow

Get started with Postman

If you don't already have a Postman account, create a new account. To use Postman you will also need to download Postman or use the online tool.

This is the link to our Postman collection that you can add to your Postman workspace.

This video will help you get started if you're unfamiliar with Postman.

Create Address objects

Create a from Address object

Shippo’s API will save addresses without distinguishing the purpose of that address. You will post the address and save the object ID for reference to it. The endpoint for this is https://api.goshippo.com/addresses/.

To make things easier, the Postman call is set up to save the object ID from this response as a variable named FROM_ADDRESS. This will be stored and later used for making a label purchase. The address will be tagged with Metadata to indicate this is the Home Office. This is a good simulation of how you would store and retrieve an object ID in production.

You can examine the response in the bottom section of the Postman screen. In the response you can see the object ID that was saved for this address and also see that Shippo’s address validation corrected a spelling error in the address's city.

Create a to Address object

Just like the From Address, this step will save and validate the To Address for our shipment. The Postman call is set to save this as the TO_ADDRESS environment variable for the label being created.

This video will walk you through saving the To and From addresses in Postman and demonstrate saving the object IDs.

Create Shipment object

A shipment is not a label. This is an important distinction to note when using the Shippo API. A shipment is the combination of To and From addresses with Parcel information. Parcel information is the size and weight of a package. To create a shipment a post request will be sent to https://api.goshippo.com/shipments.

In the Shipment response, Shippo will show you rates for all of your enabled carriers along with recommendations for best, fastest, and cheapest rates. You can also see the full addresses you stored earlier in the response. Scroll through the response and copy an object ID from one of the rates returned so this can be used to purchase a label.

Create a Transaction object

You can now use the object ID of the rate that was saved in step 2 icon to purchase a label. This is done by sending a post call to the https://api.goshippo.com/transactions endpoint.

In the body of the Step 4 call, replace the object ID of the rate with the one copied from Step 3 and send the call.

When examining the response you will see the id of this label, the tracking number, and the url to view or print the label.

This video will walk you through creating the Shipment object and purchasing the label for a chosen rate.