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

Request

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

Example

Request
Response
The following request fetches a collection of orders:
1
curl -g -X GET \
2
'https://yourdomain.commercelayer.io/api/orders/' \
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": "orders",
6
"links": {
7
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde"
8
},
9
"attributes": {
10
"number": 1234,
11
"autorefresh": true,
12
"status": "draft",
13
"payment_status": "unpaid",
14
"fulfillment_status": "unfulfilled",
15
"guest": true,
16
"editable": true,
17
"customer_email": "[email protected]",
18
"language_code": "it",
19
"currency_code": "EUR",
20
"tax_included": true,
21
"tax_rate": 0.22,
22
"freight_taxable": true,
23
"requires_billing_info": false,
24
"country_code": "IT",
25
"shipping_country_code_lock": "IT",
26
"coupon_code": "SUMMERDISCOUNT",
27
"gift_card_code": "cc92c23e-967e-48b2-a323-59add603301f",
28
"gift_card_or_coupon_code": "cc92c23e-967e-48b2-a323-59add603301f",
29
"subtotal_amount_cents": 5000,
30
"subtotal_amount_float": 50.0,
31
"formatted_subtotal_amount": "€50,00",
32
"shipping_amount_cents": 1200,
33
"shipping_amount_float": 12.0,
34
"formatted_shipping_amount": "€12,00",
35
"payment_method_amount_cents": 0,
36
"payment_method_amount_float": 0.0,
37
"formatted_payment_method_amount": "€0,00",
38
"discount_amount_cents": -500,
39
"discount_amount_float": -5.0,
40
"formatted_discount_amount": "-€5,00",
41
"adjustment_amount_cents": 1500,
42
"adjustment_amount_float": 15.0,
43
"formatted_adjustment_amount": "€15,00",
44
"gift_card_amount_cents": 1500,
45
"gift_card_amount_float": 15.0,
46
"formatted_gift_card_amount": "€15,00",
47
"total_tax_amount_cents": 1028,
48
"total_tax_amount_float": 10.28,
49
"formatted_total_tax_amount": "€10,28",
50
"subtotal_tax_amount_cents": 902,
51
"subtotal_tax_amount_float": 9.02,
52
"formatted_subtotal_tax_amount": "€9,02",
53
"shipping_tax_amount_cents": 216,
54
"shipping_tax_amount_float": 2.16,
55
"formatted_shipping_tax_amount": "€2,16",
56
"payment_method_tax_amount_cents": 0,
57
"payment_method_tax_amount_float": 0.0,
58
"formatted_payment_method_tax_amount": "€0,00",
59
"adjustment_tax_amount_cents": 900,
60
"adjustment_tax_amount_float": 9.0,
61
"formatted_adjustment_tax_amount": "€9,00",
62
"total_amount_cents": 5700,
63
"total_amount_float": 57.0,
64
"formatted_total_amount": "€57,00",
65
"total_taxable_amount_cents": 4672,
66
"total_taxable_amount_float": 46.72,
67
"formatted_total_taxable_amount": "€46,72",
68
"subtotal_taxable_amount_cents": 4098,
69
"subtotal_taxable_amount_float": 40.98,
70
"formatted_subtotal_taxable_amount": "€40,98",
71
"shipping_taxable_amount_cents": 984,
72
"shipping_taxable_amount_float": 9.84,
73
"formatted_shipping_taxable_amount": "€9,84",
74
"payment_method_taxable_amount_cents": 0,
75
"payment_method_taxable_amount_float": 0.0,
76
"formatted_payment_method_taxable_amount": "€0,00",
77
"adjustment_taxable_amount_cents": 120,
78
"adjustment_taxable_amount_float": 1.2,
79
"formatted_adjustment_taxable_amount": "€1,20",
80
"total_amount_with_taxes_cents": 5700,
81
"total_amount_with_taxes_float": 57.0,
82
"formatted_total_amount_with_taxes": "€57,00",
83
"fees_amount_cents": 0,
84
"fees_amount_float": 0.0,
85
"formatted_fees_amount": "€0,00",
86
"duty_amount_cents": 0,
87
"duty_amount_float": 0.0,
88
"formatted_duty_amount": "€0,00",
89
"skus_count": 2,
90
"line_item_options_count": 1,
91
"shipments_count": 1,
92
"payment_source_details": {
93
"foo": "bar"
94
},
95
"token": "1c0994cc4e996e8c6ee56a2198f66f3c",
96
"cart_url": "https://yourdomain.com/cart",
97
"return_url": "https://yourdomain.com/",
98
"terms_url": "https://yourdomain.com/terms",
99
"privacy_url": "https://yourdomain.com/privacy",
100
"checkout_url": "https://yourdomain.commercelayer.io/checkout/1c0994cc4e996e8c6ee56a2198f66f3c",
101
"placed_at": "2018-01-01T12:00:00.000Z",
102
"approved_at": "2018-01-01T12:00:00.000Z",
103
"cancelled_at": "2018-01-01T12:00:00.000Z",
104
"payment_updated_at": "2018-01-01T12:00:00.000Z",
105
"fulfillment_updated_at": "2018-01-01T12:00:00.000Z",
106
"refreshed_at": "2018-01-01T12:00:00.000Z",
107
"archived_at": "2018-01-01T12:00:00.000Z",
108
"expires_at": "2018-01-01T12:00:00.000Z",
109
"created_at": "2018-01-01T12:00:00.000Z",
110
"updated_at": "2018-01-01T12:00:00.000Z",
111
"reference": "ANY-EXTERNAL-REFEFERNCE",
112
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
113
"metadata": {
114
"foo": "bar"
115
}
116
},
117
"relationships": {
118
"market": {
119
"links": {
120
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/market",
121
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/market"
122
}
123
},
124
"customer": {
125
"links": {
126
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/customer",
127
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/customer"
128
}
129
},
130
"shipping_address": {
131
"links": {
132
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/shipping_address",
133
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/shipping_address"
134
}
135
},
136
"billing_address": {
137
"links": {
138
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/billing_address",
139
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/billing_address"
140
}
141
},
142
"available_payment_methods": {
143
"links": {
144
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/available_payment_methods",
145
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/available_payment_methods"
146
}
147
},
148
"available_customer_payment_sources": {
149
"links": {
150
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/available_customer_payment_sources",
151
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/available_customer_payment_sources"
152
}
153
},
154
"payment_method": {
155
"links": {
156
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/payment_method",
157
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/payment_method"
158
}
159
},
160
"payment_source": {
161
"links": {
162
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/payment_source",
163
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/payment_source"
164
}
165
},
166
"line_items": {
167
"links": {
168
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/line_items",
169
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/line_items"
170
}
171
},
172
"shipments": {
173
"links": {
174
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/shipments",
175
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/shipments"
176
}
177
},
178
"transactions": {
179
"links": {
180
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/transactions",
181
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/transactions"
182
}
183
},
184
"authorizations": {
185
"links": {
186
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/authorizations",
187
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/authorizations"
188
}
189
},
190
"captures": {
191
"links": {
192
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/captures",
193
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/captures"
194
}
195
},
196
"voids": {
197
"links": {
198
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/voids",
199
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/voids"
200
}
201
},
202
"refunds": {
203
"links": {
204
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/refunds",
205
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/refunds"
206
}
207
},
208
"order_subscriptions": {
209
"links": {
210
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/order_subscriptions",
211
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/order_subscriptions"
212
}
213
},
214
"order_copies": {
215
"links": {
216
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/order_copies",
217
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/order_copies"
218
}
219
},
220
"attachments": {
221
"links": {
222
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/attachments",
223
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/attachments"
224
}
225
}
226
},
227
"meta": {
228
"mode": "test"
229
}
230
},
231
{
232
"other": "... 9 orders (first page)"
233
}
234
],
235
"meta": {
236
"record_count": 140,
237
"page_count": 14
238
},
239
"links": {
240
"first": "https://yourdomain.commercelayer.io/api/orders?page[number]=1&page[size]=10",
241
"next": "https://yourdomain.commercelayer.io/api/orders?page[number]=2&page[size]=10",
242
"last": "https://yourdomain.commercelayer.io/api/orders?page[number]=14&page[size]=10"
243
}
244
}
Copied!

Sortable attributes

The list of orders can be sorted by the following attributes:
  • number
  • status
  • payment_status
  • fulfillment_status
  • placed_at
  • approved_at
  • cancelled_at
  • payment_updated_at
  • fulfillment_updated_at
  • refreshed_at
  • archived_at
  • expires_at
  • id
  • created_at
  • updated_at
  • reference
  • reference_origin
Last modified 2mo ago