Skip to main content

Complete Draft Order

mailhub_complete_draft_order

Finish a Draft — an Order that exists but is still missing details — and move it to Created. Find Drafts with mailhub_list_orders using status: "Draft", and read one with mailhub_get_order before completing it.

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 completes exactly one Order. Completing a Draft buys nothing: postage is still a separate mailhub_buy_label call.

Input​

FieldTypeRequiredDefaultNotes
orderIdstringYes—The Draft Order's identifier
detailsobjectNo—Only the fields supplied or changed
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, not a replacement. The tool reads the Draft's stored details itself and keeps every value you do not send, so send only what the user supplied or asked to change. Omitting a field never blanks it; 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": {
"toAddress": {"phone": "311-201-0142"},
"shipments": [{"parcel": {"weight": 2.5}}]
},
"confirm": true
}

Output​

The completed Order, passed through from Mailhub. It carries the same order identifier the Draft had, now in the Created status rather than Draft.

Rules and common tool-specific errors​

  • A Draft that is still missing details is refused, and stays a Draft. The refusal names the fields that are missing or invalid. Save what the user did give with mailhub_update_draft_order so it is not lost, ask for the rest — package size, weight, sender address, phone — and never invent a value.
  • Details that look made up are refused with MCP_PLACEHOLDER_VALUE: test, example, or dummy values, a 555 phone number, an example.com address.
  • An Order that is no longer a Draft is refused with MCP_ORDER_NOT_DRAFT; read it to see its status.
  • A connected store may have changed the Order behind the Draft. The call is then refused 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. Sending it without showing them defeats the check. The refusal code is MCP_STORE_CHANGE_REVIEW_REQUIRED.
  • 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.
  • Setting a Draft to Created with mailhub_update_order_status runs the same completion with the Draft's stored details, and setting it to Cancelled cancels it. Use this tool when the user also gives details.
  • Access and shared failures — sign-in, permissions, rate guards — are listed in Errors & Troubleshooting.

Next​