Create a Label

Before you begin

Creating a shipping label requires the following steps:

  1. Prepare your request

  2. Send the request

  3. Obtain the label

Step 1: Preparing your request

API Endpoint

To create a label, simply send an HTTP POST request to: https://api.shipcaddie.com/api/v2.1/getshippinglabels. For simplicity, we refer to this as /v2.1/getshippinglabels

Authentication

All ShipCaddie API endpoints will require authentication through an Access Token. This is how we know who is making the call. If you don’t have an Access Token refer to our guide: How to Obtain an Access Token. Include your Access Token at the start of your request body.

Next you will need to obtain both your Carrier client contract and Carrier service level ID's. If you don't already have these id's refer to our guide: How to obtain a carrier client contract ID

Requested Body

The body of your HTTP request is where you’ll enter all of your details about the shipping label that you want to create, such as “from” and “to” addresses, and information pertaining to the package such as weight and dimensions.

Requested Body Example

Below is an example of what our create label request body will look like with all of the information listed above:

{   
"accessToken": "YTcWPmtxXW6ENMvnbxxp…",   
"shipment": {     
},     
"carrierClientContractId": 1234,     
"carrierServiceLevelId": 1115,     
"addressFrom": {       
"companyName": "ShipCaddie",       
"address1": "2600 Executive Pkwy",       
"address2": "#160",       
"city": "Lehi",       
"stateOrProvince": "UT",       
"postalCode": "84043",       
"countryCode": "US",       
"phoneNumber": "(844)381-7447"     
},     
"addressTo": {       
"attentionOf": "Jane Doe",       
"address1": "2605 Executive Pkwy",       
"address2": "#160",       
"city": "Lehi",       
"stateOrProvince": "UT",       
"postalCode": "84043",       
"countryCode": "US"     
},     
"parcels": [       
{         
"weightInPounds": 0.4,         
"lengthInInches": 5,         
"widthInInches": 4,         
"heightInInches": 12         
}     
]
}

Step 2: Sending the request

Now let’s put all the information from Step 1 together using your preferred method mentioned at the start of this guide. The example below includes all the information previously mentioned in Step 1:

  • Make a POST call to https://api.shipcaddie.com/api/v2.1/getshippinglabels

  • Include your ShipCaddie Access Token at the beginning of your body request

  • Use the Request Body of the sample json code from above

Next you have a few options. Using our API Reference Docs you can fill in the information above into the “Explorer” tab located in the middle pane, or for Curl and other language method examples select the language option within our reference docs.

Alternatively you can paste the following json example into a third party tool such as Postman.

{   
"accessToken": "YTcWPmtxXW6ENMvnbxxp…",   
"shipment": {     
},     
"carrierClientContractId": 1234,     
"carrierServiceLevelId": 1115,     
"addressFrom": {       
"companyName": "ShipCaddie",       
"address1": "2600 Executive Pkwy",       
"address2": "#160",       
"city": "Lehi",       
"stateOrProvince": "UT",       
"postalCode": "84043",       
"countryCode": "US",       
"phoneNumber": "(844)381-7447"     
},     
"addressTo": {       
"attentionOf": "Jane Doe",       
"address1": "2605 Executive Pkwy",       
"address2": "#160",       
"city": "Lehi",       
"stateOrProvince": "UT",       
"postalCode": "84043",       
"countryCode": "US"     
},     
"parcels": [       
{         
"weightInPounds": 0.4,         
"lengthInInches": 5,         
"widthInInches": 4,         
"heightInInches": 12         
}     
]
}

If your request was successful, you’ll receive an HTTP 200 response that looks similar to this:

{     
"labels": [         
{             
"parcelIndex": 1,             
"printFormat": 1,             
"base64Label": "iVBORw0KGg...",             
"labelKey": "12380356_12381171_shp_a43a4a16c8a14a0aadb830f8beb3006c",             
"trackingNumber": "9405500895239064615632",             
"labelURL": "https://idrivelogs.blob.core.windows.net/label/12380356_12381171_shp_a43a4a16c8a14a0aadb830f8beb3006c.png"         
}     
],     
"shipmentID": 12380356,     
"carrier": "USPS",     
"serviceLevel": "Priority Mail",     
"totalAmount": 7.16,     
"error": {         
"details": [],         
"hasError": false     
}
}

ShipCaddies responses include the following information:

  • Label cost

  • A link to download the label

  • A base 64 string

  • Carrier

  • Service level

  • Print Format

  • Tracking number

