Create a fulfillment

post
/fulfillments

Create a fulfillment.

as-store-id
string
required

This value equals to store.id of Store Resource. You can obtain this id by making a GET /stores call to get existing stores or a POST /stores to create a new store.

id
string

A custom identifier for the fulfillment. If not provided, the system will generate a UUID. Must be unique within the store and immutable. You can use this ID to manage the resource in subsequent API calls.

<= 128 characters
Example:
my-custom-id-123
Match pattern:
^[a-zA-Z0-9_-]+$
order_id
string
required

The unique identifier of the order. This value must match the id of the order as returned by the GET /orders or GET /orders/{id} endpoints in the current API version.

Example:
960d25e570834e84b2a0fffd08fab7f9
delivery_method
string
required

Delivery method of the order. For BOPIS related feature, please specify pickup.Show all...

Allowed values:
pickupshipping
Example:
shipping
status
string
required

The status of the fulfillment. Depending of on the delivery_method, the allowed values are different.Show all...

Example:
pending
line_items
array[object]
required

The items which included in this fulifllment.

id
string
required

A unique identifier for the line item in your system. The value should be exist in one of the items in the corresponding order.Show all...

Example:
365756526
quantity
integer
required

The number of items in this fulfillment.

Example:
1
source_created_at
string<date-time>

The date and time, formatted in ISO 8601, indicating when the fulfillment was created in your e-commerce system.

Example:
2021-04-15T20:02:09Z
source_updated_at
string<date-time>

The date and time, formatted in ISO 8601, indicating when the fulfillment was updated in your e-commerce system.

Example:
2021-04-15T20:02:09Z
ship_from_location
object

The location information where the fulfillment shipped from. It is recommended to include this field if the fulfillment's delivery method is shipping. Note that you must provide either location_id or address, but not both.

location_id
string

The public Location ID from the Location resource. Get it via GET /locations or use the id returned by POST /locations. Accepts either a merchant-defined custom ID (e.g. warehouse_1) for source = manual locations, or a platform composite ID app-<platform>-<app_key>-<external_id> for source = platform locations.

Example:
warehouse_1
address
Address

The address object of this location.

Example:
{"type":"business","street_1":"1234 Elm Street","street_2":"Apt 5","street_3":null,"city":"New York","state":"NY","postal_code":"10001","country_region":"USA","company":"My Company","first_name":"John","last_name":"Doe","email":"[email protected]","phone":"+13525554500"}
pickup_location
object

The location information where the fulfillment is designated to be pickup from. Mandatory when the delivery method of the fulfillment is pickup.

location_id
string
required

The ID of the Location pre-created in AfterShip admin

Example:
a52eeb761d204f3cbae06fa93b452976
trackings

Represents shipment tracking information. This object supports two mutually exclusive usage patterns:Show all...

id
string
required

The unique identifier of a tracking resource previously created via the Tracking API.

pickup_info
Pickup

The pickup information of the fulfillment. It is recommended to include this field if the fulfillment's delivery method is pickup.

instructions
string

Instructions for the pickup process.Show all...

Example:
Shop open from Mon to Fri
estimated_ready_for_pickup_at
object

The expected date and time when the items in this fulfillment order will be ready for pickup.Show all...

pickup_deadline_at
string<date-time>

The latest time by which the pickup must be completed, formatted in ISO 8601.Show all...

Example:
2021-04-15T20:02:09Z
meta
Meta

The Meta model holds the metadata of the API response, including relevant error details for debugging purposes.Show all...

Example:
{"code":20000,"type":"OK","message":"The request was successfully processed by AfterShip."}
code
number
required

Error code in integer format. For detailed information, please refer to the Request Error introduction page.

Default:
20000
Example:
20000
type
string
required

Response type string for the reference. For detailed information, please refer to the Request Error introduction page.

>= 1 characters
Example:
OK
message
string
required

Human-readable response message. For detailed information, please refer to the Request Error introduction page.

>= 1 characters
Example:
The request was successfully processed by AfterShip.
errors
array[Error]

Error detail object. Each error object contains a "path" key and an "info" key. The "path" is the JSON path of the request object to indicate the error location. The "info" is a human-readable description of the error.Show all...

data
Fulfillment

The Fulfillment model encapsulates the details of processing and delivering orders in an eCommerce context. It includes information such as fulfillment status, shipment tracking, the items to be fulfilled, and so on.Show all...

id
string
required

The unique identifier of the fulfillment. If a custom ID was provided in the request, that value is used; otherwise, a system-generated UUID is assigned. You can use this ID to manage this resource in related API calls.

Example:
423562565
order_id
string
required

It should be the same as the order.id of the Order resource.

