Site Logo

Create a Label from a Rate

If you have a rate ID, either from previously calculating shipping rates or creating a shipment with rate options, you can use the rate_id to create a label.

When you use a rate_id to create a label you've already done the hard part! We persist all of the rate information so you just need to pass us the rate_id. Update the cURL command below to use a rate_id you gathered from a previous response.

Requirements

  • This tutorial assumes you know how to get shipment rates.
  • You will need to use the rate_response[i].rate_id from the get shipment rates request.

Example Request & Response

POST v1/labels/rates/:rate_id

Similar to the example in Create a Shipping Label, this example will request a label using the Stamps.com USPS services included with your account. (USPS services are included with US-based ShipEngine accounts. For accounts based in other countries, you can switch to the sandbox to follow along with this tutorial, as Stamps.com USPS services are part of the sandbox for all accounts.)

1
2
3
4
5
6
7
8
9
POST /v1/labels/rates/se-2128728 HTTP/1.1
Host: api.shipengine.com
API-Key: __YOUR_API_KEY_HERE__
Content-Type: application/json
{
"label_format":"pdf",
"label_layout": "4x6"
}

Response

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
{
"label_id": "se-test-2128728",
"status": "completed",
"shipment_id": "se-2128728",
"ship_date": "2019-07-25T05:00:00.000Z",
"created_at": "2019-07-25T18:43:15.038Z",
"shipment_cost": {
"currency": "usd",
"amount": 0.0
},
"insurance_cost": {
"currency": "usd",
"amount": 0.0
},
"tracking_number": "9999999999999",
"is_return_label": false,
"is_international": false,
"batch_id": "",
"carrier_id": "se-0",
"service_code": "usps_priority_mail",
"package_code": "package",
"voided": false,
"voided_at": null,
"label_format": "pdf",
"label_layout": "4x6",
"trackable": false,
"carrier_code": "stamps_com",
"tracking_status": "unknown",
"label_download": {
"pdf": "https://api.shipengine.com/v1/downloads/6/Q2OLdnGaqk-UzkN6pFH0lg/testlabel-202923521.pdf",
"png": "https://api.shipengine.com/v1/downloads/6/Q2OLdnGaqk-UzkN6pFH0lg/testlabel-202923521.png",
"zpl": "https://api.shipengine.com/v1/downloads/6/Q2OLdnGaqk-UzkN6pFH0lg/testlabel-202923521.zpl",
"href": "https://api.shipengine.com/v1/downloads/6/Q2OLdnGaqk-UzkN6pFH0lg/testlabel-202923521.pdf"
},
"form_download": null,
"insurance_claim": null
}

And that's it! The label is available for download using any of the label_download URLs provided in the response.