Solve complex shipping logistics problems with a single integration. By leveraging EasyPost's technology, businesses can streamline, automate, and gain end-to-end control of their shipping process with our suite of flexible RESTful API solutions. Join thousands of customers shipping millions of packages with EasyPost's shipping solutions.
Get $100 after you spend $100.* Start shipping today!
import easypost
import os
client = easypost.EasyPostClient(os.getenv("EASYPOST_API_KEY"))
shipment = client.shipment.create(
to_address={"id": "adr_..."},
from_address={"id": "adr_..."},
parcel={
"predefined_package": "Parcel",
"weight": 32.8,
},
)
client.shipment.buy(
shipment.id,
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
}
Take a look at our 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's shipping solutions.
Get $100 after you spend $100.* Start shipping today!