Example:
5187092316403
delivery_method
string
required

Delivery method of the order. For BOPIS related feature, please specify pickup.Show all...

Allowed values:
pickupshipping
Example:
shipping
status
string
required

The status of the fulfillment. Depending of on the delivery_method, the allowed values are different.Show all...

Example:
processing
line_items
array[object]
required

The items which included in this fulifllment.

source_created_at
string<date-time>

The date and time, formatted in ISO 8601, indicating when the fulfillment was created in your e-commerce system.

Example:
2021-04-15T20:02:09Z
source_updated_at
string<date-time>

The date and time, formatted in ISO 8601, indicating when the fulfillment was updated in your e-commerce system.

Example:
2021-04-16T20:02:09Z
created_at
string<date-time>
required

The date and time (ISO 8601 format) when the fulfillment was created in AfterShip.

Example:
2021-04-15T20:02:09Z
updated_at
string<date-time>
required

The date and time (ISO 8601 format) when the fulfillment was updated in AfterShip.

Example:
2021-04-16T20:02:09Z
ship_from_location
object

The location information where the fulfillment shipped from.

pickup_location
PickupLocation

The location information where the fulfillment is designated to be pickup from.

trackings

Represents shipment tracking information. This object supports two mutually exclusive usage patterns:Show all...

pickup_info
Pickup

The pickup information of the fulfillment.

Auth
:
Parameters
:
Body
{ "id": "25462567654", "order_id": "5187092316403", "delivery_method": "shipping", "status": "pending", "line_items": [ { "id": "365756526", "quantity": 1 } ], "source_created_at": "2021-04-15T20:02:09Z", "source_updated_at": "2021-04-15T20:02:09Z", "ship_from_location": { "location_id": "a2a00a8bfefb423a98f456c95dfbfde5" }, "trackings": [ { "id": "tracking1" }, { "id": "tracking2" } ] }
Response Example
{ "meta": { "code": 20000, "type": "OK", "message": "The request was successfully processed by AfterShip." }, "data": { "id": "423562565", "order_id": "5187092316403", "delivery_method": "pickup", "status": "processing", "line_items": [ { "id": "13097711141107", "product_id": "8021450916083", "product_variant_id": "43768285298931", "product_title": "Power Mobile Phone", "product_variant_title": "Power Mobile Phone (While)", "sku": "SKU001", "quantity": 1, "unit_price": { "currency": "USD", "amount": "10" }, "unit_weight": { "unit": "kg", "value": 10 }, "image_urls": [ "https://example.com/product/image.png" ] } ], "source_created_at": "2021-04-15T20:02:09Z", "source_updated_at": "2021-04-16T20:02:09Z", "created_at": "2021-04-15T20:02:09Z", "updated_at": "2021-04-16T20:02:09Z", "ship_from_location": { "location_id": "warehouse_1", "address": { "type": "business", "street_1": "1234 Elm Street", "street_2": "Apt 5", "street_3": "", "city": "New York", "state": "NY", "postal_code": "10001", "country_region": "USA", "company": "My Company", "first_name": "John", "last_name": "Doe", "email": "[email protected]", "phone": "+11234567890" } }, "pickup_location": { "location_id": "e9ec84ff351e45e089a7b75ae497e1ae", "address": { "type": "business", "street_1": "1234 Elm Street", "street_2": "Apt 5", "street_3": "", "city": "New York", "state": "NY", "postal_code": "10001", "country_region": "USA", "company": "My Company", "first_name": "John", "last_name": "Doe", "email": "[email protected]", "phone": "+11234567890", "coordinate": { "latitude": 43, "longitude": -75 } }, "opening_hours": { "sunday": { "open": true, "from": "10:30", "to": "20:30" }, "monday": { "open": true, "from": "10:30", "to": "20:30" }, "tuesday": { "open": true, "from": "10:30", "to": "20:30" }, "wednesday": { "open": true, "from": "10:30", "to": "20:30" }, "thursday": { "open": true, "from": "10:30", "to": "20:30" }, "friday": { "open": true, "from": "10:30", "to": "20:30" }, "saturday": { "open": true, "from": "10:30", "to": "20:30" } } }, "trackings": [ { "tracking_number": "RA123456789US", "slug": "usps", "service_type": "standard shipping", "ship_date": "2023-05-04", "custom_fields": {}, "next_couriers": [ { "tracking_number": "RA123456789US", "slug": "usps" } ] } ], "pickup_info": { "instructions": "Shop open from Mon to Fri", "estimated_ready_for_pickup_at": { "min": "2021-04-15T20:02:09Z", "max": "2021-04-15T20:02:09Z" }, "pickup_deadline_at": "2021-04-15T20:02:09Z" } } }