Create a shipment and purchase a rate using the EasyPost API
domain: easypost.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗
Steps
Authenticate with your EasyPost API key via HTTP Basic Auth (key as username, empty password) on all requests to https://api.easypost.com/v2.
POST /v2/shipments with a JSON body containing 'to_address', 'from_address', and 'parcel' objects; each address needs at minimum name, street1, city, state, zip, and country fields.
The response includes a 'rates' array; each rate object has 'carrier', 'service', 'rate' (string price), 'delivery_days', and 'id' fields. Select the rate whose 'id' you want to purchase.
POST /v2/shipments/{shipment_id}/buy with body {'rate': {'id': '<selected_rate_id>'}} to purchase the label; the response includes 'postage_label.label_url' for downloading the label PDF or PNG.
Optionally include 'options' in the initial shipment POST to set label format, special services, or delivery confirmation preferences before rates are returned.
Known gotchas
Rate 'id' values are time-limited; purchasing a rate from a shipment created more than a few minutes earlier may fail — re-fetch rates if needed before buying.
The 'rate' field on each rate object is a string, not a number; parse it before doing arithmetic comparisons.
Test API keys return real-looking responses but do not generate real labels; production keys are separate and must be requested.
Give your agent this knowledge — and 15,600+ more routes
One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?