Recipes
A Recipe answers one question: I want to accomplish this — what is the shortest correct sequence of requests?
Each one is mostly code. You get the request in cURL, JavaScript, and Python, a trimmed response, the exact field to carry into the next step, and the handful of outcomes that change what your code does next. Anything that needs a longer explanation is a link, not a paragraph.
Recipes call the public Mailhub API directly. There is no SDK to install and no client library to configure — every example is an HTTP request you can paste into your own project.
Where Recipes fit
| Surface | Use it to |
|---|---|
| Recipes | Copy a working sequence for one task |
| Guides | Understand how an operation behaves and what can go wrong |
| Concepts | Learn the model the operations act on |
| API Reference | Read the complete schema for any operation |
Available now
They compose in this order, each one's response feeding the next one's request:
- Create an Order and Get Rates in One Call — one request that creates an Order and returns the Rates for its Shipments.
- Buy a Label from a Selected Rate — spend a Rate identifier and get a Label identifier back.
- Recover a Label Purchase After 202 — when the response arrives before the purchase finishes.
- Download a Label File — the Label bytes, written to disk.
- Create and Download a USPS Label — the whole path in one page, with a USPS Rate chosen from the response.
Two more start from a Label you already have, or from a different scope:
- Cancel a Label — request cancellation of a Label you already purchased, and read the one documented result.
- Run a Shipping Workflow for a Sub-account —
the same Order-to-Label path with
X-SubAccount-Idsent only where the contract gives it an effect.
Start anywhere: each Recipe states the identifiers it needs and where they come from.
Pick by outcome
| You want to | Start here |
|---|---|
| Ship your first parcel end to end | Create and Download a USPS Label |
| Get Rates before committing to anything | Create an Order and Get Rates in One Call |
| Turn a chosen Rate into a Label | Buy a Label from a Selected Rate |
| Get the Label file onto disk | Download a Label File |
Recover a purchase that answered 202 | Recover a Label Purchase After 202 |
| Undo a Label you already bought | Cancel a Label |
| Ship on behalf of one of your Sub-accounts | Run a Shipping Workflow for a Sub-account |
Before you start
Every Recipe assumes you have exchanged an API key for an access token — see
Authentication and Token Lifecycle —
and that your API base URL is configured as MAILHUB_API_BASE_URL. The portal
publishes no fixed API host; use the value supplied for your account.
To run the same operations from the browser instead of your own client, see the API Playground guide.