Inventory
Fulfillments
Fulfillments are a multi-step process and this guide will go through all steps in detail. As a quick overview, the following are the steps required:
Statuses & Events
Statuses
Events
There is no event for deleting fulfillments since they instead get canceled, but their record will still remain.
Overview
The following is a typical lifecycle for a fulfillment.
Create fulfillment
Add the required inventory that needs to be shipped to the desired recipient from your specified location.
Pick Items (optional)
If your workflow does a pick and pack operation, you'll increment the `manifested_qty` field for each item.
Create parcel
Add the box or boxes into which you're going to pack the inventory items.
Pack parcel
Pack the items into the parcel(s) that you have added.
Generate shipping rates
Pass the fulfillment ID into the shipments API to get shipping rates for the parcel(s) you are shipping.
Get shipping label
Purchase a shipping label to complete the fulfillment. You can also set up private rates which do not require you to purchase a label if you are handling the shipping by yourself or sourcing a label off of the platform.
- location_id - Add the ID of one of your locations to get all of the deliveries currently mapped to that location. For example:
location_id=loc_czhgjrk5JaVvyATPDbyURp
- statuses - A comma separated list of fulfillment statuses. Keep in mind comma's in URLs are encoded as
%2C
, so we recommend using your platforms native URL encoding library. For example:statuses=picked,packed
- recipient_contact_id - This will let you filter all deliveries where the recipient matches the selected contact ID. For example:
recipient_contact_id=ctct_rEMzyCyxJzuBzN4LyurAJV
- updated_by - This will let you filter all deliveries where the updated_by property matches the selected ID. For example:
updated_by=key_hnNCb17prVGhjYDy5YicZs
- value_added_services - You can filter fulfillments that have a particular value added service. For example:
value_added_services=gift_wrapping
- service_levels - Allows you to filter fulfillments that have the specified comma separated service levels. For example:
service_levels=in_person_pickup,same_day
- order_by - The property by which to sort. Available properties are:
created_at
,complete_at
- direction - The direction to sort. Available directions are:
asc
anddesc
order_number
recipient_name
recipient_phone
recipient_email
sku
gtin
1. Create fulfillment
To create a fulfillment, you'll need to include the recipient
, your location_id
from where the fulfillment will be taking place, and the inventory
or articles
that you want to include. Some optional extra params are in the code example below as well.
There are two ways to go about working with inventory: either by using the inventory that is stored on Dispatch, or by bypassing it entirely if you are using a third party inventory solution. Both options are documented below.
Example
2. Pick Operation (optional)
If your workflow is a typical "pick and pack" operation, you may want to first pick all of your items to ensure that you have them in inventory and them pack them into one or more parcels.
To do the pick operation, you can increment the manifested_qty
field. PackageX will automatically make sure that you do not go over the amount that was requested in the fulfillment.
The status of the fulfillment will automatically get updated to picked
when all of the items have been accounted for.
Example
3. Create parcel
Once the fulfillment has been created, it needs to be packed. But before that, one or more parcels need to be created. You can create a custom parcel by adding dimensions or by using a predefined package that you set up on the dashboard.
While predefined packages have a maximum weight which is checked by the API, manually created packages do not have a weight check.
Create custom parcel
Use predefined parcel
4. Pack parcel
Once the parcel for the fulfillment has been created, it is time to add items into it. You can specify adding items into the parcel the same way as when creating fulfillments or verifying manifests.
Example
Delete parcel
If you decide to delete the parcel from the fulfillment, any inventory attributed to that parcel will be removed and reset.
Example
5. Generate shipping rates
Since we've collected all of the shipping information throughout the process of creating and updating the fulfillment and the parcels within, we are able to generate shipping rates by just passing the fulfillment ID to the shipping API.
This will create a shipment ID on the fulfillment property, which you can use to retrieve the shipping rates and refresh the rates if the rates_generated_at
timestamp is more than 15 minutes old.
Get rates first time
Refresh rates
If you need to refresh the shipping rates, make a call to the refresh endpoint with the shipment ID property on your fulfillment, no body needed.
6. Generate shipping label
Once you have found the shipping label that suits your needs, you can purchase it by passing the rate ID into the request body. There are additional options availible here, please see the shipments section.
In the response, you'll have the label_url
with the PDF of your shipping label(s). If there are multiple shipping labels, the label_url
property will combine all shipping labels into one PDF document for easy printing. Each parcel in the shipment will also have its own PDF document attached to it.
Example
Cancel Fulfillment / Update Status
To cancel a fulfillment, update its status to "canceled". If you change your mind, reset its status to "processing".
The same options are available if you want to force the system to do a partial fulfillment. You can manually update the status of the fulfillment to packed, then generate a shipping label.
Example
Retrieve Fulfillment
Get a single fulfillment using its id
.
List Fulfillments
Example
When you want to retrieve multiple fulfillments, your data
property on the result will always be an array
even if you don't have any fulfillments.
Pagination
If the has_more
property on the pagination object is set to true, you know there are more fulfillments in the database that have not been returned to you. The pagination object also has a page
property indicating your current offset and a limit property. The total_count property in pagination returns the the total number of fulfillments in the database.
By default the page
is set to 1
and the limit
is 25
.
If we want to query for items 26 - 50, we would request page 2 with a query parameter.
Filter
You can filter fulfillments by location_id
, statuses
, recipient_contact_id
, updated_by
, value_added_services
and service_levels
.
Sorting
Sorting describes in what order you want your responses to come in. You can select an available property by which to sort, as well as the direction.
By default, fulfillments will be sorted by in descending order, meaning the most recently created will be first.
Search
There are times when filtering is not enough and you want to find a specific fulfillment by some other attribute. In this case, you can do a fuzzy, typo-tolerant search. Below are the properties that are supported by our full text search.
Searchable Properties
To search, simply provide a string to search by using the search
query param. The results will be order by the most relevant first.
If you want to highlight matching search results for a frontend, we provide a special property for search-returned fulfillment objects called _search
which will have the matched text surrounded with <mark>
handles.
Ordering Search Results
By default, search results are ordered by relevance. However, if you include an order_by
parameter along with your search query, the results will be ordered by the specified property instead of by relevance.
Relevance Score
Relevance scores are included in the search results by default. Note that this could add up to 10ms of extra time to the request.