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": {
"adjustment_amount_cents": 1500,
"adjustment_amount_float": 15.0,
"adjustment_tax_amount_cents": 900,
"adjustment_tax_amount_float": 9.0,
"adjustment_taxable": true,
"adjustment_taxable_amount_cents": 120,
"adjustment_taxable_amount_float": 1.2,
"approved_at": "2018-01-01T12:00:00.000Z",
"archived_at": "2018-01-01T12:00:00.000Z",
"autorefresh": true,
"cancelled_at": "2018-01-01T12:00:00.000Z",
"cart_url": "https://yourdomain.com/cart",
"checkout_url": "https://yourdomain.commercelayer.io/checkout/1c0994cc4e996e8c6ee56a2198f66f3c",
"country_code": "IT",
"coupon_code": "SUMMERDISCOUNT",
"created_at": "2018-01-01T12:00:00.000Z",
"currency_code": "EUR",
"customer_email": "john@example.com",
"discount_amount_cents": -500,
"discount_amount_float": -5.0,
"duty_amount_cents": 0,
"duty_amount_float": 0.0,
"editable": true,
"fees_amount_cents": 0,
"fees_amount_float": 0.0,
"formatted_adjustment_amount": "€15,00",
"formatted_adjustment_tax_amount": "€9,00",
"formatted_adjustment_taxable_amount": "€1,20",
"formatted_discount_amount": "-€5,00",
"formatted_duty_amount": "€0,00",
"formatted_fees_amount": "€0,00",
"formatted_gift_card_amount": "€15,00",
"formatted_payment_method_amount": "€0,00",
"formatted_payment_method_tax_amount": "€0,00",
"formatted_payment_method_taxable_amount": "€0,00",
"formatted_place_total_amount": "€0,00",
"formatted_shipping_amount": "€12,00",
"formatted_shipping_tax_amount": "€2,16",
"formatted_shipping_taxable_amount": "€9,84",
"formatted_subtotal_amount": "€50,00",
"formatted_subtotal_tax_amount": "€9,02",
"formatted_subtotal_taxable_amount": "€40,98",
"formatted_total_amount": "€57,00",
"formatted_total_amount_with_taxes": "€57,00",
"formatted_total_tax_amount": "€10,28",
"formatted_total_taxable_amount": "€46,72",
"freight_taxable": true,
"fulfillment_status": "unfulfilled",
"fulfillment_updated_at": "2018-01-01T12:00:00.000Z",
"gift_card_amount_cents": 1500,
"gift_card_amount_float": 15.0,
"gift_card_code": "cc92c23e-967e-48b2-a323-59add603301f",
"gift_card_taxable": false,
"guest": true,
"language_code": "it",
"line_item_options_count": 1,
"metadata": {
"foo": "bar"
},
"number": "1234",
"payment_method_amount_cents": 0,
"payment_method_amount_float": 0.0,
"payment_method_tax_amount_cents": 0,
"payment_method_tax_amount_float": 0.0,
"payment_method_taxable": true,
"payment_method_taxable_amount_cents": 0,
"payment_method_taxable_amount_float": 0.0,
"payment_source_details": {
"foo": "bar"
},
"payment_status": "unpaid",
"payment_updated_at": "2018-01-01T12:00:00.000Z",
"place_async": true,
"place_total_amount_cents": 0,
"place_total_amount_float": 0.0,
"placed_at": "2018-01-01T12:00:00.000Z",
"privacy_url": "https://yourdomain.com/privacy",
"reference": "ANY-EXTERNAL-REFEFERNCE",
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
"refreshed_at": "2018-01-01T12:00:00.000Z",
"requires_billing_info": false,
"return_url": "https://yourdomain.com/",
"shipments_count": 1,
"shipping_amount_cents": 1200,
"shipping_amount_float": 12.0,
"shipping_country_code_lock": "IT",
"shipping_tax_amount_cents": 216,
"shipping_tax_amount_float": 2.16,
"shipping_taxable_amount_cents": 984,
"shipping_taxable_amount_float": 9.84,
"skus_count": 2,
"status": "draft",
"subscription_created_at": "2018-01-01T12:00:00.000Z",
"subtotal_amount_cents": 5000,
"subtotal_amount_float": 50.0,
"subtotal_tax_amount_cents": 902,
"subtotal_tax_amount_float": 9.02,
"subtotal_taxable_amount_cents": 4098,
"subtotal_taxable_amount_float": 40.98,
"tax_calculations_count": 1,
"tax_included": true,
"tax_rate": 0.22,
"terms_url": "https://yourdomain.com/terms",
"token": "1c0994cc4e996e8c6ee56a2198f66f3c",
"total_amount_cents": 5700,
"total_amount_float": 57.0,
"total_amount_with_taxes_cents": 5700,
"total_amount_with_taxes_float": 57.0,
"total_tax_amount_cents": 1028,
"total_tax_amount_float": 10.28,
"total_taxable_amount_cents": 4672,
"total_taxable_amount_float": 46.72,
"updated_at": "2018-01-01T12:00:00.000Z",
"validations_count": 1
},
"relationships": {
"attachments": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/attachments",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/attachments"
}
},
"authorizations": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/authorizations",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/authorizations"
}
},
"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_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"
}
},
"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_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"
}
},
"billing_address": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/billing_address",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/billing_address"
}
},
"captures": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/captures",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/captures"
}
},
"customer": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/customer",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/customer"
}
},
"events": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/events",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/events"
}
},
"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"
}
},
"line_items": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/line_items",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/line_items"
}
},
"links": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/links",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/links"
}
},
"market": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/market",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/market"
}
},
"order_copies": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/order_copies",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/order_copies"
}
},
"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_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"
}
},
"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_options": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/payment_options",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/payment_options"
}
},
"payment_source": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/payment_source",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/payment_source"
}
},
"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"
}
},
"refunds": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/refunds",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/refunds"
}
},
"resource_errors": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/resource_errors",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/resource_errors"
}
},
"returns": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/returns",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/returns"
}
},
"shipments": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/shipments",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/shipments"
}
},
"shipping_address": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/shipping_address",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/shipping_address"
}
},
"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_reservations": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/stock_reservations",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/stock_reservations"
}
},
"stock_transfers": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/stock_transfers",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/stock_transfers"
}
},
"tags": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/tags",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/tags"
}
},
"transactions": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/transactions",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/transactions"
}
},
"versions": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/versions",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/versions"
}
},
"voids": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/voids",
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/voids"
}
}
},
"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
adjustment_amount_cents
approved_at
archived_at
cancelled_at
circuit_failure_count
circuit_state
country_code
coupon_code
created_at
currency_code
discount_amount_cents
duty_amount_cents
fees_amount_cents
fulfillment_status
fulfillment_updated_at
gift_card_amount_cents
gift_card_code
guest
id
language_code
number
payment_method_amount_cents
payment_status
payment_updated_at
place_async
placed_at
reference
reference_origin
refreshed_at
shipping_amount_cents
status
subscription_created_at
subtotal_amount_cents
subtotal_tax_amount_cents
tax_included
tax_rate
total_amount_cents
total_tax_amount_cents
updated_at
Relationships
customer
market
Filterable fields
The list of orders can be filtered by the following fields:
Attributes
adjustment_amount_cents
approved_at
archived_at
cancelled_at
circuit_failure_count
circuit_state
country_code
coupon_code
created_at
currency_code
customer_email
discount_amount_cents
duty_amount_cents
fees_amount_cents
fulfillment_status
fulfillment_updated_at
gift_card_amount_cents
gift_card_code
guest
id
language_code
metadata
number
payment_method_amount_cents
payment_status
payment_updated_at
place_async
placed_at
reference
reference_origin
refreshed_at
shipping_amount_cents
status
subscription_created_at
subtotal_amount_cents
subtotal_tax_amount_cents
tax_included
tax_rate
token
total_amount_cents
total_tax_amount_cents
updated_at
Relationships
attachments
authorizations
billing_address
captures
customer
events
line_item_options
line_items
links
market
order_copies
order_subscription
order_subscriptions
payment_method
payment_options
payment_source
recurring_order_copies
refunds
resource_errors
returns
shipments
shipping_address
stock_line_items
stock_reservations
stock_transfers
tags
transactions
voids
Last updated