Edit shipment groups
Add or remove shipments from a shipment group in bulk or individually, and manage grouped lock states.
Adding and removing shipments in bulk
The Update Shipment Group endpoint enables you to add and/or remove multiple shipments from a shipment group in a single API request. To call Update Shipment Group, send a PUT
request to https://api.sorted.com/pro/shipment_groups/
. The body of the request should contain:
- The unique
reference
of the shipment group you want to update (not the user-definedcustom_reference
). This must be an open and unlocked shipment group. - An
add_shipments
property listing the uniquereferences
of the shipments you want to add to the group. These shipments must not be a member of either the specified shipment group or any other open shipment group. - A
remove_shipments
property listing the uniquereferences
of the shipments you want to remove from the group. These shipments must be a member of the specified shipment group.
Once it has received the request, Ship makes the requested additions and removals and returns a standard resource result object with links to the updated shipment group.
Note that, while Ship validates the format of the provided shipment reference and confirms whether the shipment is allocated and part of an existing shipment group, it does not validate whether the shipment itself exists. As such, Ship will still return a 200 OK
response if you provide a reference to a non-existing shipment, as long as that reference is in a valid format. For full reference information on the Update Shipment Group endpoint, see the Shipments API reference.
Update shipment group example
The example shows a request to add three shipments to and remove two shipments from shipment group sg_00682731282010871067439042134016.
https://api.sorted.com/pro/shipment_groups/
{
"reference": "sg_00682731282010871067439042134016",
"add_shipments": [
"sp_00682731282010871067439042134016",
"sp_00682731282010871067439042134045",
"sp_00682731282010871067439042134076"
],
"remove_shipments": [
"sp_00682731282010871067439042134765",
"sp_00682731282010871067439042134100"
]
}
Update shipment group response
{
"reference": "sg_00682731282010871067439042134016",
"message": "Shipment group sg_00682731282010871067439042134016 updated successfully",
"_links": [
{
"href": "https://beta.sorted.com/pro/shipments/groups/sg_00682731282010871067439042134016",
"rel": "self",
"reference": "sg_00682731282010871067439042134016",
"type": "shipment_group"
}
]
}
Add individual shipments to a shipment group
The Add Shipment to Group endpoints enable you to add individual shipments to an open and unlocked shipment group. You can select the group to add the shipment to in two ways:
- Using the group’s unique
{reference}
- send aPUT
request tohttps://api.sorted.com/pro/shipment_groups/{reference}/shipments/{shipment_ref}
. - Using a combination of the group’s
{custom_ref}
and{version}
- send aPUT
request tohttps://api.sorted.com/pro/shipment_groups/custom_reference/{custom_ref}/{version}/shipments/{shipment_ref}
. The{version}
parameter can be either an integer or the value latest.
For an explanation of versioning in shipment groups, see the Versioning in Shipment Groups section of the Get Shipment Groups page.
{shipment_ref}
is the unique reference of the shipment you want to add to the group. This shipment must not be a member of either the specified shipment group or any other open shipment group.Once it has received the request, Ship adds the specified shipment to the specified group and returns a standard resource result object with links to the shipment group that was updated.
Add shipment to group examples
The examples show two requests to add shipment sp_00013473827456470532303387361290 to group sg_00013464648946915264789208891778. In the first call, the group is identified by its unique {reference}
, and in the second it is identified by its {custom_ref}
and {version}
. The response for both calls is the same.
PUT https://api.sorted.com/pro/shipment_groups/sg_00013464648946915264789208891778/shipments/sp_00013473827456470532303387361290
PUT https://api.sorted.com/pro/shipment_groups/custom_reference/CarrierX-PM/1/shipments/sp_00013473827456470532303387361290
Add shipment to group response
{
"reference": "sg_00013464648946915264789208891778",
"message": "Shipment group sg_00013464648946915264789208891778 updated successfully",
"_links": [
{
"href": "https://beta.sorted.com/pro/shipments/groups/sg_00013464648946915264789208891778",
"rel": "self",
"reference": "sg_00013464648946915264789208891778",
"type": "shipment_group"
}
]
}
Remove individual shipments from a group
The Remove Shipment from Group endpoints enable you to remove individual shipments from an open and unlocked shipment group. You can specify the group that the shipment is to be removed from in two ways:
- Using the group’s unique
{reference}
- send aDELETE
request tohttps://api.sorted.com/pro/shipment_groups/{reference}/shipments/{shipment_ref}
. This must be an open and unlocked shipment group. - Using a combination of the group’s
{custom_ref}
and{version}
- send aDELETE
request tohttps://api.sorted.com/pro/shipment_groups/custom_reference/{custom_ref}/{version}/shipments/{shipment_ref}
. The{version}
parameter can be either an integer or the value latest.
For more information on how versioning works in shipment groups, see the Versioning in Shipment Groups section of the Get Shipment Groups page.
{shipment_ref}
is the unique reference of the shipment you want to remove from the group. This shipment must be a member of the specified shipment group.Once it has received the request, Shipments removes the specified shipment from the specified group and returns a standard resource result object with links to the updated shipment group.
Remove shipment from group examples
The examples show two requests to remove shipment sp_00013473827456470532303387361290 from group sg_00013464648946915264789208891778. In the first call, the group is identified by its unique {reference}
, and in the second it is identified by its {custom_ref}
and {version}
. The response for both calls is the same.
Remove shipment from group request
DELETE https://api.sorted.com/pro/shipment_groups/sg_00013464648946915264789208891778/shipments/sp_00013473827456470532303387361290
DELETE https://api.sorted.com/pro/shipment_groups/custom_reference/CarrierX-PM/1/shipments/sp_00013473827456470532303387361290
Remove shipment from group response
{
"reference": "sg_00013464648946915264789208891778",
"message": "Shipment group sg_00013464648946915264789208891778 updated successfully",
"_links": [
{
"href": "https://beta.sorted.com/pro/shipments/groups/sg_00013464648946915264789208891778",
"rel": "self",
"reference": "sg_00013464648946915264789208891778",
"type": "shipment_group"
}
]
}
Lock and unlock shipment groups
Locking a shipment group means that it can no longer be edited.
Lock shipment groups
You can lock shipment groups using the Lock Shipment Group endpoint. To call Lock Shipment Group, send a POST
request to https://api.sorted.com/pro/shipment_groups/{reference}/lock
, where {reference}
is the unique reference of the group you want to lock.
Shipments API locks the group and returns a standard resource result object with links to the shipment group that was updated.
For full reference information on the Lock Shipment Group endpoint, see the Shipments API reference.
Unlock shipment groups
You can unlock shipment groups using the Unlock Shipment Group endpoint. To call Unlock Shipment Group, send a POST
request to https://api.sorted.com/pro/shipment_groups/{reference}/unlock
, where {reference}
is the unique reference of the group you want to unlock.
The Shipments platform unlocks the group and returns a standard resource result object with links to the shipment group that was updated.
For full reference information on the Unlock Shipment Group endpoint, see the Shipments data contract.
Example
The example shows a successful request to lock shipment group sg_00013464648946915264789208891778.
POST https://api.sorted.com/pro/shipment_groups/sg_00013464648946915264789208891778/lock
{
"reference": "sg_00013464648946915264789208891778",
"message": "Shipment group sg_00013464648946915264789208891778 locked successfully",
"_links": [
{
"href": "https://beta.sorted.com/pro/shipments/groups/sg_00013464648946915264789208891778",
"rel": "self",
"reference": "sg_00013464648946915264789208891778",
"type": "shipment_group"
}
]
}
Next steps
- Learn how to retrieve existing shipment groups: Get Shipment Groups
- Learn how to close shipment groups: Close Shipment Groups