Create Order Release
Overview
This scenario demonstrates how to create an order release in the modern Shipwell Orders API framework. Think of an order release as creating a new child order from an existing order item.
Creating an order release from an existing order allows you to transfer specific items and amounts from the original order to a new, related order, giving you full control over separate management and fulfillment of orders and order line items. Order releases may also be created by and collaborated on with suppliers for customers with Shipwell Supplier Portal enabled.
Note
-
Shipwell
Orders
is the modern order framework that we build new functionality upon and the order framework that is documented in theorders
section of the Shipwell Developer Portal. We continue to maintain the strongOrders (Legacy/v2)
framework for existing customers that utilize this legacy framework, however functionality documented and described in thisorders
section does not pertain toOrders (Legacy/v2)
. - Frequently Asked Questions (FAQs) for orders are located here .
Steps
1. Authenticate and Receive API Token
Authenticate to the API using these steps.
Note
Authorization HTTP headers in API requests, e.g. Authorization: YOUR_AUTHORIZATION_HEADER
, typically take the form of Authorization: Token <user-token>
. For more information on API authentication, navigate to the Authenticate documentation.
2. Get Original Order
Get or retrieve the original order to create an order release from using these steps.
Example response
About This Response
This is an example original order that the new order release will be created from using one of the order line items and transferring part of the original order's line item amount (aka quantity) to another order by creating an order release.
{
"data": [
{
"custom_data": {
"shipwell_custom_data": {
"purchase_order": {}
}
},
"order_number": "ABC",
"ship_to": {
"country": "US",
"line_1": "742 E Evergreen St",
"line_2": null,
"line_3": null,
"locality": "Springfield",
"postal_code": "65803",
"region": "MO",
"urbanization": null,
"residential": false,
"geolocation": {
"latitude": 37.2497371,
"longitude": -93.2828686
},
"custom_data": {
"shipwell_custom_data": {
"purchase_order_stop": {}
}
},
"timezone": "America/Chicago",
"location_number": null,
"company_name": "Example 1st Dropoff",
"references": [
{
"qualifier": "ADDRESS_BOOK_ENTRY_ID",
"value": "1309a0fb-f3da-48be-9c9c-4393803a36c1"
},
{
"qualifier": "ADDRESS_BOOK_ENTRY_REFERENCE_ID",
"value": "Example 1st Dropoff"
}
],
"shipping_requirements": {
"plan_window": null
}
},
"name": "ABC",
"ship_from": {
"country": "US",
"line_1": "123 William St",
"line_2": null,
"line_3": null,
"locality": "New York",
"postal_code": "10038",
"region": "NY",
"urbanization": null,
"residential": false,
"geolocation": null,
"custom_data": {
"shipwell_custom_data": {
"purchase_order_stop": {}
}
},
"timezone": "America/New_York",
"location_number": null,
"company_name": "Clothing Wholesalers",
"references": [
{
"qualifier": "COMPANY_EXTERNAL_ID",
"value": "01HJ1F2KR2JVQWPTY9M1S1R0M4"
}
],
"shipping_requirements": {
"plan_window": null
}
},
"description": null,
"source": null,
"source_system_id": null,
"start_date": "2024-11-11",
"expiration_date": "2024-11-30",
"references": [
{
"qualifier": "PURCHASE_ORDER_NUMBER",
"value": "MARIO1"
}
],
"shipping_requirements": {
"bill_to": null
},
"id": "01JBYBDAMYC5ETWA5RJ55Z05BG",
"order_type": "PURCHASE_ORDER",
"status": "NOT_READY",
"items": [
{
"custom_data": {
"shipwell_custom_data": {}
},
"description": "Example Cold Goods",
"references": [
{
"qualifier": "PRODUCT_REF",
"value": "COLD-123"
}
],
"shipping_requirements": {
"description": "Example Cold Goods",
"identifying_marks": [],
"references": [],
"tare_weight": null,
"dimensions": {
"unit": "IN",
"length": "60",
"height": "50",
"width": "50"
},
"volume": null,
"customer_reference_number": null,
"hazmat": null,
"temperature": {
"unit": "F",
"minimum": "10",
"maximum": "30"
},
"product_id": "661825ee-375f-4445-a8e5-d963c8adfb0b",
"freight_class": null,
"nmfc_item_code": null,
"nmfc_sub_code": null,
"country_of_manufacture": null,
"stackable": true,
"piece_type": null,
"total_pieces": null,
"value_per_piece": null,
"gross_weight": {
"unit": "LB",
"value": "675"
},
"quantity": null,
"packaging_type": "PALLET",
"handling_unit_id": null,
"combined_handling_unit_info": null
},
"amount": {
"value": "500",
"unit": "CASE"
},
"id": "01JBYBDAN8AKTG3FQ2WYJFQ8EV",
"available_amount": {
"value": "150",
"unit": "CASE"
}
}
],
"supplier_created_releases_allowed": true,
"supplier": {
"name": "Clothing Wholesalers",
"address": {
"country": "US",
"line_1": "123 William St",
"line_2": null,
"line_3": null,
"locality": "New York",
"postal_code": "10038",
"region": "NY",
"urbanization": null,
"residential": false,
"geolocation": null
},
"identification_codes": [],
"phone_number": null,
"email": null,
"supplier_id": "01HJ1F2KR2JVQWPTY9M1S1R0M4"
},
"releases": [ // existing releases before creating the new order release
{
"id": "01JBYCJWKZYQ5H9H9F6M73TGX7",
"release_type": "ORDER",
"released_onto_order_id": "01JBYCJWKC7PRYHZMHFQ7ZP5H1"
},
{
"id": "01JBYSMJE75EYJ7XNN47A4ZB0N",
"release_type": "ORDER",
"released_onto_order_id": "01JBYSMJDMVJFE7S0KSH9JYFE6"
}
],
"released_from_release_id": null,
"created_from_order_id": null,
"cancelled_at": null,
"created_at": "2024-11-05T14:24:42.654324+00:00",
"updated_at": "2024-11-05T14:39:18.876287+00:00",
"tags": [],
"archived": false
}
],
"count": 1,
"total_count": 1,
"links": {
"next": null,
"prev": null,
"first": "http://sandbox-api.shipwell.com/orders?id=01JBYBDAMYC5ETWA5RJ55Z05BG&page=1",
"last": "http://sandbox-api.shipwell.com/orders?id=01JBYBDAMYC5ETWA5RJ55Z05BG&page=1"
}
}
3. Create Order Release
Create an order release that references order item details and order data from the parent order. The new order release will have the specified order item, order item amounts (aka quantities), and details transferred from the parent order and related order item on the parent to the "child order" to allow for separate management, fulfillment , etc.
-
Creating a
purchase order
release uses thePOST /purchase-orders/{order_id}/releases
API endpoint to indicate the details of the order line items that should be transferred and decremented from the original order onto a new order (i.e. move an amount of order line item X onto a new order while maintaining a reference to the original order). -
The new order release that is created from an original order automatically receives an incremented
order_number
.-
A dash (i.e. hyphen,
-
) and a sequential release number are added to the originalorder_number
. Theorder_number
is a freeformstring
field that is distinct from the system-generated uniqueorder_id
. -
For example, if the original
order_number
isABC
and this is the second release, the neworder_number
will beABC-2
.
-
A dash (i.e. hyphen,
-
The
auto_accept
order release property must be set totrue
for the created order release to be visible in the UI and for the order release to be accepted as a valid release. -
Order releases can be retrieved and managed like
regular orders via the API
, allowing you to perform operations such as
GET
andUPDATE
. Learn more about managing orders here .
Note
-
You may optionally set
shipping_requirements
when creating an order release, these will carry over to any shipments created from the new order by default. -
You may also optionally set and override
ship_from
details when creating the order release if it is different than the parent or original order.
Standard Order Release
Example request
Note
Creating a purchase order
release is a separate endpoint and process than creating a supplier-initiated sales order
release that is used by suppliers in Shipwell Supplier Portal. This guide pertains to purchase order
releases.
curl --location --request POST 'https://sandbox-api.shipwell.com/purchase-orders/{order_id}/releases' \
--header 'Content-Type: multipart/form-data' \
--header 'Authorization: YOUR_AUTHORIZATION_HEADER' \
--form 'data={
"release_type":"ORDER",
"auto_accept":true,
"items":[
{
"released_from_item_id":"01JBYBDAN8AKTG3FQ2WYJFQ8EV",
"released_amount":{
"unit":"CASE",
"value":"50"
},
"shipping_requirements":{
"description":"Example Cold Goods",
"identifying_marks":[
],
"references":[
],
"tare_weight":null,
"dimensions":{
"unit":"IN",
"length":"60",
"height":"50",
"width":"50"
},
"volume":null,
"customer_reference_number":null,
"hazmat":null,
"temperature":{
"unit":"F",
"minimum":"10",
"maximum":"30"
},
"product_id":"661825ee-375f-4445-a8e5-d963c8adfb0b",
"freight_class":null,
"nmfc_item_code":null,
"nmfc_sub_code":null,
"country_of_manufacture":null,
"stackable":true,
"piece_type":null,
"total_pieces":null,
"value_per_piece":null,
"gross_weight":{
"unit":"LB",
"value":"675"
},
"quantity":null,
"packaging_type":"PALLET",
"handling_unit_id":null,
"combined_handling_unit_info":null
}
}
]
}'
import requests
order_id = "YOUR_orderId_PARAMETER"
base_path = "/v2"
host = "sandbox-api.shipwell.com"
target_url = f"https://{host}{base_path}/purchase-orders/{order_id}/releases"
headers = {
"Content-Type": "multipart/form-data",
"Authorization": "YOUR_AUTHORIZATION_HEADER",
}
payload = {
"data": {
"release_type": "ORDER",
"auto_accept": True,
"items": [
{
"released_from_item_id": "01JBYBDAN8AKTG3FQ2WYJFQ8EV",
"released_amount": {"unit": "CASE", "value": "50"},
"shipping_requirements": {
"description": "Example Cold Goods",
"identifying_marks": [],
"references": [],
"tare_weight": None,
"dimensions": {
"unit": "IN",
"length": "60",
"height": "50",
"width": "50",
},
"volume": None,
"customer_reference_number": None,
"hazmat": None,
"temperature": {"unit": "F", "minimum": "10", "maximum": "30"},
"product_id": "661825ee-375f-4445-a8e5-d963c8adfb0b",
"freight_class": None,
"nmfc_item_code": None,
"nmfc_sub_code": None,
"country_of_manufacture": None,
"stackable": True,
"piece_type": None,
"total_pieces": None,
"value_per_piece": None,
"gross_weight": {"unit": "LB", "value": "675"},
"quantity": None,
"packaging_type": "PALLET",
"handling_unit_id": None,
"combined_handling_unit_info": None,
},
}
],
}
}
response = requests.put(target_url, headers=headers, json=payload)
data = response.json()
print(data)
import java.io.IOException;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
String orderId = "YOUR_orderId_PARAMETER";
String basePath = "/v2";
String host = "sandbox-api.shipwell.com";
String targetUrl = "https://" + host + basePath + "/purchase-orders/" + orderId + "/releases";
File file; // this is your file object
OkHttpClient client = new OkHttpClient().newBuilder().build();
String dataJson = """
{
"release_type": "ORDER",
"auto_accept": true,
"items": [
{
"released_from_item_id": "01JBYBDAN8AKTG3FQ2WYJFQ8EV",
"released_amount": {
"unit": "CASE",
"value": "50"
},
"shipping_requirements": {
"description": "Example Cold Goods",
"identifying_marks": [],
"references": [],
"tare_weight": null,
"dimensions": {
"unit": "IN",
"length": "60",
"height": "50",
"width": "50"
},
"volume": null,
"customer_reference_number": null,
"hazmat": null,
"temperature": {
"unit": "F",
"minimum": "10",
"maximum": "30"
},
"product_id": "661825ee-375f-4445-a8e5-d963c8adfb0b",
"freight_class": null,
"nmfc_item_code": null,
"nmfc_sub_code": null,
"country_of_manufacture": null,
"stackable": true,
"piece_type": null,
"total_pieces": null,
"value_per_piece": null,
"gross_weight": {
"unit": "LB",
"value": "675"
},
"quantity": null,
"packaging_type": "PALLET",
"handling_unit_id": null,
"combined_handling_unit_info": null
}
}
]
}
""";
String documentsMetadataJson = """
{
"document_metadata": [
{
"description": "File 1",
"type": "BOL"
},
{
"description": "File 2",
"type": "OTHER"
}
]
}
""";
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("data", dataJson)
.build();
Request request = new Request.Builder()
.url(targetUrl)
.method("POST", body)
.addHeader("Authorization", "YOUR_API_KEY_OR_AUTH_VALUE_HERE")
.build();
try (Response response = client.newCall(request).execute()) {
if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
System.out.println(response.body().string());
}
Advanced Order Release with Document Upload
Example request (advanced with document upload)
About This Request
This request shows how to upload and attach multiple documents to the order while creating the order release. This is the beauty of the multipart/form-data
Content-Type
that this endpoint and other file upload capable endpoints in Shipwell. Learn more about the general patterns for file uploads with access to the files or file bytes here.
curl --location --request POST 'https://sandbox-api.shipwell.com/purchase-orders/{order_id}/releases' \
--header 'Content-Type: multipart/form-data' \
--header 'Authorization: YOUR_AUTHORIZATION_HEADER' \
--form 'data={
"release_type":"ORDER",
"auto_accept":true,
"items":[
{
"released_from_item_id":"01JBYBDAN8AKTG3FQ2WYJFQ8EV",
"released_amount":{
"unit":"CASE",
"value":"50"
},
"shipping_requirements":{
"description":"Example Cold Goods",
"identifying_marks":[
],
"references":[
],
"tare_weight":null,
"dimensions":{
"unit":"IN",
"length":"60",
"height":"50",
"width":"50"
},
"volume":null,
"customer_reference_number":null,
"hazmat":null,
"temperature":{
"unit":"F",
"minimum":"10",
"maximum":"30"
},
"product_id":"661825ee-375f-4445-a8e5-d963c8adfb0b",
"freight_class":null,
"nmfc_item_code":null,
"nmfc_sub_code":null,
"country_of_manufacture":null,
"stackable":true,
"piece_type":null,
"total_pieces":null,
"value_per_piece":null,
"gross_weight":{
"unit":"LB",
"value":"675"
},
"quantity":null,
"packaging_type":"PALLET",
"handling_unit_id":null,
"combined_handling_unit_info":null
}
}
]
}' \
-form 'documents_metadata={
"document_metadata": [
{"description": "File 1", "type": "BOL"},
{"description": "File 2", "type": "OTHER"}
]
}' \
-form 'documents=@"/C:/Users/jdoe/temp/example-1.pdf"' \
-form 'documents=@"/C:/Users/jdoe/temp/example-another-file.pdf"'
import requests
order_id = "YOUR_orderId_PARAMETER"
base_path = "/v2"
host = "sandbox-api.shipwell.com"
target_url = f"https://{host}{base_path}/purchase-orders/{order_id}/releases"
headers = {
"Content-Type": "multipart/form-data",
"Authorization": "YOUR_AUTHORIZATION_HEADER",
}
payload = {
"data": {
"release_type": "ORDER",
"auto_accept": True,
"items": [
{
"released_from_item_id": "01JBYBDAN8AKTG3FQ2WYJFQ8EV",
"released_amount": {"unit": "CASE", "value": "50"},
"shipping_requirements": {
"description": "Example Cold Goods",
"identifying_marks": [],
"references": [],
"tare_weight": None,
"dimensions": {
"unit": "IN",
"length": "60",
"height": "50",
"width": "50",
},
"volume": None,
"customer_reference_number": None,
"hazmat": None,
"temperature": {"unit": "F", "minimum": "10", "maximum": "30"},
"product_id": "661825ee-375f-4445-a8e5-d963c8adfb0b",
"freight_class": None,
"nmfc_item_code": None,
"nmfc_sub_code": None,
"country_of_manufacture": None,
"stackable": True,
"piece_type": None,
"total_pieces": None,
"value_per_piece": None,
"gross_weight": {"unit": "LB", "value": "675"},
"quantity": None,
"packaging_type": "PALLET",
"handling_unit_id": None,
"combined_handling_unit_info": None,
},
}
],
},
"documents_metadata": {
"document_metadata": [
{"description": "File 1", "type": "BOL"},
{"description": "File 2", "type": "OTHER"}
]
}
}
with open("path/to/file/example.pdf", "rb") as bytes_of_file_or_file_like_object:
files = [
("file", ("example.pdf", bytes_of_file_or_file_like_object, "application/pdf"))
]
response = requests.put(target_url, headers=headers, data=payload, files=files)
data = response.json()
print(data)
import java.io.File;
import java.io.IOException;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
String orderId = "YOUR_orderId_PARAMETER";
String basePath = "/v2";
String host = "sandbox-api.shipwell.com";
String targetUrl = "https://" + host + basePath + "/purchase-orders/" + orderId + "/releases";
File file; // this is your file object
OkHttpClient client = new OkHttpClient().newBuilder().build();
String dataJson = """
{
"release_type": "ORDER",
"auto_accept": true,
"items": [
{
"released_from_item_id": "01JBYBDAN8AKTG3FQ2WYJFQ8EV",
"released_amount": {
"unit": "CASE",
"value": "50"
},
"shipping_requirements": {
"description": "Example Cold Goods",
"identifying_marks": [],
"references": [],
"tare_weight": null,
"dimensions": {
"unit": "IN",
"length": "60",
"height": "50",
"width": "50"
},
"volume": null,
"customer_reference_number": null,
"hazmat": null,
"temperature": {
"unit": "F",
"minimum": "10",
"maximum": "30"
},
"product_id": "661825ee-375f-4445-a8e5-d963c8adfb0b",
"freight_class": null,
"nmfc_item_code": null,
"nmfc_sub_code": null,
"country_of_manufacture": null,
"stackable": true,
"piece_type": null,
"total_pieces": null,
"value_per_piece": null,
"gross_weight": {
"unit": "LB",
"value": "675"
},
"quantity": null,
"packaging_type": "PALLET",
"handling_unit_id": null,
"combined_handling_unit_info": null
}
}
]
}
""";
String documentsMetadataJson = """
{
"document_metadata": [
{
"description": "File 1",
"type": "BOL"
},
{
"description": "File 2",
"type": "OTHER"
}
]
}
""";
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("file", file.getName(),
RequestBody.create(MediaType.parse("application/pdf"), file))
.addFormDataPart("data", dataJson)
.addFormDataPart("documents_metadata", documentsMetadataJson)
.build();
Request request = new Request.Builder()
.url(targetUrl)
.method("POST", body)
.addHeader("Authorization", "YOUR_API_KEY_OR_AUTH_VALUE_HERE")
.build();
try (Response response = client.newCall(request).execute()) {
if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
System.out.println(response.body().string());
}
Example response
About This Response Payload
{
"custom_data": null,
"release_type": "ORDER",
"ready_to_ship_at": null,
"ship_from": null,
"id": "01JC3RWV3MDJ2GVZ9SBGP94NRW",
"created_from_order_id": "01JBYBDAMYC5ETWA5RJ55Z05BG",
"status": "ACCEPTED",
"released_onto_order_id": "01JC3RWV2YB8FE3QCGXBATEZ22",
"accepted_at": "2024-11-07T16:56:34.465597+00:00",
"rejected_at": null,
"cancelled_at": null,
"items": [
{
"custom_data": null,
"released_from_item_id": "01JBYBDAN8AKTG3FQ2WYJFQ8EV",
"released_amount": {
"value": "50",
"unit": "CASE"
},
"shipping_requirements": {
"description": "Example Cold Goods",
"identifying_marks": [],
"references": [],
"tare_weight": null,
"dimensions": {
"unit": "IN",
"length": "60",
"height": "50",
"width": "50"
},
"volume": null,
"customer_reference_number": null,
"hazmat": null,
"temperature": {
"unit": "F",
"minimum": "10",
"maximum": "30"
},
"product_id": "661825ee-375f-4445-a8e5-d963c8adfb0b",
"freight_class": null,
"nmfc_item_code": null,
"nmfc_sub_code": null,
"country_of_manufacture": null,
"stackable": true,
"piece_type": null,
"total_pieces": null,
"value_per_piece": null,
"gross_weight": {
"unit": "LB",
"value": "675"
},
"quantity": 1,
"packaging_type": "PALLET",
"handling_unit_id": null,
"combined_handling_unit_info": null
},
"released_to_item_id": "01JC3RWV3907TQ7KWNXFA40824"
}
],
"documents": []
}
Before Order Release Creation
Before creating the new order release, the example order had two existing order releases as noted in the releases
property on the order.
"releases": [ // two order releases on order
{
"id": "01JBYCJWKZYQ5H9H9F6M73TGX7",
"release_type": "ORDER",
"released_onto_order_id": "01JBYCJWKC7PRYHZMHFQ7ZP5H1"
},
{
"id": "01JBYSMJE75EYJ7XNN47A4ZB0N",
"release_type": "ORDER",
"released_onto_order_id": "01JBYSMJDMVJFE7S0KSH9JYFE6"
}
],
After Order Release Creation
After creating the third new order release, the original parent order will have three order releases as noted in the releases
property on the order.
"releases": [ // three order releases on order
{
"id": "01JBYCJWKZYQ5H9H9F6M73TGX7",
"release_type": "ORDER",
"released_onto_order_id": "01JBYCJWKC7PRYHZMHFQ7ZP5H1"
},
{
"id": "01JBYSMJE75EYJ7XNN47A4ZB0N",
"release_type": "ORDER",
"released_onto_order_id": "01JBYSMJDMVJFE7S0KSH9JYFE6"
},
{
"id": "01JC3RWV3MDJ2GVZ9SBGP94NRW",
"release_type": "ORDER",
"released_onto_order_id": "01JC3RWV2YB8FE3QCGXBATEZ22"
}
]
The available_amount
for the order line item on the original parent order will also be decreased by the amount or quantity of the order release since the order items in the specified quantities have been transferred to the order release.
{
// other order properties
"items": [
{
// other order item properties
"id": "01JBYBDAN8AKTG3FQ2WYJFQ8EV",
"available_amount": {
"value": "100",
"unit": "CASE"
},
"description": "Example Cold Goods",
"references": [
{
"qualifier": "PRODUCT_REF",
"value": "COLD-123"
}
],
// other order item properties
}
//.. other order items
],
// ... other order properties
}