Create a shipping method

How to create a shipping method via API

To create a new shipping method, send a POST request to the /api/shipping_methods endpoint, passing the resource arguments in the request body.

Request

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

Arguments

Body ParameterTypeRequired

type

string

Required

attributes.name

string

Required

attributes.scheme

string

Optional, default is 'flat'

attributes.currency_code

string

Required, unless inherited by market

attributes.external_prices_url

string

Required, if external scheme

attributes.price_amount_cents

integer

Required

attributes.free_over_amount_cents

integer

Optional

attributes.use_subtotal

boolean

Optional, deafult is 'false'

attributes.min_weight

float

Optional

attributes.max_weight

float

Optional

attributes.unit_of_weight

string

Optional, unless min or max weight are specified

attributes._disable

boolean

Optional

attributes._enable

boolean

Optional

attributes.reference

string

Optional

attributes.reference_origin

string

Optional

attributes.metadata

object

Optional

relationships.market

object

Optional

relationships.shipping_zone

object

Optional

relationships.shipping_category

object

Optional

relationships.stock_location

object

Optional

relationships.shipping_method_tiers

array

Optional

Example

The following request creates a new shipping method:

curl -g -X POST \
  'https://yourdomain.commercelayer.io/api/shipping_methods' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "shipping_methods",
    "attributes": {
      "name": "Standard shipping",
      "currency_code": "EUR",
      "external_prices_url": "https://external_prices.yourbrand.com",
      "price_amount_cents": 1000
    }
  }
}'

Last updated