Create Order
mailhub_create_order
Create an Order from a sender address, a recipient address, and one parcel. It does not rate the Order and does not buy a Label, so it spends nothing.
Permission and safety
| Changes data | Yes |
| Confirmation | Required — confirm: true |
| Spends funds | No |
| Permission | Update access to Orders |
Confirmation is enforced by the server. A call without confirm: true is
refused with MCP_CONFIRMATION_REQUIRED and creates nothing.
Input
| Field | Type | Required | Notes |
|---|---|---|---|
order | object | Yes | The Order to create |
confirm | boolean | No | Defaults to false; the operation is refused unless the value is the boolean true |
order:
| Field | Type | Required | Notes |
|---|---|---|---|
toAddress | address | Yes | Destination (recipient) address |
fromAddress | address | Yes | Origin (sender) address |
shipments | array | Yes | Exactly one Shipment, carrying one parcel. Create another Order for another box |
Address — the same rules apply to both fromAddress and toAddress.
Order creation through MCP is US domestic only:
| Field | Type | Required | Rule |
|---|---|---|---|
name | string | Conditional | Provide name, company, or both. Max 50 characters, printable ASCII |
company | string | Conditional | Provide company, name, or both. Max 50 characters, printable ASCII |
street1 | string | Yes | Max 50 characters, printable ASCII |
street2 | string | No | Max 50 characters, printable ASCII |
city | string | Yes | Max 50 characters, printable ASCII |
state | string | Yes | Two-letter US state or territory code, for example TX |
zip | string | Yes | Five digits, or ZIP+4 — 78701 or 78701-1234 |
country | string | Yes | US only. USA and United States are rejected |
phone | string | Yes | A US number: ten digits with an area code starting 2–9, optionally prefixed with country code 1. +, spaces, dashes, dots and parentheses are accepted |
email | string | No | Must be a valid address when supplied |
residential | boolean | No |
The Shipment carries one parcel. Either name a package Mailhub recognises or
give all three dimensions:
| Field | Type | Required | Rule |
|---|---|---|---|
weight | decimal | Yes | Greater than 0 and at most 150 pounds |
predefinedPackage | string | Conditional | A package code Mailhub recognises. Omit it for a custom parcel; an unrecognised code is rejected and the message names it |
length | decimal | Conditional | Required for a custom parcel — at least 6 and at most 119 inches |
width | decimal | Conditional | Required for a custom parcel — at least 4 inches |
height | decimal | Conditional | Required for a custom parcel — at least 1 inch |
With a recognised predefinedPackage, the dimensions may be omitted; Mailhub
uses the package's own. Without one, all three are required together — giving only
two of the three is rejected. Length plus girth (twice the sum of width and height) may
be at most 165 inches; a parcel outside these limits is refused with
Parcel.OutsideCarrierLimits. Carriers apply lower limits of their own when
rating — see Address and Parcel Data.
Example input
{
"order": {
"fromAddress": {
"name": "Warehouse Team",
"company": "Northline Goods",
"street1": "500 Lake Shore Ave",
"city": "Columbus",
"state": "OH",
"zip": "43215",
"country": "US",
"phone": "3112010144"
},
"toAddress": {
"name": "Maria Alvarez",
"street1": "72 Elm Street",
"street2": "Apt 4",
"city": "Austin",
"state": "TX",
"zip": "78701",
"country": "US",
"phone": "3112010188",
"residential": true
},
"shipments": [
{
"parcel": {
"weight": 2.5,
"length": 12,
"width": 9,
"height": 4
}
}
]
},
"confirm": true
}
This is a complete, accepted request: copy it, change the values, and it still
passes. It is not a minimal one. For each address, provide at least one of
name or company — the sender here happens to carry both, and either alone
would be accepted. street2 and residential are optional throughout. The
parcel here is custom, which is why all three dimensions are present — swap them
for a recognised predefinedPackage and they can go. Use the user's real
details: values that look made up — test or example names, a 555 phone number,
an example.com address — are refused.
Output
| Field | Contents |
|---|---|
id | The new Order's identifier |
createdAtUtc | When it was created, in UTC |
createdAtDisplay | The same instant, formatted and labelled UTC |
shipments | One entry per Shipment, each with its shipmentId |
The new Order starts in Created. No Rates are returned and no Label is
bought — those are separate, explicit steps.
Rules and common tool-specific errors
Before anything is sent, MCP checks that toAddress.street1 and
fromAddress.street1 are present, that shipments holds exactly one parcel,
and that no address value looks made up. Mailhub then applies the full rules in the tables above — both
addresses, and every parcel — and rejects the Order if any of them fails,
naming the field. Nothing partial is created. Order creation through MCP is
US domestic only; treat anything else as unsupported here.
- Repeating a confirmed call creates another Order. See the warning above.
- The identifiers in the response are what the next tools need: carry
shipmentIdintomailhub_get_shipment_rates. - The Order is created for the account you signed in with. MCP has no sub-account scope today.
Common tool-specific errors
| Code | What it means | Retrying |
|---|---|---|
MCP_CONFIRMATION_REQUIRED | The call did not carry confirm: true | Yes, confirming |
MCP_MISSING_FIELD | A required field is missing — the message names it | No — supply it |
MCP_ONE_PARCEL_PER_ORDER | shipments held more than one parcel | No — create one Order per box |
MCP_PLACEHOLDER_VALUE | An address value looks made up — the message names the field | No — ask the user for the real value |
MCP_WRITE_RATE_LIMITED | Too many changing calls for the account just now | Yes, shortly |
| A validation refusal from Mailhub | An address or parcel value was not accepted | Yes, after correcting it |
Every code above, plus the access and shared failures this table does not cover, is listed in Errors & Troubleshooting.
Next
mailhub_get_shipment_rates— rate the Shipment this returns.mailhub_list_orders— check whether an Order already exists before creating another.- Confirmations & Spend Safety — why repeating this call duplicates the Order.