Create a shipment

How to create a shipment via API

To create a new shipment, send a POST request to the /api/shipments endpoint, passing the resource arguments in the request body.

Request

POST https://yourdomain.commercelayer.io/api/shipments

Arguments

Body Parameter
Type
Required

type

string

Required

attributes.reference

string

Optional

attributes.reference_origin

string

Optional

attributes.metadata

object

Optional

relationships.order

object

Required

relationships.shipping_category

object

Optional

relationships.inventory_stock_location

object

Required

relationships.shipping_address

object

Optional

relationships.shipping_method

object

Optional

relationships.tags

array

Optional

Example

The following request creates a new shipment:

curl -g -X POST \
  'https://yourdomain.commercelayer.io/api/shipments' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "shipments",
    "relationships": {
      "order": {
        "data": {
          "type": "orders",
          "id": "ABCRtyUpBa"
        }
      },
      "inventory_stock_location": {
        "data": {
          "type": "inventory_stock_locations",
          "id": "BCDRtyUpBa"
        }
      }
    }
  }
}'

Last updated