Create an order

post
/orders

Create an order.

as-store-id
string

The identifier of your store. You need to generate it yourself. Note that this value must consist of numbers and letters (A-Z, a-z, 0-9), and special characters can only be hyphens (-) or underscores (_). For example, if you have a store called "soft life", you can fill in soft-life or soft_life for the value.

Please note that every time you change this value, you need to contact the support team to help you initialize some configuration for the new store.

>= 1 characters<= 256 characters
source_id
string
required

A unique identifier for the order.

<= 32 characters
name
string

The order name. Default is the same value as number.

<= 256 characters
number
string
required

The order number.

<= 64 characters
currency
string
required

The curreny of order.

<= 3 characters
status
string
required

The status of this order

Allowed values:
openclosedcanceled
financial_status
string

The status of payments associated with the order.

Allowed values:
partially_paidpaidpartially_refundedrefundedunpaid
fulfillment_status
string

The status of fulfillment associated with the order.

Allowed values:
unfulfilledpartially_fulfilledfulfilled
order_total
string
required

The total price of the order.

<= 100 characters
shipping_total
string

The total shipping fee applied to the price of the order.

<= 100 characters
tax_total
string

The sum of all the taxes applied to the order.

<= 100 characters
discount_total
string

The total discounts applied to the order. Its value should be equal to the sum of all item discounts.

<= 100 characters
subtotal
string

The price of the order after discounts but before shipping and taxes.

<= 100 characters
items
array[OrderItem]
required

Items of order.Some fields of order item are defined as snapshot fields. These snapshot fields are related to product and can only be specified when creating an order.

>= 1 items<= 100 items
source_id
string
required

A unique identifier for the line item. You should pass it when create order. Please note:

  1. This is NOT the product.source_id of products API.
  2. This source_id should be the same as order.shipments.items.source_order_item_id.
<= 32 characters
Example:
13097711141107
sku
string

Snapshot fieldThe item's SKU (stock keeping unit). Cannot be changed after creating in AfterShip.

<= 256 characters
Example:
yellow
quantity
integer
required

The number of items that have been purchased.

unit_weight
Weight

When using this weight object as the unit_weight in order.items, it is considered a Snapshot field that cannot be changed after creating in AfterShip.

Example:
{"unit":"kg","value":10}
unit_price
string

Snapshot fieldThe price of the item before discounts and taxes have been applied. Cannot be changed after creating in AfterShip.
Please note that the item total price needs to meet the following formula:
item total price paid = unit_price*quantity - discount + tax

<= 100 characters
Example:
8
discount
string

The total amount of the discount allocated to the line item. Including the discount applied only on this item and the allocated discount for the order level discount.

<= 100 characters
Example:
1
tax
string

The total amount of the tax allocated to the line item.

<= 100 characters
Example:
1
fulfillable_quantity
integer

Total items available to fulfill.

source_product_id
string

Snapshot fieldThe ID of the product that the line item belongs to. It cannot be changed after creating in AfterShip. Please note:

  1. It should be the same as the product.source_id of products API.
<= 32 characters
Example:
8021450916083
source_variant_id
string

Snapshot fieldThe ID of the product variant. Default is the same value as source_product_id. Cannot be changed after creating in AfterShip. Please note:

  1. It should be the same as the product.variants.source_id of products API.
<= 32 characters
Example:
43768285298931
title
string
required

The title of the product variant.

<= 1024 characters
Example:
good hair
hs_code
string

Harmonized System (HS) Codes.

<= 256 characters
Example:
sw343
origin_country_region
string

The origin country of this product.

<= 3 characters
Example:
UK
image_urls
array[string]

Snapshot fieldImage urls of this variant. Cannot be changed after creating in AfterShip.

<= 100 items
product_tags
array[string]

Snapshot fieldProduct tags of this variant. Cannot be changed after creating in AfterShip.

product_categories
array[string]

Snapshot fieldProduct categories of this variant. Cannot be changed after creating in AfterShip.

returnable_quantity
integer
Example:
3
shipments
array[Shipment]

order shipments

<= 100 items
tracking_number
string

Tracking number.

<= 256 characters
Example:
2591043243
slug
string

Unique code of the courier. Get couriers here: https://www.aftership.com/couriers.

<= 256 characters
Example:
dhl
additional_fields
object
items
array[object]

A list of line item objects, each containing information about an item in the shipment.

<= 100 items
source_id
string
required

The ID of shipment.

<= 32 characters
Example:
12
source_created_at
string

The date and time (ISO 8601 format) when shipment was created.

Example:
2021-04-15T20:02:09Z
source_delivered_at
string

The date and time (ISO 8601 format) when shipment was delivered.

Example:
2021-04-20T12:05:04Z
service_type
string

The type of logistics service selected for this shipment, e.g. FedEx, SmartPost.

Example:
FedEx
ship_from_address
Address
Example:
{"source_id":"1","description":"My Home Address","company":"aftership","first_name":"teddy","last_name":"chan","email":"[email protected]","address_line_1":"address2","address_line_2":"1233","address_line_3":null,"city":"HongKong","state":"HKG","country_region":"HKG","postal_code":"12323","phone":"+8613265883816","type":null,"tax_number":null}
custom_fields
object

Custom fields that accept an object with string field.Show all...

note
string

An optional note that a shop owner can attach to the order.

<= 5000 characters
source_created_at
string

The date and time (ISO 8601 format) when an order was created.

source_updated_at
string

The date and time (ISO 8601 format) when an order was updated.

customer
Customer
Example:
{"source_id":"5127837778090","first_name":"teddy","last_name":"chan","emails":["[email protected]"],"locale":"en-US","phones":["+8613265883816"]}
source_id
string

A unique identifier for the customer.

<= 32 characters
first_name
string

The customer's first name.

<= 256 characters
last_name
string

The customer's last name.

<= 256 characters
emails
array[string]

The customer's email.

<= 100 items
phones
array[string]

The customer's phone number.

<= 100 items
locale
string

The language code of the customer, eg: en-US.

<= 128 characters
shipping_address
Address
Example:
{"source_id":"1","description":"My Home Address","company":"aftership","first_name":"teddy","last_name":"chan","email":"[email protected]","address_line_1":"address2","address_line_2":"1233","address_line_3":null,"city":"HongKong","state":"HKG","country_region":"HKG","postal_code":"12323","phone":"+8613265883816","type":null,"tax_number":null}
billing_address
Address
Example:
{"source_id":"1","description":"My Home Address","company":"aftership","first_name":"teddy","last_name":"chan","email":"[email protected]","address_line_1":"address2","address_line_2":"1233","address_line_3":null,"city":"HongKong","state":"HKG","country_region":"HKG","postal_code":"12323","phone":"+8613265883816","type":null,"tax_number":null}
tags
array[string]

Tags attached to the order.

<= 100 items
shipping_method
string

The name of the shipping method.

<= 256 characters
Auth
:
Parameters
:
Body
preparing...