Powered By GitBook
List all shipments
How to fetch a collection of shipments via API
To fetch a collection of shipments, send a GET request to the /api/shipments endpoint.

Request

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

Example

Request
Response
The following request fetches a collection of shipments:
1
curl -X GET \
2
https://yourdomain.commercelayer.io/api/shipments/ \
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": "shipments",
6
"links": {
7
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde"
8
},
9
"attributes": {
10
"number": "#1234/S/001",
11
"status": "draft",
12
"currency_code": "EUR",
13
"cost_amount_cents": 1000,
14
"cost_amount_float": 10.0,
15
"formatted_cost_amount": "€10,00",
16
"skus_count": 2,
17
"selected_rate_id": "rate_f89e4663c3ed47ee94d37763f6d21d54",
18
"rates": [
19
{
20
"id": "rate_f89e4663c3ed47ee94d37763f6d21d54",
21
"rate": "45.59",
22
"carrier": "DHLExpress",
23
"service": "MedicalExpress"
24
}
25
],
26
"purchase_error_code": "SHIPMENT.POSTAGE.FAILURE",
27
"purchase_error_message": "Account not allowed for this service.",
28
"get_rates_started_at": "2018-01-01T12:00:00.000Z",
29
"get_rates_completed_at": "2018-01-01T12:00:00.000Z",
30
"purchase_started_at": "2018-01-01T12:00:00.000Z",
31
"purchase_completed_at": "2018-01-01T12:00:00.000Z",
32
"purchase_failed_at": "2018-01-01T12:00:00.000Z",
33
"created_at": "2018-01-01T12:00:00.000Z",
34
"updated_at": "2018-01-01T12:00:00.000Z",
35
"reference": "ANY-EXTERNAL-REFEFERNCE",
36
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
37
"metadata": {
38
"foo": "bar"
39
}
40
},
41
"relationships": {
42
"order": {
43
"links": {
44
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/order",
45
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/order"
46
}
47
},
48
"shipping_category": {
49
"links": {
50
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/shipping_category",
51
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/shipping_category"
52
}
53
},
54
"stock_location": {
55
"links": {
56
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/stock_location",
57
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/stock_location"
58
}
59
},
60
"origin_address": {
61
"links": {
62
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/origin_address",
63
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/origin_address"
64
}
65
},
66
"shipping_address": {
67
"links": {
68
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/shipping_address",
69
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/shipping_address"
70
}
71
},
72
"shipping_method": {
73
"links": {
74
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/shipping_method",
75
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/shipping_method"
76
}
77
},
78
"delivery_lead_time": {
79
"links": {
80
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/delivery_lead_time",
81
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/delivery_lead_time"
82
}
83
},
84
"shipment_line_items": {
85
"links": {
86
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/shipment_line_items",
87
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/shipment_line_items"
88
}
89
},
90
"stock_line_items": {
91
"links": {
92
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/stock_line_items",
93
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/stock_line_items"
94
}
95
},
96
"stock_transfers": {
97
"links": {
98
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/stock_transfers",
99
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/stock_transfers"
100
}
101
},
102
"available_shipping_methods": {
103
"links": {
104
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/available_shipping_methods",
105
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/available_shipping_methods"
106
}
107
},
108
"carrier_accounts": {
109
"links": {
110
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/carrier_accounts",
111
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/carrier_accounts"
112
}
113
},
114
"parcels": {
115
"links": {
116
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/parcels",
117
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/parcels"
118
}
119
},
120
"attachments": {
121
"links": {
122
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/attachments",
123
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/attachments"
124
}
125
}
126
},
127
"meta": {
128
"mode": "test"
129
}
130
},
131
{
132
"other": "... 9 shipments (first page)"
133
}
134
],
135
"meta": {
136
"record_count": 140,
137
"page_count": 14
138
},
139
"links": {
140
"first": "https://yourdomain.commercelayer.io/api/shipments?page[number]=1&page[size]=10",
141
"next": "https://yourdomain.commercelayer.io/api/shipments?page[number]=2&page[size]=10",
142
"last": "https://yourdomain.commercelayer.io/api/shipments?page[number]=14&page[size]=10"
143
}
144
}
Copied!

Sortable attributes

The list of shipments can be sorted by the following attributes:
    status
    id
    created_at
    updated_at
    reference
    reference_origin
Last modified 25d ago