Skip to main content

Update Draft Order

mailhub_update_draft_order

Save the details a user gives onto an existing Draft and leave it a Draft. Use it when someone supplies package size, weight, or address details without asking to finish the Order, and whenever a Draft still lacks something after what they gave: save what they supplied so nothing is lost, then ask for the rest. Read the Draft with mailhub_get_order first.

Permission and safety​

Changes dataYes
ConfirmationRequired — confirm: true
Spends fundsNo
PermissionUpdate access to Orders

Confirmation is enforced by the server — see Confirmations & Spend Safety — and one call changes exactly one Order. Saving the same details again leaves the same Draft, so a repeat is safe.

Input​

FieldTypeRequiredDefaultNotes
orderIdstringYes—The Draft Order's identifier
detailsobjectYes—Only the fields supplied or changed; at least one
storeChangeReviewedAtUtcstringNo—Sent only after showing the user a store change
confirmbooleanNofalseDefaults to false; the call is refused unless the value is the boolean true

details is a patch. It takes the same shape as mailhub_complete_draft_order: toAddress and fromAddress with the address fields to change, and shipments, matched to the Draft's Shipments by position. The tool reads the Draft's stored details itself and keeps every value you do not send. An empty string clears an optional address field (name, company, street2, phone, email). Giving a dimension drops the Draft's predefined package, and giving a predefined package drops its dimensions.

Example input​

{
"orderId": "55555555-5555-5555-5555-555555555555",
"details": {
"shipments": [{"parcel": {"weight": 2.5}}]
},
"confirm": true
}

Output​

The saved Order, passed through from Mailhub. It keeps its identifier and stays a Draft, and the result lists what the Draft still needs before it can be completed.

Rules and common tool-specific errors​

  • Never invent a value. Details that look made up — test, example, or dummy values, a 555 phone number, an example.com address — are refused with MCP_PLACEHOLDER_VALUE, and the Draft is left as it was.
  • A details object that names nothing is refused with MCP_MISSING_FIELD.
  • An Order that is not a Draft is refused with MCP_ORDER_NOT_DRAFT.
  • A connected store may have changed the Order behind the Draft. The call is refused with MCP_STORE_CHANGE_REVIEW_REQUIRED until the user has seen the change. Show them storeChange.fields from mailhub_get_order, and resubmit with storeChangeReviewedAtUtc set to storeChange.atUtc only once they agree.
  • An Order in a merged Shipment cannot change its recipient or parcel here: the Shipment owns them. The call is refused with MCP_ORDER_IN_MERGED_SHIPMENT; use mailhub_update_merged_shipment.
  • Access and shared failures — sign-in, permissions, rate guards — are listed in Errors & Troubleshooting.

Next​