Update a shipment

How to update an existing shipment via API

To update an existing shipment, send a PATCH request to the /api/shipments/:id endpoint, where id is the ID of the resource that you want to update.

Here below the list of all the possible arguments that you can pass with the request body.

Request

PATCH https://yourdomain.commercelayer.io/api/shipments/:id

Arguments

Body Parameter
Type
Required

type

string

Required

id

string

Required

attributes.number

string

Optional

attributes._upcoming

boolean

Optional

attributes._cancel

boolean

Optional

attributes._on_hold

boolean

Optional

attributes._picking

boolean

Optional

attributes._packing

boolean

Optional

attributes._ready_to_ship

boolean

Optional

attributes._ship

boolean

Optional

attributes._deliver

boolean

Optional

attributes._reserve_stock

boolean

Optional

attributes._release_stock

boolean

Optional

attributes._decrement_stock

boolean

Optional

attributes._get_rates

boolean

Optional

attributes.selected_rate_id

string

Optional

attributes._purchase

boolean

Optional

attributes.reference

string

Optional

attributes.reference_origin

string

Optional

attributes.metadata

object

Optional

relationships.shipping_category

object

Optional

relationships.inventory_stock_location

object

Optional

relationships.shipping_address

object

Optional

relationships.shipping_method

object

Optional

relationships.tags

array

Optional

Example

The following request updates the shipment identified by the ID "xYZkjABcde":

curl -g -X PATCH \
  'https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "shipments",
    "id": "xYZkjABcde",
    "attributes": {
      "_upcoming": true
    },
    "relationships": {
      "shipping_category": {
        "data": {
          "type": "shipping_categories",
          "id": "ABCRtyUpBa"
        }
      }
    }
  }
}'

Last updated