Sku Options

SKU options represent any personalization or feature that customers can add to selected SKUs. They can have a price and a delay time (e.g., preparation time) and are defined by Market.

The sku option object

A sku option object is returned as part of the response body of each successful create, list, retrieve or update API call. The following table contains the list of all its fields along with their type, description and example values.
Object fields:
name
string
The marsku option's internal name
Example:
Embossing
price_amount_cents
integer
The price of this shipping method, in cents.
Example:
1000
price_amount_float
float
The price of this shipping method, float.
Example:
10.00
formatted_price_amount
string
The price of this shipping method, formatted.
Example:
€10,00
delay_hours
integer
The delay time (in hours) that should be added to the delivery lead time when this option is purchased.
Example:
48
delay_days
integer
The delay time, in days (rounded)
Example:
2
sku_code_regex
string
The regex that will be evaluated to match the sku codes.
Example:
^(A|B).*$
id
integer
Unique identifier for the resource.
Example:
1234
created_at
datetime
Time at which the resource was created.
Example:
2018-01-01T12:00:00.000Z
updated_at
datetime
Time at which the resource was last updated.
Example:
2018-01-01T12:00:00.000Z
reference
string
A string that you can use to add your own identifier to the resource. This can be useful for intergrating the resource to an external system, like an ERP, a marketing tool or a CRM.
Example:
ANYREFEFERNCE
metadata
object
Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.
Example:
{"foo":"bar"}
relationship (N:1)
The associated market.

Create a sku option

To create a new sku option, send a POST request to the /api/sku_options endpoint, passing the resource arguments in the request body. The following table contains the list of all the possible arguments, along with their type, description and examples values. All the arguments marked as required must be present in the request.
Arguments:
name
required
The marsku option's internal name
Example:
Embossing
price_amount_cents
optional, default is '0'
The price of this shipping method, in cents.
Example:
1000
delay_hours
optional, default is '0'
The delay time (in hours) that should be added to the delivery lead time when this option is purchased.
Example:
48
sku_code_regex
optional
The regex that will be evaluated to match the sku codes.
Example:
^(A|B).*$
reference
optional
A string that you can use to add your own identifier to the resource. This can be useful for intergrating the resource to an external system, like an ERP, a marketing tool or a CRM.
Example:
ANYREFEFERNCE
metadata
optional
Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.
Example:
#
required
The associated market.
Example request:
POST /api/sku_options HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
  "data": {
    "type": "sku_options",
    "attributes": {
      "name": "Embossing"
    },
    "relationships": {
      "market": {
        "data": {
          "type": "markets",
          "id": "1234"
        }
      }
    }
  }
}
Example response: 201 Created
HTTP/1.1 201 Created
Content-Type: application/vnd.api+json

{
  "data": {
    "id": "1234",
    "type": "sku_options",
    "links": {
      "self": "https://your-brand.commercelayer.io/api/sku_options/1234"
    },
    "attributes": {
      "name": "Embossing",
      "price_amount_cents": "1000",
      "price_amount_float": "10.00",
      "formatted_price_amount": "€10,00",
      "delay_hours": "48",
      "delay_days": "2",
      "sku_code_regex": "^(A|B).*$",
      "id": "1234",
      "created_at": "2018-01-01T12:00:00.000Z",
      "updated_at": "2018-01-01T12:00:00.000Z",
      "reference": "ANYREFEFERNCE",
      "metadata": {
        "foo": "bar"
      }
    },
    "relationships": {
      "market": {
        "links": {
          "self": "https://your-brand.commercelayer.io/api/sku_options/1234/relationships/market",
          "related": "https://your-brand.commercelayer.io/api/sku_options/1234/market"
        }
      }
    },
    "meta": {
      "mode": "test"
    }
  }
}

List all sku options

To fetch a collection of sku options, send a GET request to the /api/sku_options endpoint.

Example request:
GET /api/sku_options HTTP/1.1
Accept: application/vnd.api+json
Example response: 200 OK
HTTP/1.1 200 OK
Content-Type: application/vnd.api+json

{
  "data": [
    {
      "id": "1234",
      "type": "sku_options",
      "links": {
        "self": "https://your-brand.commercelayer.io/api/sku_options/1234"
      },
      "attributes": {
        "name": "Embossing",
        "price_amount_cents": "1000",
        "price_amount_float": "10.00",
        "formatted_price_amount": "€10,00",
        "delay_hours": "48",
        "delay_days": "2",
        "sku_code_regex": "^(A|B).*$",
        "id": "1234",
        "created_at": "2018-01-01T12:00:00.000Z",
        "updated_at": "2018-01-01T12:00:00.000Z",
        "reference": "ANYREFEFERNCE",
        "metadata": {
          "foo": "bar"
        }
      },
      "relationships": {
        "market": {
          "links": {
            "self": "https://your-brand.commercelayer.io/api/sku_options/1234/relationships/market",
            "related": "https://your-brand.commercelayer.io/api/sku_options/1234/market"
          }
        }
      },
      "meta": {
        "mode": "test"
      }
    },
    {
      "other": "... 24 sku_options (first page)"
    }
  ],
  "meta": {
    "record_count": 125,
    "page_count": 5
  },
  "links": {
    "first": "/api/sku_options?page[number]=1&page[size]=25",
    "prev": "/api/sku_options?page[number]=2&page[size]=25",
    "next": "/api/sku_options?page[number]=4&page[size]=25",
    "last": "/api/sku_options?page[number]=5&page[size]=25"
  }
}
Available filters
idreferencemarket_ididscreated_at_fromcreated_at_toupdated_at_fromupdated_at_to
Sortable attributes
nameprice_amount_centsdelay_hoursidcreated_atupdated_atreference

