Search…
API Reference
Resources
List all SKUs
How to fetch a collection of SKUs via API
To fetch a collection of SKUs, send a GET request to the /api/skus endpoint.

Request

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

Example

Request
Response
The following request fetches a collection of SKUs:
1
curl -g -X GET \
2
'https://yourdomain.commercelayer.io/api/skus/' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token'
Copied!
On success, the API responds with a 200 OK status code, returning a paginated collection of resource objects:
1
{
2
"data": [
3
{
4
"id": "xYZkjABcde",
5
"type": "skus",
6
"links": {
7
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde"
8
},
9
"attributes": {
10
"code": "TSHIRTMM000000FFFFFFXLXX",
11
"name": "Black Men T-shirt with White Logo (XL)",
12
"description": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
13
"image_url": "https://img.yourdomain.com/skus/xYZkjABcde.png",
14
"pieces_per_pack": 6,
15
"weight": 300.0,
16
"unit_of_weight": "gr",
17
"hs_tariff_number": "4901.91.0020",
18
"do_not_ship": false,
19
"do_not_track": false,
20
"created_at": "2018-01-01T12:00:00.000Z",
21
"updated_at": "2018-01-01T12:00:00.000Z",
22
"reference": "ANY-EXTERNAL-REFEFERNCE",
23
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
24
"metadata": {
25
"foo": "bar"
26
}
27
},
28
"relationships": {
29
"shipping_category": {
30
"links": {
31
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/shipping_category",
32
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/shipping_category"
33
}
34
},
35
"prices": {
36
"links": {
37
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/prices",
38
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/prices"
39
}
40
},
41
"stock_items": {
42
"links": {
43
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/stock_items",
44
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/stock_items"
45
}
46
},
47
"delivery_lead_times": {
48
"links": {
49
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/delivery_lead_times",
50
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/delivery_lead_times"
51
}
52
},
53
"sku_options": {
54
"links": {
55
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/sku_options",
56
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/sku_options"
57
}
58
},
59
"attachments": {
60
"links": {
61
"self": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/relationships/attachments",
62
"related": "https://yourdomain.commercelayer.io/api/skus/xYZkjABcde/attachments"
63
}
64
}
65
},
66
"meta": {
67
"mode": "test"
68
}
69
},
70
{
71
"other": "... 9 skus (first page)"
72
}
73
],
74
"meta": {
75
"record_count": 140,
76
"page_count": 14
77
},
78
"links": {
79
"first": "https://yourdomain.commercelayer.io/api/skus?page[number]=1&page[size]=10",
80
"next": "https://yourdomain.commercelayer.io/api/skus?page[number]=2&page[size]=10",
81
"last": "https://yourdomain.commercelayer.io/api/skus?page[number]=14&page[size]=10"
82
}
83
}
Copied!

Sortable attributes

The list of SKUs can be sorted by the following attributes:
  • code
  • id
  • created_at
  • updated_at
  • reference
  • reference_origin
Last modified 2mo ago