Create a mail order draft
postalform.create_order_draftPrepare an existing PDF for mailing and return the order ID, total, hosted checkout URL, and checkout session. After buyer approval, a compatible client can pass a Stripe shared payment token to complete_checkout; otherwise present the hosted checkout URL. To prepare for MPP, set payment_protocol=mpp and buyer_email; receive a PDF preview, hosted checkout_url fallback and MPP challenge, then use postalform.pay_order with the order_id after buyer approval. Draft creation never pays. For x402, use postalform.create_machine_order.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"pdf": "<pdf>",
"sender_name": "<sender_name>",
"sender_address_type": "<sender_address_type>",
"recipient_name": "<recipient_name>",
"recipient_address_type": "<recipient_address_type>"
},
"name": "postalform.create_order_draft"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Yes | The PDF to mail. Accepts attachment objects ({ download_url, file_id }). Fallbacks: upload_token from postalform.create_pdf_upload, data:application/pdf;base64,..., or a public HTTPS download URL. | ||
| color | No | Whether to print in color (default: false). | |
| certified | No | Whether to add proof mail: USPS Certified Mail for US destinations, Canada Post Registered Mail through PostGrid for Canadian destinations, or PinGen registered mail for supported European destinations (default: false). | |
| file_name | No | Optional display file name. | |
| buyer_name | No | Receipt name; defaults to sender_name for MPP. | |
| mail_class | No | Mail service level (standard, priority, express). | |
| request_id | No | Optional idempotency key. Reuse the same value if retrying the call. | |
| buyer_email | No | Required for MPP receipt delivery. | |
| sender_name | Yes | Sender's name (return address). | |
| double_sided | No | Whether to print double-sided (default: true). | |
| recipient_name | Yes | Recipient's name. | |
| sender_company | No | Optional company, department or attention line printed under sender_name in the return address (at most 40 characters). | |
| payment_protocol | No | Optional payment path. Defaults to hosted checkout. Choose mpp to return a payment challenge for this same prepared order; buyer_email is required. Draft creation never pays. | |
| recipient_company | No | Optional company, department or attention line printed under recipient_name, for example "Acme Corp, ATTN: Legal" (at most 40 characters). | |
| sender_address_id | No | Loqate address id for the sender (required when sender_address_type is Address). | |
| sender_address_text | No | Human-readable sender address preview (required when sender_address_type is Address; optional for Manual). | |
| sender_address_type | Yes | Address suggestion type for the sender (from postalform.search_addresses). Use Manual to pass a structured address with countryCode when outside the US. | |
| recipient_address_id | No | Loqate address id for the recipient (required when recipient_address_type is Address). | |
| sender_address_manual | No | Sender manual address fields (required when sender_address_type is Manual). | |
| recipient_address_text | No | Human-readable recipient address preview (required when recipient_address_type is Address; optional for Manual). | |
| recipient_address_type | Yes | Address suggestion type for the recipient (from postalform.search_addresses). Use Manual to pass a structured address with countryCode when outside the US. | |
| certified_return_receipt | No | Add Electronic Return Receipt for US Certified Mail. Ignored for Canada Post Registered Mail and PinGen registered-mail destinations (default: false). | |
| recipient_address_manual | No | Recipient manual address fields (required when recipient_address_type is Manual). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| view | Yes | ||
| is_paid | No | ||
| payment | No | ||
| order_id | Yes | ||
| price_usd | Yes | ||
| page_count | Yes | ||
| preview_url | No | ||
| sender_name | Yes | ||
| checkout_url | Yes | ||
| payment_status | No | ||
| recipient_name | Yes | ||
| sender_company | No | ||
| checkout_session | No | ||
| payment_protocol | No | ||
| delivery_estimate | No | ||
| recipient_company | No | ||
| sender_address_text | Yes | ||
| recipient_address_text | Yes |