Retrieve a sku option

To fetch a single sku option, send a GET request to the /api/sku_options/{{id}} endpoint, where {{id}} is the id of the resource that you want to retrieve.
Example request:
GET /api/sku_options/1234 HTTP/1.1
Accept: application/vnd.api+json
Example response: 200 OK
HTTP/1.1 200 OK
Content-Type: application/vnd.api+json

{
  "data": {
    "id": "1234",
    "type": "sku_options",
    "links": {
      "self": "https://your-brand.commercelayer.io/api/sku_options/1234"
    },
    "attributes": {
      "name": "Embossing",
      "price_amount_cents": "1000",
      "price_amount_float": "10.00",
      "formatted_price_amount": "€10,00",
      "delay_hours": "48",
      "delay_days": "2",
      "sku_code_regex": "^(A|B).*$",
      "id": "1234",
      "created_at": "2018-01-01T12:00:00.000Z",
      "updated_at": "2018-01-01T12:00:00.000Z",
      "reference": "ANYREFEFERNCE",
      "metadata": {
        "foo": "bar"
      }
    },
    "relationships": {
      "market": {
        "links": {
          "self": "https://your-brand.commercelayer.io/api/sku_options/1234/relationships/market",
          "related": "https://your-brand.commercelayer.io/api/sku_options/1234/market"
        }
      }
    },
    "meta": {
      "mode": "test"
    }
  }
}

Update a sku option

To update an existing sku option, send a PATCH request to the /api/sku_options/{{id}} endpoint, where {{id}} is the id of the resource that you want to update. The following table contains the list of all the possible arguments that you can pass with the request body, along with their type, description and examples values. Please note that all arguments are optional.
Arguments:
name
optional
The marsku option's internal name
Example:
Embossing
price_amount_cents
optional
The price of this shipping method, in cents.
Example:
1000
delay_hours
optional
The delay time (in hours) that should be added to the delivery lead time when this option is purchased.
Example:
48
sku_code_regex
optional
The regex that will be evaluated to match the sku codes.
Example:
^(A|B).*$
reference
optional
A string that you can use to add your own identifier to the resource. This can be useful for intergrating the resource to an external system, like an ERP, a marketing tool or a CRM.
Example:
ANYREFEFERNCE
metadata
optional
Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format.
Example:
#
optional
The associated market.
Example request:
PATCH /api/sku_options/1234 HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
  "data": {
    "type": "sku_options",
    "id": 1234,
    "attributes": {
      "name": "Embossing"
    },
    "relationships": {
    }
  }
}
Example response: 200 OK
HTTP/1.1 200 OK
Content-Type: application/vnd.api+json

{
  "data": {
    "id": "1234",
    "type": "sku_options",
    "links": {
      "self": "https://your-brand.commercelayer.io/api/sku_options/1234"
    },
    "attributes": {
      "name": "Embossing",
      "price_amount_cents": "1000",
      "price_amount_float": "10.00",
      "formatted_price_amount": "€10,00",
      "delay_hours": "48",
      "delay_days": "2",
      "sku_code_regex": "^(A|B).*$",
      "id": "1234",
      "created_at": "2018-01-01T12:00:00.000Z",
      "updated_at": "2018-01-01T12:00:00.000Z",
      "reference": "ANYREFEFERNCE",
      "metadata": {
        "foo": "bar"
      }
    },
    "relationships": {
      "market": {
        "links": {
          "self": "https://your-brand.commercelayer.io/api/sku_options/1234/relationships/market",
          "related": "https://your-brand.commercelayer.io/api/sku_options/1234/market"
        }
      }
    },
    "meta": {
      "mode": "test"
    }
  }
}

Delete a sku option

To delete a sku option, send a DELETE request to the /api/sku_options/{{id}} endpoint, where {{id}} is the id of the resource that you want to delete.
Example request:
DELETE /api/sku_options/1234 HTTP/1.1
Accept: application/vnd.api+json
Example response: 204 No Content
HTTP/1.1 204 No Content

Get our machine-readable JSON schema that follows the OpenAPI Specification (formerly Swagger).

Get our Postman collection in one click and start making real calls to Commerce Layer API in minutes.

Get in touch with our support team if you have any questions or want to learn more about Commerce Layer.