Step 3: Obtain your label

Now that you’ve completed Step 2, you’ll receive an HTTP response that includes all the label details. Among these details are some URLs to download the label in various formats.

ShipCaddie has a total of 15 different print format options that are available through our API, simply specify your requested format in your API body request with the parameter “printFormat” . These URLs are just like any other URLs, in that you can paste them into a browser to download the file.

Congratulations! You’ve now created your first ShipCaddie label! Check out our Full Reference API Documentation.

Obtain Rates

Before you begin

This Guide helps you to make a POST call to get shipping rates for your multiple carrier and service options. Display these at checkout to let your customers choose the fastest, cheapest, or most-trusted route when you ship your products.

Similar to the Creating a Label guide we need to know some basic information to get a rate.

REQUIREMENTS

To get rates, you must locate and include the following:

A carrier contract id
A carrier service level id
Before you begin you may choose to validate the address to help ensure that you get back the most-accurate rates possible. Check out our Validate Address guide here.

Example Requests

POST /api/v2.1/GetRates

Below is an example of POST a call in JSON, the response returns you should see, and how to understand and use their results.

{ 
"accessToken": "lKGTGIQFour..",
"shippingInfo": {
"carrierClientContractId": 2021,
"serviceLevelId": 1115,
"options": {
"shipmentContentType": "CONTENT_TYPE_SAMPLE"
},
"addressFrom": {
"companyName": "ShipCaddie",
"address1": "2600 Executive Pkwy",
"address2": "#160",
"city": "Lehi",
"stateOrProvince": "UT",
"postalCode": "84043",
"countryCode": "US",
"phoneNumber": "(844)381-7447"
},
"addressTo": {
"attentionOf": "Jane Doe",
"address1": "2605 Executive Pkwy",
"address2": "#160",
"city": "Lehi",
"stateOrProvince": "UT",
"postalCode": "84043",
"countryCode": "US"
},
"parcels": [
{
"packagingId": "",
"weightInPounds": 0.4,
"lengthInInches": 5,
"widthInInches": 4,
"heightInInches": 12
}
]
}
}

Example Response

The response can be quite intimidating depending on how many carriers you requested rates from.

For this example we only used one in our response below, however, it does display multiple service levels. As you can see the information displayed can get quite extensive.

{ 
"processingTimeInSeconds": 0.46879129999999997,
"carrierName": "USPS via ShipCaddie",
"carrierClientContractId": 2021,
"data": [
{
"serviceLevelName": "Priority Mail",
"serviceLevelID": 1115,
"parcelChargeDetails": [
{
"parcelID": "3c1e5e9e-afa9-497a-85fb-7c677d8e6e46",
"costDetails": [
{
"name": "Freight Charge",
"amount": 7.16
}
],
"packagingId": "0-0"
}
],
"shippingChargeDetails": [],
"transitDaysMin": 2,
"transitDaysMax": 3,
"totalChargeAmount": 7.16,
"totalChargeAmount3pl": 0.0,
"deliveryDateTime": "2/23/2021 12:00:00 AM",
"isDeliveryGuaranteed": false,
"zoneName": "1"
},
{
"serviceLevelName": "Express Mail",
"serviceLevelID": 1118,
"parcelChargeDetails": [
{
"parcelID": "23008d05-a86e-438a-98fe-8e0c412e4c19",
"costDetails": [
{
"name": "Freight Charge",
"amount": 22.75
}
],
"packagingId": "0-0"
}
],
"shippingChargeDetails": [],
"transitDaysMin": 1,
"transitDaysMax": 2,
"totalChargeAmount": 22.75,
"totalChargeAmount3pl": 0.0,
"deliveryDateTime": "2/23/2021 12:00:00 AM",
"isDeliveryGuaranteed": false,
"zoneName": "1"
},
{
"serviceLevelName": "First Class Package",
"serviceLevelID": 1122,
"parcelChargeDetails": [
{
"parcelID": "309bf0aa-d2ce-4158-b42e-67081dc0d913",
"costDetails": [
{
"name": "Freight Charge",
"amount": 3.46
}
],
"packagingId": "0-0"
}
],
"shippingChargeDetails": [],
"transitDaysMin": 1,
"transitDaysMax": 3,
"totalChargeAmount": 3.46,
"totalChargeAmount3pl": 0.0,
"deliveryDateTime": "2/23/2021 12:00:00 AM",
"isDeliveryGuaranteed": false,
"zoneName": "1"
},
{
"serviceLevelName": "Media Mail",
"serviceLevelID": 1123,
"parcelChargeDetails": [
{
"parcelID": "b2c48b60-95a5-4a9e-bda5-10a6d6e8a596",
"costDetails": [
{
"name": "Freight Charge",
"amount": 2.89
}
],
"packagingId": "0-0"
}
],
"shippingChargeDetails": [],
"transitDaysMin": 2,
"transitDaysMax": 8,
"totalChargeAmount": 2.89,
"totalChargeAmount3pl": 0.0,
"deliveryDateTime": "2/23/2021 12:00:00 AM",
"isDeliveryGuaranteed": false,
"zoneName": "1"
},
{
"serviceLevelName": "Parcel Select - Ground",
"serviceLevelID": 1124,
"parcelChargeDetails": [
{
"parcelID": "291e6793-5e3e-4224-a941-0cc0020c3566",
"costDetails": [
{
"name": "Freight Charge",
"amount": 7.01
}
],
"packagingId": "0-0"
}
],
"shippingChargeDetails": [],
"transitDaysMin": 2,
"transitDaysMax": 8,
"totalChargeAmount": 7.01,
"totalChargeAmount3pl": 0.0,
"deliveryDateTime": "2/23/2021 12:00:00 AM",
"isDeliveryGuaranteed": false,
"zoneName": "1"
}
],
"error": {
"details": [],
"hasError": false
}
}

