create_shipment
Create a US shipping label via EasyPost — pass a to_address, from_address and parcel (dimensions in INCHES, weight in OUNCES); the server fetches carrier rates (USPS / UPS / FedEx etc.), buys the CHEAPEST rate by default (or the carrier/service you specify), and returns the shipment_id, tracking_code, printable label_url and the price paid. Bring your own EasyPost API key via header x-easypost-api-key: free TEST keys (prefix EZTK…) buy real USPS test labels end-to-end at no cost (sign up at easypost.com → API Keys); production keys (prefix EZAK…) buy real postage. The key prefix auto-selects the environment. weight (oz) is always required. Owner policy headers gate the label price before any purchase.
Parameters23
| to_name | string | required | Recipient full name. |
| to_street1 | string | required | Recipient street address line 1. |
| to_street2 | string | optional | Optional recipient street address line 2 (apt/suite). |
| to_city | string | required | Recipient city. |
| to_state | string | required | Recipient state — 2-letter code for US (e.g. CA, NY). |
| to_zip | string | required | Recipient ZIP / postal code. |
| to_country | string | optional | Recipient ISO country code. Default US. |
| to_phone | string | optional | Optional recipient phone (some carriers/services require it). |
| from_name | string | required | Sender full name. |
| from_street1 | string | required | Sender street address line 1. |
| from_street2 | string | optional | Optional sender street address line 2. |
| from_city | string | required | Sender city. |
| from_state | string | required | Sender state — 2-letter code for US. |
| from_zip | string | required | Sender ZIP / postal code. |
| from_country | string | optional | Sender ISO country code. Default US. |
| from_phone | string | optional | Optional sender phone. |
| weight | number | required | Parcel weight in OUNCES (oz). Required. 1 lb = 16 oz. |
| length | number | optional | Parcel length in INCHES. Provide length+width+height together, or use predefined_package instead. |
| width | number | optional | Parcel width in INCHES. |
| height | number | optional | Parcel height in INCHES. |
| predefined_package | string | optional | Optional carrier predefined package instead of dimensions (e.g. USPS "FlatRateEnvelope", "Parcel"). If set, length/width/height may be omitted. |
| carrier | string | optional | Optional: restrict to a carrier (e.g. USPS, UPS, FedEx). Default: cheapest across all available carriers. |
| service | string | optional | Optional: restrict to a service level (e.g. Priority, First, Ground). Default: cheapest. |
Raw schema
{
"type": "object",
"properties": {
"to_name": {
"type": "string",
"description": "Recipient full name."
},
"to_street1": {
"type": "string",
"description": "Recipient street address line 1."
},
"to_street2": {
"type": "string",
"description": "Optional recipient street address line 2 (apt/suite)."
},
"to_city": {
"type": "string",
"description": "Recipient city."
},
"to_state": {
"type": "string",
"description": "Recipient state — 2-letter code for US (e.g. CA, NY)."
},
"to_zip": {
"type": "string",
"description": "Recipient ZIP / postal code."
},
"to_country": {
"type": "string",
"description": "Recipient ISO country code. Default US."
},
"to_phone": {
"type": "string",
"description": "Optional recipient phone (some carriers/services require it)."
},
"from_name": {
"type": "string",
"description": "Sender full name."
},
"from_street1": {
"type": "string",
"description": "Sender street address line 1."
},
"from_street2": {
"type": "string",
"description": "Optional sender street address line 2."
},
"from_city": {
"type": "string",
"description": "Sender city."
},
"from_state": {
"type": "string",
"description": "Sender state — 2-letter code for US."
},
"from_zip": {
"type": "string",
"description": "Sender ZIP / postal code."
},
"from_country": {
"type": "string",
"description": "Sender ISO country code. Default US."
},
"from_phone": {
"type": "string",
"description": "Optional sender phone."
},
"weight": {
"type": "number",
"description": "Parcel weight in OUNCES (oz). Required. 1 lb = 16 oz."
},
"length": {
"type": "number",
"description": "Parcel length in INCHES. Provide length+width+height together, or use predefined_package instead."
},
"width": {
"type": "number",
"description": "Parcel width in INCHES."
},
"height": {
"type": "number",
"description": "Parcel height in INCHES."
},
"predefined_package": {
"type": "string",
"description": "Optional carrier predefined package instead of dimensions (e.g. USPS \"FlatRateEnvelope\", \"Parcel\"). If set, length/width/height may be omitted."
},
"carrier": {
"type": "string",
"description": "Optional: restrict to a carrier (e.g. USPS, UPS, FedEx). Default: cheapest across all available carriers."
},
"service": {
"type": "string",
"description": "Optional: restrict to a service level (e.g. Priority, First, Ground). Default: cheapest."
}
},
"required": [
"to_name",
"to_street1",
"to_city",
"to_state",
"to_zip",
"from_name",
"from_street1",
"from_city",
"from_state",
"from_zip",
"weight"
]
}