Create a draft order
POST https://{handle}.myshopline.com/admin/openapi/v20260301/orders/draft_orders.json
handle : The store's unique identifier, which is the prefix of the store's domain name. For example, if a store's domain name is open001.myshopline.com , the store handle is open001 .Create a draft order for the customer.
Request Headers
- Content-Type string requiredThe field must be set to the fixed value
application/json; charset=utf-8. - Authorization string requiredThe access token for the API resource. Refer to App authorization to obtain the access token, and then pass the obtained token in the Bearer format.Example:
Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw
Request Body
draft_orderobject
The draft order object.billing_addressobject
The address for mailing bills and invoices.address1 stringThe first line of the billing address. This typically includes information such as the street address or a post office box number.Maximum length: 256address2 stringThe second line of the billing address. This typically includes information such as apartment, suite, or unit number.Maximum length: 256area stringThe district or county in the billing address.Maximum length: 64area_code stringThe district or county code in the billing address.Example:510007city stringThe city in the billing address.Maximum length: 64city_code stringThe city code in the billing address.Example:510000company stringThe company name of the billing recipient.country stringThe country or region in the billing address.country_code stringThe country or region code in the billing address. Two-letter country code (ISO 3166-1 standard) for the country or region.Example:USemail stringPayment bill recipient's email.first_name stringPayment bill recipient's first name.Maximum length: 64last_name stringPayment bill recipient's last name.Maximum length: 64phone stringPayment bill recipient's phone number.postcode stringThe postal code information of the address.province stringThe province in the billing address.province_code stringThe code for the province in the billing address, which can be a custom code or a two-character ISO 3166-2 international code.Example:4220006same_as_receiver booleanIndicates whether thebilling_addressis the same as theshipping_address.true: samefalse: different
calc_sku_stock_mode string requiredUsed to identify the inventory mode. Valid values are:not_limit: Infinity inventoryreal: Actual inventoryreserve_real: Reserve inventory and actual inventory
Example:stringcustomerobject
Buyer's information.area_code stringInternational dialing code.Example:+1email stringBuyer's email address.first_name stringBuyer's first name.Maximum length: 64id string requiredThe unique identifier for the buyer.Example:stringlast_name stringBuyer's last name.Maximum length: 64phone stringBuyer's mobile phone number.Maximum length: 32discount_amount_ext stringOrder discount amount. The value is rounded to two decimal places.discount_amount_ext_name stringOrder discount description.Maximum length: 64discountable booleanDeprecatedThis parameter is deprecated from API version v20251201.language_infoobject required
Language information.customer_language stringThe language used by the buyer when placing an order. This language takes priority.Example:enmerchant_language stringThe language used by the seller. The buyer's language takes priority.Example:enline_itemsobject[] required
List of products.applied_discountobject
Product discount information.description stringThe discount description.title stringDeprecatedThis parameter is deprecated from API version v20251201.value long requiredDiscount amount. Whenvalue_typeispercentage, the minimum value is 0 and the maximum value is 100.value_type string requiredThe type ofvalue. Valid values are:fix_amount: fixed amount discountpercentage: percentage discount
Example:stringdiscountable booleanDeprecatedThis parameter is deprecated from API version v20251201.gift_card booleanDeprecatedThis parameter is deprecated from API version v20251201.price stringThe product price.product_id string requiredThe unique identifier for the product corresponding to the variant.Example:16056761559984840457934011product_source string requiredProduct source. Valid values are:main_site: online store productcustomize: custom product
Example:stringpropertiesobject[]
Product customization information.name stringCustom attribute name.show booleanIndicates whether this message should be displayed on the frontend.true: Displayedfalse: Not displayed
type stringCustom information type. Valid values are:text: character or string typepicture: image typelink: hyperlink type
urls arrayURL list.- If the
typeispicture, thumbnails are retrieved via theurlsvalues. - If the
typeislink, the hyperlink is the first URL in theurlsvalues.
value stringCustom attribute value.quantity integer requiredQuantity of Items in the draft order.Value range: 1-99999requires_shipping booleanIndicates whether shipping is required.true: Requiredfalse: Not required
Default:falsesku stringMerchant-defined product SKU.Maximum length: 255taxable booleanIndicates whether the product is subject to tax.true: Tax is required.false: No tax is required.
Default:truetitle stringProduct title.variant_id string requiredThe unique identifier for the variant.Example:18056761559987524812644011market_region_country_code stringThe country or region code of the target market. Complies with the ISO 3166 standard.Example:USnote stringThe note of the draft order.Maximum length: 1024note_attributesobject[]
Additional information for the draft order.name stringCustom attribute name.value stringCustom attribute value.outer_id stringThe unique request ID generated by the client. Requests with the same ID will only be processed once.payment_termsobject
Payment information.pay_channel_id string requiredThe unique identifier for the order.Example:stringpay_status stringPayment status. Valid values are:unpaid: Order not yet paidpaid: Order paid
Default:unpaidpayment_channel_name stringPayment channel name.shipping_addressobject
Recipient's shipping address information.address1 stringThe first line of the shipping address. This typically includes information such as the street address or a post office box number.Maximum length: 256address2 stringThe second line of the shipping address. This typically includes information such as apartment, suite, or unit number.Maximum length: 256city stringThe city in the shipping address.Maximum length: 64city_code stringThe city code in the shipping address.Example:510000company stringThe company name of the recipient.country stringThe country or region in the shipping address.Maximum length: 64country_code stringThe country or region code in the shipping address. Two-letter country code (ISO 3166-1 standard) for the country or region.Example:USdistrict stringThe district or county in the shipping address.Maximum length: 64district_code stringThe district or county code in the shipping address.Example:510007first_name stringRecipient's first name.last_name stringRecipient's last name.phone stringRecipient's phone number.province stringThe province in the shipping address.province_code stringThe code for the province in the shipping address, which can be a custom code or a two-character ISO 3166-2 international code.Example:4220006zip stringThe postal code information of the address.Example:510036shipping_linesobject
Logistics information.Whenshipping_typeis set tosystem,delivery_idis required.
Whenshipping_typeis set tocustom, bothtitleandpriceare required.
If free shipping is desired,shipping_typemust be set tocustom, and bothtitleandpricemust be provided, with thepricevalue set to0.delivery_id stringShipping template ID.price stringCustom shipping fee. The value is rounded to two decimal places.shipping_type string requiredLogistics type. Valid values are:system: system logisticscustom: custom logistics
Example:stringtitle stringCustom shipping carrier name.stock_reserved boolean requiredIndicates whether there is a reserved product identifier at the order level.true: with reserved product identifierfalse: without reserved product identifier
stock_reserved_time longProduct reservation time at the order level, formatted as a 13-digit millisecond timestamp.Example:1667638652832tags arrayA list of tags. Multiple tags are separated by commas. Maximum size: 99tax_exempt booleanIndicates whether the product is subject to tax.true: Tax is required.false: Tax is not required.
Status Codes
- 200
- 401
- 429
For the complete list of codes and messages, see Http status code.
Response Headers
traceId
A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise.
Response Body
draft_orderobject
Draft order object.billing_addressobject
The address for mailing bills and invoices.address1 stringThe first line of the billing address. This typically includes information such as the street address or a post office box number.Example:8899 Garfield Streetaddress2 stringThe second line of the billing address. This typically includes information such as apartment, suite, or unit number.Example:Apartment 5area stringThe district or county in the billing address.Example:Panyu Districtarea_code stringThe district or county code in the billing address.Example:510007city stringThe city in the billing address.Example:Guangzhou Citycity_code stringThe city code in the billing address.Example:510000company stringCompany name of the billing recipient.Example:Company Namecountry stringThe country in the payment billing address.Example:United Statescountry_code stringThe country or region code in the billing address. Two-letter country code (ISO 3166-1 standard) for the country or region.Example:USemail stringPayment bill recipient's email.Example:test001@Gmail.comfirst_name stringPayment bill recipient's first name.Example:Tomlast_name stringPayment bill recipient's last name.Example:Washingtonphone stringPayment bill recipient's phone number.Example:13903004000province stringThe province in the billing address.Example:New York Stateprovince_code stringThe code for the province in the address, which is a system custom code.Example:4220006same_as_receiver booleanIndicates whether thebilling_addressis the same as theshipping_address.true: samefalse: different
standard_province_code stringThe code for the province in the billing address, which is a two-character ISO 3166-2 international code. It is different from theprovince_codeparameter, which is a custom code.Example:NYzip stringThe postal code for the billing address.create_at longCreation time of the draft order, formatted as a 13-digit millisecond timestamp.Example:1667638652832currency stringThe store currency. The value of this parameter is a three-letter currency code that follows the ISO 4217 standard.Example:USDcustomerobject
The buyer's information.area_code stringInternational dialing code.Example:+1email stringThe buyer's email address.Example:test001@Gmail.comfirst_name stringThe buyer's first name.Example:Tomid stringThe unique identifier for the buyer.Example:4201057495last_name stringThe buyer's last name.Example:Washingtonphone stringThe buyer's phone number.Example:13903004000discount_amount_ext stringOrder discount amount. The value is rounded to two decimal places.Example:8.00discount_amount_ext_name stringOrder discount name.discount_amount_ext_setobject
Order discount amount information.presentment_moneyobject
The order discount amount information presented to the buyer.amount stringThe order discount amount. The value is rounded to two decimal places.Example:8.00shop_moneyobject
The order discount amount information recorded by the merchant.amount stringThe order discount amount. The value is rounded to two decimal places.Example:8.00id stringThe unique identifier for the draft order.invoice_url stringInvoice URL.Example:https://xxx.com/xxxxline_itemsobject[]
List of products.applied_discountobject
Custom product discount information.amount stringThe amount after applying the discount.Example:8.00amount_setobject
Detailed information of the discount amount.presentment_moneyobject
The product discount amount information presented to the buyer.amount stringThe product discount amount. The value is rounded to two decimal places.Example:8.00shop_moneyobject
The product discount amount information recorded by the merchant.amount stringThe product discount amount. The value is rounded to two decimal places.Example:8.00before_amount stringProduct price.Example:8.00before_amount_setobject
Price information of the product.presentment_moneyobject
The product price information presented to the buyer.amount stringThe product price. The value is rounded to two decimal places.Example:8.00currency_code stringThe value of this parameter is a three-letter currency code that follows the ISO 4217 standard.Example:CNYshop_moneyobject
The product price information recorded by the merchant.amount stringThe product price. The value is rounded to two decimal places.Example:8.00currency_code stringThe value of this parameter is a three-letter currency code that follows the ISO 4217 standard.Example:CNYdescription stringThe discount description.title stringDeprecatedThis parameter is deprecated from API version v20251201.value longDiscount amount. When the discount type ispercentage, the minimum value is 0 and the maximum value is 100.value_type stringDiscount type.fixed_amount: fixed amountpercentage: percentage
gift_card booleanIndicates whether the product is a gift card.true: Gift cardfalse: Not a gift card
id stringA unique identifier for the line item.image_url stringProduct image URL.Example:https://xxx.com/xxxxname stringSKU title.price stringProduct amount after applying custom discounts. The value is rounded to two decimal places.Example:2.00price_setobject
Product amount after applying custom discounts.presentment_moneyobject
The product amount information after custom discount presented to the buyer.amount stringThe product amount after custom discount. The value is rounded to two decimal places.Example:2.00shop_moneyobject
The product amount information after custom discount recorded by the merchant.amount stringThe product amount after custom discount. The value is rounded to two decimal places.Example:2.00product_id stringThe unique identifier for the product.Example:16056577393789045351043258product_source stringProduct source. Valid values are:main_site: online store productcustomize: customize product
propertiesobject[]
A list of product customization information.name stringCustom attribute name.Example:colorsshow booleanIndicates whether this message should be displayed on the frontend.true: Displayedfalse: Not displayed
type stringCustom information type. Valid values are:text: character or string typepicture: image typelink: hyperlink type
urls arrayURL list.- If the type is
picture,thumbnails are retrieved via theurlsvalues. - If the type is
link,the hyperlink is the first URL in theurlsvalues.
value stringCustom attribute valueExample:redquantity integerQuantity of items in the draft order.requires_shipping booleanIndicates whether shipping is required.true: Requiredfalse: Not required
sku stringMerchant-defined product item number.tax_linesobject[]
Tax information.name stringThe name of the tax.price stringThe amount of the tax.price_setobject
The tax amount information.presentment_moneyobject
The tax amount information presented to the buyer.amount stringThe tax amount. The value is rounded to two decimal places.Example:2.00shop_moneyobject
The tax amount information recorded by the merchant.amount stringThe tax amount. The value is rounded to two decimal places.Example:2.00rate doubleThe tax rate.type stringTax type. Valid values are:product_tax: product taxshipping_tax: shipping taxduty_tax: duty tax
Example:shipping_taxtitle stringTitle of the variant.variant_id stringThe unique identifier for the variant.variant_title stringProduct SKU title.logistics_price stringTotal shipping amount.logistics_price_setobject
Total shipping amount.presentment_moneyobject
The total shipping amount information presented to the buyer.amount stringThe total shipping amount. The value is rounded to two decimal places.Example:2.00shop_moneyobject
The total shipping amount information recorded by the merchant.amount stringThe total shipping amount. The value is rounded to two decimal places.Example:2.00logistics_tax stringTotal shipping tax.logistics_tax_setobject
Total shipping tax.presentment_moneyobject
The total shipping tax information presented to the buyer.amount stringThe total shipping tax. The value is rounded to two decimal places.Example:2.00shop_moneyobject
The total shipping tax information recorded by the merchant.amount stringThe total shipping tax. The value is rounded to two decimal places.Example:2.00market_name stringMarket name.market_region_country_code stringA two-letter country or region code that follows the ISO 3166-1 (alpha 2) standard, used to identify a specific market's country or region.Example:USnote stringThe note of the draft order.note_attributesobject[]
Additional information for the draft order.name stringThe name of the note.value stringThe value of the note.order_id stringDeprecatedThis parameter is deprecated from API version v20251201.payment_termsobject
Payment terms and payment information.created_at stringThe date and time when the payment term was created.Format: ISO 8601.Example:2024-08-31T02:20:26+08:00due_in_days integerThe number of days between the invoice date and the due date, as defined in the selected payment terms template. Provided when thepayment_terms_typeisNET.id stringThe unique identifier for the payment term.overdue booleanIndicates whether the payment terms have expired.true: Expiredfalse: Not expired
pay_channel_id stringThe unique identifier for the payment channel.pay_status stringPayment status. Valid values are:unpaid: unpaidpaid: paid
payment_channel_name stringPayment channel name.payment_schedulesobject[]
A set of schedules associated with the payment terms.completed_at stringThe date and time when the payment completion is recorded.due_at stringThe date and time when the payment terms are due.
When the value ofpayment_terms_typeisFIXED,due_atmust have a value.
When the value ofpayment_terms_typeisNET, the value ofdue_atis equal toissued_atplusdue_in_days.
When the value ofpayment_terms_typeisFULFILLMENT, it has a value only when the order is shipped.issued_at stringThe date and time when the payment terms take effect.
When the value ofpayment_terms_typeisFIXED, ifissued_atis empty, thenissued_atequalsdue_at.
When the value ofpayment_terms_typeisNET,issued_atmust have a value.
When the value ofpayment_terms_typeisFULFILLMENT, it has a value only when the order is shipped.
When the value ofpayment_terms_typeisRECEIPT, it has a value only when the invoice is sent.Example:2024-08-31T02:20:26+08:00payment_terms_name stringThe name of the payment term template used to create the payment terms.payment_terms_type stringThe type of payment terms template used to create the payment terms. Valid values are:FIXED: Full payment by the specified date.FULFILLMENT: Full payment when the order is fulfilled.RECEIPT: Full payment when the invoice is sent.NET: NET.
updated_at stringThe date and time when the payment term was last updated.Format: ISO 8601.Example:2024-08-31T02:20:26+08:00po_number stringPurchase order number recorded on the order in B2B scenarios.presentment_currency_code stringMarket currency.product_tax stringProduct total tax.product_tax_setobject
Product total tax, displayed in both the buyer's currency and the store's currency.presentment_moneyobject
The product total tax information presented to the buyer.amount stringThe product total tax. The value is rounded to two decimal places.shop_moneyobject
The product total tax information recorded by the merchant.amount stringThe product total tax. The value is rounded to two decimal places.seller_id stringMerchant ID.shipping_addressobject
Recipient's shipping address.address1 stringThe first line of the address. This typically includes information such as the street address or a post office box number.Example:8899 Garfield Streetaddress2 stringThe second line of the address. This typically includes information such as apartment, suite, or unit number.Example:Apartment 5city stringThe city in the shipping address.Example:Guangzhou Citycity_code stringThe city code in the shipping address.Example:510000company stringCompany name of the recipient.Example:Company Namecountry stringThe country or region in the shipping address.Example:Chinacountry_code stringThe country or region code in the shipping address.Two-letter country code (ISO 3166-1 standard) for the country or region.Example:USdistrict stringThe city in the shipping address.Example:Panyu Districtdistrict_code stringThe code for city in the shipping address.Example:510007first_name stringThe recipient's first name.Example:Tomlast_name stringThe recipient's last name.Example:Washingtonname stringThe recipient's full name.phone stringThe recipient's phone number.Example:13903004000province stringThe province in the shipping address.Example:Guangdong Provinceprovince_code stringThe code for the province in the address, which is a system custom code.Example:4220006standard_province_code stringThe code for the province in the shipping address, which is a two-character ISO 3166-2 international code. It is different from theprovince_codeparameter, which is a custom code.Example:NYzip stringThe postal code information of the shipping address.Example:510036shipping_linesobject
Logistics information.Whenshipping_typeis set tosystem,delivery_idis required.
Whenshipping_typeis set tocustom, bothtitleandpriceare required.
If free shipping is desired,shipping_typemust be set tocustom, and bothtitleandpricemust be provided, with thepricevalue set to0.delivery_id stringShipping template ID.price stringThe shipping cost for logistics.price_setobject
The shipping cost for logistics.presentment_moneyobject
The shipping cost information presented to the buyer.amount stringThe shipping cost. The value is rounded to two decimal places.Example:2.00shop_moneyobject
The shipping cost information recorded by the merchant.amount stringThe shipping cost. The value is rounded to two decimal places.Example:2.00shipping_type stringLogistics type. Valid values are :system: system logisticscustom: custom logistics
title stringLogistics name.status integerDraft order status. Valid values are:open: processingcompleted: has been completed
stock_reserved booleanIndicates whether there is a reserved product identifier at the order level.true: with reserved product identifierfalse: without reserved product identifier
stock_reserved_time longProduct reservation time at the order level, formatted as a 13-digit millisecond timestamp.Example:1669280400000store_id stringThe unique identifier for the store.tags arrayA list of tags. Multiple tags are separated by commas.tax_linesobject[]
Tax information.name stringTax name.price stringSpecific tax amount.price_setobject
Tax information.presentment_moneyobject
The tax amount information presented to the buyer.amount stringThe tax amount. The value is rounded to two decimal places.Example:2.00shop_moneyobject
The tax amount information recorded by the merchant.amount stringThe tax amount. The value is rounded to two decimal places.Example:2.00rate doubleTax rate.type stringTax type. Valid values are:product_tax: product taxshipping_tax: shipping taxduty_tax: duty tax
total_duties_setobject
Total duty.presentment_moneyobject
The total duty information presented to the buyer.amount stringThe total duty amount. The value is rounded to two decimal places.Example:2.00shop_moneyobject
The total duty information recorded by the merchant.amount stringThe total duty amount. The value is rounded to two decimal places.Example:2.00total_line_items_price stringThe total amount of products in the current draft order.total_line_items_price_setobject
The total amount of products in the current draft order information.presentment_moneyobject
The total product amount information presented to the buyer.amount stringThe total product amount. The value is rounded to two decimal places.Example:2.00shop_moneyobject
The total product amount information recorded by the merchant.amount stringThe total product amount. The value is rounded to two decimal places.Example:2.00total_price stringTotal amount of the current draft order: the sum of the product selling prices minus the discount, plus tax and shipping fee.total_price_setobject
Total amount.presentment_moneyobject
The total amount information presented to the buyer.amount stringThe total amount. The value is rounded to two decimal places.Example:2.00shop_moneyobject
The total amount information recorded by the merchant.amount stringThe total amount. The value is rounded to two decimal places.Example:2.00update_at longThe date and time when the draft order was last updated, formatted as a 13-digit millisecond timestamp.Example:1667638652832
API Explorer
Debugger
Examples
Was this article helpful to you?