Once the rate request is completed you’ll see each service level includes:

Validate an Address

Shipping to an incorrect address can be costly and leave a customer feeling less than satisfied. ShipCaddie cross-references multiple databases to ensure accurate address validation to eliminate any potential shipping issues that may arise.

Available Countries

ShipCaddie supports address validation from every country on the PGA tour plus 240+ countries and territories

Example

POST /api/v2.1/ValidateAddress
This is a full request you can make to the address verification service.
POST /api/v2.1/ValidateAddress

{     
"accessToken": "lKGTGI…",     
"addressToValidate": {         
"address1": "2600 Executive Parkway",         
"address2": "STE 160",         
"city": "Lehi",         
"countryCode": "US",         
"stateOrProvidence": "UT",         
"postalCode": "84043",         
"isResidential": false     
}
}

The Address Validation Response is provided for every address sent to the Address Validator, in the order it was received.

POST /api/v2.1/ValidateAddress

{     
"addressIsValidated": true,        
"validatedAddress": {         
"address1": "2600 W EXECUTIVE PKWY",         
"address2": "STE 160",         
"city": "LEHI",         
"countryCode": "US",         
"stateOrProvidence": "UT",         
"postalCode": "84043-3987",         
"isResidential": false,
"companyName": null,        
},     
"error": {         
"details": [],         
"hasError": false     
}
}

Validate Address Responses

Sample Responses

Validate True

{     
"addressIsValidated": true,        
"validatedAddress": {         
"address1": "2600 W EXECUTIVE PKWY",         
"address2": "STE 160",         
"city": "LEHI",         
"countryCode": "US",         
"stateOrProvidence": "UT",         
"postalCode": "84043-3987",        
  "isResidential": false,
"companyName": null,        
},     
"error": {         
"details": [],         
"hasError": false     
}
}

Validate False

{     
"addressIsValidated": false,     
"validationMessages": [],     
"validatedAddress": {         
"address1": "",         
"address2": "",         
"city": "",         
"countryCode": "",         
"stateOrProvidence": "",         
"postalCode": "",         
"isResidential": false,         
"attentionOf": "",         
"companyName": "",         
"email": "",         
"phoneNumber": ""     
},     
"error": {         
"details": [             
"Address Validation Error"         
],         
"hasError": true     
}
}

Auto Corrected Status

{     
"addressIsValidated": true,     
"validationMessages": [         
{             
"code": "Auto corrected",             
"message": "Some of the fields are auto corrected based on suggestions"         
}     
],     
"validatedAddress": {         
"address1": "2600 W EXECUTIVE PKWY",         
"address2": "STE 160",         
"city": "LEHI",         
"countryCode": "US",         
"stateOrProvidence": "UT",         
"postalCode": "84043-3987",         
"isResidential": false,         
"attentionOf": "",         
"companyName": null,         
"email": "",         
"phoneNumber": ""     
},     
"error": {         
"details": [],         
"hasError": false     
}
}

