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
The following request fetches a collection of orders:
curl -g -X GET \
'https://yourdomain.commercelayer.io/api/orders/' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer your-access-token'
On success, the API responds with a 200 OK
status code, returning a paginated collection of resource objects:
{
"data": [
{
"id": "xYZkjABcde",
"type": "orders",
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde"
},
"attributes": {
"number": "1234",
"autorefresh": true,
"place_async": true,
"status": "draft",
"payment_status": "unpaid",
"fulfillment_status": "unfulfilled",
"guest": true,
"editable": true,
"customer_email": "john@example.com",
"language_code": "it",
"currency_code": "EUR",
"tax_included": true,
"tax_rate": 0.22,
"freight_taxable": true,
"payment_method_taxable": true,
"adjustment_taxable": true,
"gift_card_taxable": false,
"requires_billing_info": false,
"country_code": "IT",
"shipping_country_code_lock": "IT",
"coupon_code": "SUMMERDISCOUNT",
"gift_card_code": "cc92c23e-967e-48b2-a323-59add603301f",
"subtotal_amount_cents": 5000,
"subtotal_amount_float": 50.0,
"formatted_subtotal_amount": "€50,00",
"shipping_amount_cents": 1200,
"shipping_amount_float": 12.0,
"formatted_shipping_amount": "€12,00",
"payment_method_amount_cents": 0,
"payment_method_amount_float": 0.0,
"formatted_payment_method_amount": "€0,00",
"discount_amount_cents": -500,
"discount_amount_float": -5.0,
"formatted_discount_amount": "-€5,00",
"adjustment_amount_cents": 1500,
"adjustment_amount_float": 15.0,
"formatted_adjustment_amount": "€15,00",
"gift_card_amount_cents": 1500,
"gift_card_amount_float": 15.0,
"formatted_gift_card_amount": "€15,00",
"total_tax_amount_cents": 1028,
"total_tax_amount_float": 10.28,
"formatted_total_tax_amount": "€10,28",
"subtotal_tax_amount_cents": 902,
"subtotal_tax_amount_float": 9.02,
"formatted_subtotal_tax_amount": "€9,02",
"shipping_tax_amount_cents": 216,
"shipping_tax_amount_float": 2.16,
"formatted_shipping_tax_amount": "€2,16",
"payment_method_tax_amount_cents": 0,
"payment_method_tax_amount_float": 0.0,
"formatted_payment_method_tax_amount": "€0,00",
"adjustment_tax_amount_cents": 900,
"adjustment_tax_amount_float": 9.0,
"formatted_adjustment_tax_amount": "€9,00",
"total_amount_cents": 5700,
"total_amount_float": 57.0,
"formatted_total_amount": "€57,00",
"total_taxable_amount_cents": 4672,
"total_taxable_amount_float": 46.72,
"formatted_total_taxable_amount": "€46,72",
"subtotal_taxable_amount_cents": 4098,
"subtotal_taxable_amount_float": 40.98,
"formatted_subtotal_taxable_amount": "€40,98",
"shipping_taxable_amount_cents": 984,
"shipping_taxable_amount_float": 9.84,
"formatted_shipping_taxable_amount": "€9,84",
"payment_method_taxable_amount_cents": 0,
"payment_method_taxable_amount_float": 0.0,
"formatted_payment_method_taxable_amount": "€0,00",
"adjustment_taxable_amount_cents": 120,
"adjustment_taxable_amount_float": 1.2,
"formatted_adjustment_taxable_amount": "€1,20",
"total_amount_with_taxes_cents": 5700,
"total_amount_with_taxes_float": 57.0,
"formatted_total_amount_with_taxes": "€57,00",
"fees_amount_cents": 0,
"fees_amount_float": 0.0,
"formatted_fees_amount": "€0,00",
"duty_amount_cents": 0,
"duty_amount_float": 0.0,
"formatted_duty_amount": "€0,00",
"place_total_amount_cents": 0,
"place_total_amount_float": 0.0,
"formatted_place_total_amount": "€0,00",
"skus_count": 2,
"line_item_options_count": 1,
"shipments_count": 1,
"tax_calculations_count": 1,
"validations_count": 1,
"payment_source_details": {
"foo": "bar"
},
"token": "1c0994cc4e996e8c6ee56a2198f66f3c",
"cart_url": "https://yourdomain.com/cart",
"return_url": "https://yourdomain.com/",
"terms_url": "https://yourdomain.com/terms",
"privacy_url": "https://yourdomain.com/privacy",
"checkout_url": "https://yourdomain.commercelayer.io/checkout/1c0994cc4e996e8c6ee56a2198f66f3c",
"placed_at": "2018-01-01T12:00:00.000Z",
"approved_at": "2018-01-01T12:00:00.000Z",
"cancelled_at": "2018-01-01T12:00:00.000Z",
"payment_updated_at": "2018-01-01T12:00:00.000Z",
"fulfillment_updated_at": "2018-01-01T12:00:00.000Z",
"refreshed_at": "2018-01-01T12:00:00.000Z",
"archived_at": "2018-01-01T12:00:00.000Z",
"subscription_created_at": "2018-01-01T12:00:00.000Z",
"created_at": "2018-01-01T12:00:00.000Z",
"updated_at": "2018-01-01T12:00:00.000Z",
"reference": "ANY-EXTERNAL-REFEFERNCE",
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
"metadata": {
"foo": "bar"
}
},
"relationships": {
"market": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/market",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/market"
}
},
"customer": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/customer",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/customer"
}
},
"shipping_address": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/shipping_address",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/shipping_address"
}
},
"billing_address": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/billing_address",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/billing_address"
}
},
"available_payment_methods": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/available_payment_methods",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/available_payment_methods"
}
},
"available_customer_payment_sources": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/available_customer_payment_sources",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/available_customer_payment_sources"
}
},
"available_free_skus": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/available_free_skus",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/available_free_skus"
}
},
"available_free_bundles": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/available_free_bundles",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/available_free_bundles"
}
},
"payment_method": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/payment_method",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/payment_method"
}
},
"payment_source": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/payment_source",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/payment_source"
}
},
"line_items": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/line_items",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/line_items"
}
},
"line_item_options": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/line_item_options",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/line_item_options"
}
},
"stock_reservations": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/stock_reservations",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/stock_reservations"
}
},
"stock_line_items": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/stock_line_items",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/stock_line_items"
}
},
"stock_transfers": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/stock_transfers",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/stock_transfers"
}
},
"shipments": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/shipments",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/shipments"
}
},
"payment_options": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/payment_options",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/payment_options"
}
},
"transactions": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/transactions",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/transactions"
}
},
"authorizations": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/authorizations",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/authorizations"
}
},
"captures": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/captures",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/captures"
}
},
"voids": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/voids",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/voids"
}
},
"refunds": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/refunds",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/refunds"
}
},
"returns": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/returns",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/returns"
}
},
"order_subscription": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/order_subscription",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/order_subscription"
}
},
"order_subscriptions": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/order_subscriptions",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/order_subscriptions"
}
},
"order_factories": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/order_factories",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/order_factories"
}
},
"order_copies": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/order_copies",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/order_copies"
}
},
"recurring_order_copies": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/recurring_order_copies",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/recurring_order_copies"
}
},
"attachments": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/attachments",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/attachments"
}
},
"links": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/links",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/links"
}
},
"resource_errors": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/resource_errors",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/resource_errors"
}
},
"events": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/events",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/events"
}
},
"tags": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/tags",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/tags"
}
},
"versions": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/versions",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/versions"
}
}
},
"meta": {
"mode": "test"
}
},
{
"other": "... 9 orders (first page)"
}
],
"meta": {
"record_count": 140,
"page_count": 14
},
"links": {
"first": "https://yourdomain.commercelayer.io/api/orders?page[number]=1&page[size]=10",
"next": "https://yourdomain.commercelayer.io/api/orders?page[number]=2&page[size]=10",
"last": "https://yourdomain.commercelayer.io/api/orders?page[number]=14&page[size]=10"
}
}
Remember that when you fetch a list of resources you get paginated result.
Sortable fields
The list of orders can be sorted by the following fields:
Attributes
number
place_async
status
payment_status
fulfillment_status
guest
language_code
currency_code
tax_included
tax_rate
country_code
coupon_code
gift_card_code
subtotal_amount_cents
shipping_amount_cents
payment_method_amount_cents
discount_amount_cents
adjustment_amount_cents
gift_card_amount_cents
total_tax_amount_cents
subtotal_tax_amount_cents
total_amount_cents
fees_amount_cents
duty_amount_cents
placed_at
approved_at
cancelled_at
payment_updated_at
fulfillment_updated_at
refreshed_at
archived_at
subscription_created_at
id
circuit_state
circuit_failure_count
created_at
updated_at
reference
reference_origin
Relationships
market
customer
Filterable fields
The list of orders can be filtered by the following fields:
Attributes
number
place_async
status
payment_status
fulfillment_status
guest
customer_email
language_code
currency_code
tax_included
tax_rate
country_code
coupon_code
gift_card_code
subtotal_amount_cents
shipping_amount_cents
payment_method_amount_cents
discount_amount_cents
adjustment_amount_cents
gift_card_amount_cents
total_tax_amount_cents
subtotal_tax_amount_cents
total_amount_cents
fees_amount_cents
duty_amount_cents
token
placed_at
approved_at
cancelled_at
payment_updated_at
fulfillment_updated_at
refreshed_at
archived_at
subscription_created_at
id
circuit_state
circuit_failure_count
created_at
updated_at
reference
reference_origin
metadata
Relationships
market
customer
shipping_address
billing_address
payment_method
payment_source
line_items
line_item_options
stock_reservations
stock_line_items
stock_transfers
shipments
payment_options
transactions
authorizations
captures
voids
refunds
returns
order_subscription
order_subscriptions
order_copies
recurring_order_copies
attachments
links
resource_errors
events
tags
Last updated