EasyPost's flexible, modern Shipping API makes it easy to rate shop between carriers, buy and print labels, verify addresses, track packages, and insure shipments. Simplify your shipping operations and delight shoppers.
Your first $250 is on us. Start shipping today!
# Import the EasyPost client.
import easypost
# Setup the client with your API key.
easypost.api_key = '259DA788-39A3-439E-BA1E-BC541B8BA520'
# Purchase a shipment to receive a postage label.
shipment = easypost.Shipment.retrieve(
'shp_339f74ca0aa840d399bbb728a3ac3863'
)
shipment.buy(rate=shipment.lowest_rate())
{
"id": "shp_339f74ca0aa840d399bbb728a3ac3863",
"object": "Shipment",
"created_at": "2020-02-08T21:34:49Z",
"updated_at": "2020-02-08T21:35:07Z",
"mode": "test",
"tracking_code": "9405500897846033166521",
"usps_zone": 4,
"status": "unknown",
"is_return": false,
"postage_label": {
"id": "pl_36091b719cc74ecc8a81f3a2ab19a096",
"object": "PostageLabel",
"created_at": "2020-02-08T21:35:07Z",
"updated_at": "2020-02-08T21:35:07Z",
"label_date": "2020-02-08T21:35:07Z",
"label_url": "https://easypost-files.s3-us-west-2.amazonaws.com/files/postage_label/20200208/6fa468158bce435da2cc864bd1a3de29.png",
"label_file_type": "image/png",
"label_size": "4x6",
"label_resolution": 300,
"label_zpl_url": null,
"label_pdf_url": null,
"label_epl2_url": null,
"date_advance": 0,
"label_type": "default",
"integrated_form": "none"
},
"tracker": {
"id": "trk_b05ab048e81c42ad8abea9c38dbceef4",
"object": "Tracker",
"created_at": "2020-02-08T21:35:07Z",
"updated_at": "2020-02-08T21:35:07Z",
"mode": "test",
"tracking_code": "9405500897846033166521",
"carrier": "USPS",
"public_url": "https://track.easypost.com/djE6dHJrX2IwNWFiMDQ4ZTgxYzQyYWQ4YWJlYTljMzhkYmNlZWY0",
"est_delivery_date": null,
"status": "unknown",
"status_detail": "unknown",
"is_return": false,
"tracking_details": [],
"carrier_detail": null,
"fees": [],
"shipment_id": "shp_339f74ca0aa840d399bbb728a3ac3863",
"signed_by": null,
"weight": null
},
"selected_rate": {
"id": "rate_22e495348fe44d4894b3e86a31e03cd4",
"object": "Rate",
"created_at": "2020-02-08T21:35:07Z",
"updated_at": "2020-02-08T21:35:07Z",
"mode": "test",
"carrier": "USPS",
"service": "Priority",
"rate": "9.39",
"currency": "USD",
"list_rate": "9.39",
"list_currency": "USD",
"retail_rate": "12.25",
"retail_currency": "USD",
"delivery_days": 2,
"delivery_date": null,
"delivery_date_guaranteed": false,
"carrier_account_id": "ca_9dcec3346e6145f5b865e04e2e1bbf93",
"shipment_id": "shp_339f74ca0aa840d399bbb728a3ac3863"
},
"from_address": {
"id": "adr_cd41b97d1d814a50b07bb18267d961e1",
"object": "Address",
"created_at": "2020-02-08T21:34:49Z",
"updated_at": "2020-02-08T21:34:49Z",
"mode": "test",
"name": "EasyPost",
"company": null,
"email": "support@easypost.com",
"street1": "417 Montgomery Street",
"street2": "5th Floor",
"city": "San Francisco",
"zip": "94104",
"state": "CA",
"country": "US",
"phone": "4153334444",
"residential": null,
"federal_tax_id": null,
"state_tax_id": null,
"carrier_facility": null,
"verifications": {}
},
"to_address": {
"id": "adr_5568259f33ea497ebed1e9495551b7f2",
"object": "Address",
"created_at": "2020-02-08T21:34:49Z",
"updated_at": "2020-02-08T21:35:06Z",
"mode": "test",
"company": null,
"email": "dr_steve_brule@gmail.com",
"street1": "179 N Harbor Dr",
"street2": null,
"city": "Redondo Beach",
"state": "CA",
"zip": "90277-2506",
"country": "US",
"name": "Dr. Steve Brule",
"phone": "4153334444",
"residential": false,
"state_tax_id": null,
"federal_tax_id": null,
"carrier_facility": null,
"verifications": {
"zip4": {
"details": null,
"errors": [],
"success": true
}
}
},
"return_address": {
"id": "adr_cd41b97d1d814a50b07bb18267d961e1",
"object": "Address",
"created_at": "2020-02-08T21:34:49Z",
"updated_at": "2020-02-08T21:34:49Z",
"mode": "test",
"name": "EasyPost",
"company": null,
"email": "support@easypost.com",
"street1": "417 Montgomery Street",
"street2": "5th Floor",
"city": "San Francisco",
"zip": "94104",
"state": "CA",
"country": "US",
"phone": "4153334444",
"residential": null,
"federal_tax_id": null,
"state_tax_id": null,
"carrier_facility": null,
"verifications": {}
},
"parcel": {
"id": "prcl_2ae2dcb504cf4c53a72972f0cc944d97",
"object": "Parcel",
"created_at": "2020-02-08T21:34:49Z",
"updated_at": "2020-02-08T21:34:49Z",
"mode": "test",
"length": 20.2,
"width": 10.9,
"height": 5.0,
"weight": 65.9,
"predefined_package": null
},
"fees": [
{
"object": "Fee",
"type": "LabelFee",
"amount": "0.00000",
"charged": true,
"refunded": false
},
{
"object": "Fee",
"type": "PostageFee",
"amount": "9.39000",
"charged": true,
"refunded": false
}
],
"options": {
"currency": "USD",
"date_advance": 0,
"label_date": null,
"payment": {
"type": "SENDER"
}
},
"rates": [
{
"id": "rate_22e495348fe44d4894b3e86a31e03cd4",
"object": "Rate",
"created_at": "2020-02-08T21:35:07Z",
"updated_at": "2020-02-08T21:35:07Z",
"mode": "test",
"carrier": "USPS",
"service": "Priority",
"rate": "9.39",
"currency": "USD",
"list_rate": "9.39",
"list_currency": "USD",
"retail_rate": "12.25",
"retail_currency": "USD",
"delivery_days": 2,
"delivery_date": null,
"delivery_date_guaranteed": false,
"carrier_account_id": "ca_9dcec3346e6145f5b865e04e2e1bbf93",
"shipment_id": "shp_339f74ca0aa840d399bbb728a3ac3863"
},
{
"id": "rate_5459b5fb8f244edb9b88ab0e71a1fbe3",
"object": "Rate",
"created_at": "2020-02-08T21:34:50Z",
"updated_at": "2020-02-08T21:34:50Z",
"mode": "test",
"carrier": "USPS",
"service": "Express",
"rate": "41.15",
"currency": "USD",
"list_rate": "41.15",
"list_currency": "USD",
"retail_rate": "47.60",
"retail_currency": "USD",
"delivery_days": 2,
"delivery_date": "2020-02-10T12:00:00Z",
"delivery_date_guaranteed": true,
"carrier_account_id": "ca_9dcec3346e6145f5b865e04e2e1bbf93",
"shipment_id": "shp_339f74ca0aa840d399bbb728a3ac3863"
}
],
"forms": [],
"insurance": null,
"messages": [],
"reference": null,
"refund_status": null,
"scan_form": null,
"customs_info": null
}
EasyPost's Shipping API is the most powerful shipping solution on the market. Our RESTful API makes it easy for developers to integrate quickly. The single point of integration saves hundreds of developer hours so you can focus on your core business rather than shipping.
Our API is customizable to fit your business needs. EasyPost technology powers popular household brands, fulfillment centers, online marketplaces, and enterprises alike. There are dozens of ways to utilize our technology — let's see what you build.
Take a look at our documentation and start building with one of our helper libraries (Python, PHP, Ruby, Node.js, Java, and more). Avoid month-long integrations and start simplifying your shipping in minutes with EasyPost.
Your first $250 is on us. Start shipping today!