Authentication

HOW TO OBTAIN AN ACCESS TOKEN

Access Tokens

To authenticate yourself to ShipCaddie, you need to include an Access Token in each API call. If you don’t include an Token when making an API request, or if you use an incorrect or expired Token, then ShipCaddie will respond with an error “AccessToken is missing.”

Below is an example of an API request to validate an address. This example shows the Access Token at the start of the body in the request.

{ 
"accessToken": "YTcWPmtxXW6ENMvnbxxp...,
"addressToValidate": {
"address1": "2600 Executive Pkwy",
"address2": "Suite 160",
"city": "Lehi",
"countryCode": "US",
"stateOrProvidence": "UT",
"postalCode": "84043"
}
}

To obtain an Access Token you’ll need to send a HTTP POST request to https://api.shipcaddie.com/api/v2.1/GetToken either using our API Reference Docs, or through a third party tool such as Postman and Curl.

Endpoints to get an Access Token

There are two different endpoints to get an Access Token:

accessToken: This endpoint takes a username and password as the credentials. It will return an accessToken and a refreshToken as the response.
On the ShipCaddie API reference page make a POST call under the “Authentication” header to obtain your access token. Anything you do with your access token is used for production and could incur costs. ShipCaddie recommends that you include the “Test” function for all testing or development purposes.

refreshToken: When the accessToken expires, you can get another one without the username and password used above. This endpoint takes the refreshToken issued when the original accessToken was given. This will return another valid accessToken and a new refreshToken. NOTE: the refreshToken is a one-time use token. It cannot be used more than once to get a new token. Also, if the accessToken endpoint is called with the same username/password to get a token, it invalidates all previously issued refreshTokens.
On the ShipCaddie API reference page make a POST call under the “Authentication” header to obtain your refresh token. Use this function for when your access token expires. You will generate a new refresh token every 31 days, so each individual should use their own unique refresh token to avoid an authentication error.

Keep Your Credentials & Access Tokens Safe

Your Credentials and Access tokens give you full access to ShipCaddie’s functionality. With this in mind ShipCaddie recommends that you should treat them as you would treat a password or other sensitive credentials.

Below are some methods that can help keep your Credentials & Access Tokens secure:

  • Limit who has access to your credentials and tokens

  • Don’t share your credentials

  • Create multiple user accounts instead of multiple people having access to a single account. ShipCaddie allows unlimited user accounts for this purpose

  • Don’t hard-code your credentials into your source code or config files

  • Ensure your Credentials are kept out of any open source sites such as GitHub

Carrier Client Contract & Carrier Service level Id’s

To request a label from a specific carrier you will need to identify which carrier you would like to create that label with as well as what service level you prefer. For example, some USPS service levels are:

  • First Class Package

  • Priority Mail

  • Express Mail

To name a few. Both the Carrier Account that you wish to use and the Service Level will have a unique ID associated with it and is required to create a label.

Note unless you have entered your carrier information for other carriers, you will only receive ShipCaddies USPS negotiated rates

To obtain both Carrier Contract ID and Carrier Service Level ID you’ll need to send a HTTP POST request to https://api.shipcaddie.com/api/v2.1/GetCarrierServiceInformation either using our API Reference Docs, or through a third party tool such as Postman and Curl using your Access Token. If you don’t have an access token.

Below is a response example that shows both the “carrierContractId” and a “carrierServiceLevelID”.

{ 
"carrierServiceList": [
{
"carrierClientContractId": 1234,
"carrierName": "USPS",
"serviceLevels": [
{
"carrierServiceLevelID": 1115,
"name": "Priority Mail",
"parcelWeightLimit": 70.0,
},
{
"carrierServiceLevelID": 1116,
"name": "Express Mail Int'l",
"parcelWeightLimit": 70.0,
},
{
"carrierServiceLevelID": 1117,
"name": "Priority Mail Int'l",
"parcelWeightLimit": 70.0,
}
]
}
]
}

What’s the difference between both IDs?

Carrier Client Contract ID


A Carrier Client Contract Id is linked to a specific carrier account number for that client.
For example if you have 2 accounts with UPS, then they will have 2 different Carrier Client Contract Id’s meaning each account will have a unique id.

Carrier Service Level ID


A Carrier Service Level ID is a unique ID for each service level offered by the carriers. These ID’s will not be duplicated across different carriers or within the same carrier, however, these IDs remain the same for all clients.