Assign Warehouse
mailhub_assign_warehouse
Set, change, or remove the warehouse one or more Orders ship from. Only Draft
and Created Orders can change warehouse. The user chooses the warehouse: take
its identifier from a
mailhub_list_warehouses call made for this
assignment, and ask when the choice is not clear.
Permission and safety
| Changes data | Yes |
| Confirmation | Required — confirm: true |
| Spends funds | No |
| Permission | Update access to Orders |
Confirmation is enforced by the server — see Confirmations & Spend Safety. Assigning a warehouse buys nothing. The same warehouse rules as the Mailhub application apply: a user limited to specific warehouses can use only those.
Input
| Field | Type | Required | Default | Notes |
|---|---|---|---|---|
orderIds | array of strings | Yes | — | Every Order to change, by UUID |
warehouseId | string | No | — | The warehouse's UUID, to set or change the warehouse. Omit it only together with removeWarehouse |
removeWarehouse | boolean | No | false | true takes the warehouse off the Orders. Never combine it with warehouseId |
confirm | boolean | No | false | Defaults to false; the call is refused unless the value is the boolean true |
Send exactly one of warehouseId and removeWarehouse: true. Leaving
warehouseId out removes nothing — without removeWarehouse the call is refused
with MCP_MISSING_FIELD, and sending both is refused with
MCP_CONFLICTING_FIELDS.
Example input
{
"orderIds": [
"11111111-1111-1111-1111-111111111111",
"22222222-2222-2222-2222-222222222222"
],
"warehouseId": "33333333-3333-3333-3333-333333333333",
"confirm": true
}
Output
One outcome per Order, so some Orders can succeed while others do not — report each one. A note explaining the outcomes that occurred comes with the result.
Assigned— the warehouse is set or removed. Asking again for Orders already in that warehouse also answersAssigned, so the call is safe to repeat.WrongStatus— only aDraftorCreatedOrder can change warehouse, and not while a Label is being bought for it.NoAccess— the user may not use that warehouse, or may not take the Order off the one it is in. List the warehouses again rather than retrying with the same one.NotFound— no such Order for this user, including an Order in a warehouse the user cannot see.Changed— the Order or its merged Shipment changed while it was being assigned. Read it again and assign again only if it still needs the warehouse.
The result does not name the warehouse. Read an assigned Order with
mailhub_get_order before telling the user it
worked.
Rules and common tool-specific errors
- Setting a warehouse replaces the sender address — street, city, state, ZIP,
and country — with the warehouse's address, and keeps the sender contact.
Removing one leaves the sender as it is. A
Draftthat lacked only the sender may becomeCreated. - Removing a warehouse is never done on the first request. The first removal
call is refused with
MCP_CONFIRM_WAREHOUSE_REMOVALand changes nothing. Tell the user how many Orders and which ones, and that a user limited to specific warehouses cannot get Rates or buy a Label for an Order without a warehouse, then send the identical call again only if they agree. - A merged Shipment moves together. Change every Order of a merged Shipment
(
mergedWithonmailhub_get_order) in the same call. An Order changed alone leaves the Shipment — and so does removing its warehouse. - Rates fetched earlier may be dropped. Get them again before buying a Label.
- Access and shared failures — sign-in, permissions, rate guards — are listed in Errors & Troubleshooting.
Next
mailhub_get_order— check the warehouse the Order now shows.mailhub_get_shipment_rates— Rates for the Order from its warehouse.