Create a stock transfer

How to create a stock transfer via API

To create a new stock transfer, send a POST request to the /api/stock_transfers endpoint, passing the resource arguments in the request body.

Request

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

Arguments

Body ParameterTypeRequired

type

string

Required

attributes.sku_code

string

Optional

attributes.quantity

integer

Required

attributes.reference

string

Optional

attributes.reference_origin

string

Optional

attributes.metadata

object

Optional

relationships.sku

object

Required

relationships.origin_stock_location

object

Required

relationships.destination_stock_location

object

Required

relationships.shipment

object

Optional

relationships.line_item

object

Optional

Example

The following request creates a new stock transfer:

curl -g -X POST \
  'https://yourdomain.commercelayer.io/api/stock_transfers' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "stock_transfers",
    "attributes": {
      "quantity": 2
    },
    "relationships": {
      "sku": {
        "data": {
          "type": "skus",
          "id": "ABCRtyUpBa"
        }
      },
      "origin_stock_location": {
        "data": {
          "type": "stock_locations",
          "id": "BCDRtyUpBa"
        }
      },
      "destination_stock_location": {
        "data": {
          "type": "stock_locations",
          "id": "CDERtyUpBa"
        }
      }
    }
  }
}'

Last updated