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. There is no way to blank a field by omitting it.

Example input​

{
"orderId": "55555555-5555-5555-5555-555555555555",
"details": {
"toAddress": {"phone": "512-555-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. Ask the user for them — package size, weight, sender address, phone — and never invent a value.
  • 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.
  • A Draft cannot be moved by status. mailhub_update_order_status can only cancel a Draft; completing one is this tool's job.
  • Access and shared failures — sign-in, permissions, rate guards — are listed in Errors & Troubleshooting.

Next​