Create a SKU

How to create a SKU via API

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

Request

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

Arguments

Body Parameter
Type
Required

type

string

Required

attributes.code

string

Required

attributes.name

string

Required

attributes.description

string

Optional

attributes.image_url

string

Optional

attributes.pieces_per_pack

integer

Optional

attributes.weight

float

Optional

attributes.unit_of_weight

string

Optional

attributes.hs_tariff_number

string

Optional

attributes.do_not_ship

boolean

Optional

attributes.do_not_track

boolean

Optional

attributes.reference

string

Optional

attributes.reference_origin

string

Optional

attributes.metadata

object

Optional

relationships.shipping_category

object

Required

relationships.tags

array

Optional

Example

The following request creates a new SKU:

curl -g -X POST \
  'https://yourdomain.commercelayer.io/api/skus' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "skus",
    "attributes": {
      "code": "TSHIRTMM000000FFFFFFXLXX",
      "name": "Men's Black T-shirt with White Logo (XL)"
    },
    "relationships": {
      "shipping_category": {
        "data": {
          "type": "shipping_categories",
          "id": "ABCRtyUpBa"
        }
      }
    }
  }
}'

Last updated