Site Logo

Use a Carrier Service

While we technically covered this in Quickstart: Create a Label we didn't break out and explain what was happening.

When creating a label, a few things can happen where we figure out how you want to ship.

We'll expand and highlight the changes we made to the request body from the Quickstart. Let's say we really need to get this package to it's destination quickly, so we want to use Priority Mail Expressâ„¢.

We can use the service_code provided in the carrier services list.

Example

POST /v1/labels/

Example Request

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
POST /v1/labels HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"shipment": {
"carrier_id": "se-123890",
"service_code": "usps_priority_mail_express",
"ship_to": {
"name": "Amanda Miller",
"phone": "555-555-5555",
"address_line1": "525 S Winchester Blvd",
"city_locality": "San Jose",
"state_province": "CA",
"postal_code": "95128",
"country_code": "US",
"address_residential_indicator": "yes"
},
"ship_from": {
"company_name": "Example Corp.",
"name": "John Doe",
"phone": "111-111-1111",
"address_line1": "4009 Marathon Blvd",
"address_line2": "Suite 300",
"city_locality": "Austin",
"state_province": "TX",
"postal_code": "78756",
"country_code": "US",
"address_residential_indicator": "no"
},
"packages": [
{
"weight": {
"value": 9.6,
"unit": "ounce"
},
"dimensions": {
"unit": "inch",
"length": 12.0,
"width": 7.1,
"height": 6.0
}
}
]
}
}

Example Response

Notice we had already included a service_code in the Quickstart example. We changed that to another service that corresponds with our carrier_id.

1
2
3
4
{
"carrier_id": "se-123890",
"service_code": "usps_priority_mail_express"
}