Manually change a shipment state
Learn how to use the Change Shipment State endpoint to manually adjust shipment states for exceptional cases.
The change shipment state endpoint
This page explains how to use the Change Shipment State endpoint to make manual alterations to a shipment’s state
.
unallocated
to allocated
– this state change can only be carried out by the application itself as a result of a successful allocation.To call Change Shipment State, send a PUT
request to https://api.sorted.com/pro/shipments/state
. The body of the request should contain the unique reference
of the shipment whose state you want to edit, the state
that you want that shipment to be placed into, and a free text reason
property detailing the reason for the change.
The reason
property does not affect the request itself, but instead forms part of the shipment’s audit trail. The Shipments platform logs audit messages for all state transitions, including details of the change initiator.
Once it has received a valid Change Shipment State request, Shipments places the specified shipment into the requested state and returns a standard Resource Result object.
Example change shipment state call
The example below shows a request to put shipment sp_00874350842266620068172088868864 into a state of ready_to_ship
. Shipments responds with a message confirming that the shipment was placed into the requested state.
PUT https://api.sorted.com/pro/shipments/state
{
"reference": "sp_00874350842266620068172088868864",
"state": "ready_to_ship ",
"reason": "For reasons"
}
Change shipment state response
{
"reference": "sp_00874350842266620068172088868864",
"message": "Shipment sp_00874350842266620068172088868864 has changed state to ready_to_ship",
"_links": [
{
"href": "https://api-int.sorted.com/pro/shipments/sp_00874350842266620068172088868864",
"rel": "shipment",
"reference": "sp_00874350842266620068172088868864",
"type": "shipment"
}
]
}
For full reference information on the Change Shipment State endpoint, see the Shipments API reference.
Next steps
- Learn how to retrieve existing shipment groups: Get Shipment Groups
- Learn how to add and remove shipments from groups: Edit Shipment Groups
- Learn how to close shipment groups: Close Shipment Groups