Stats

A comprehensive list of the stats query keys, allowed fields values, and operators for the order resource

To perform a stats query on the order resource send a POST request to the /orders/stats endpoint specifying in the payload the query keys and filter parameters like in the generic example below:

{
  "stats": {
    "field": "...",
    "operator": "..."
  },
  "filter": { ... }
}

Please find more information on how stats queries work here.

Query keys

These are the keys you need to set when performing a stats query:

Key
Type
Required
Description
Values

field

String

The field you want the metrics or statistics computed on.

See the table below to check the full list of valid values for this key.

operator

String

The computing operator.

See the table below to check the full list of valid operators based on the value you assigned to the field key.

Operators and field values

These are the valid values you can specify for the field key of the stats query and the related valid operators, based on that key:

Value
Operators

customer.id

cardinality

value_count

customer.email

cardinality

value_count

customer.group_name

cardinality

value_count

line_items.code

cardinality

value_count

line_items.discount

avg

max

min

sum

stats

line_items.id

cardinality

value_count

line_items.item_id

cardinality

value_count

line_items.options_amount

avg

max

min

sum

stats

line_items.quantity

avg

max

min

sum

stats

line_items.tax_amount

avg

max

min

sum

stats

line_items.tax_rate

avg

max

min

sum

stats

line_items.total_amount

avg

max

min

sum

stats

line_items.unit_amount

avg

max

min

sum

stats

line_items.options.id

cardinality

value_count

line_items.options.quantity

avg

max

min

sum

stats

line_items.options.total_amount

avg

max

min

sum

stats

line_items.options.unit_amount

avg

max

min

sum

stats

market.id

cardinality

market.number

cardinality

value_count

order.adjustment_amount

avg

max

min

sum

stats

order.adjustment_tax_amount

avg

max

min

sum

stats

order.adjustment_taxable_amount

avg

max

min

sum

stats

order.discount_amount

avg

max

min

sum

stats

order.duty_amount

avg

max

min

sum

stats

order.gift_card_code

value_count

order.gift_card_amount

avg

max

min

sum

stats

order.id

cardinality

value_count

order.line_item_options_count

avg

max

min

sum

stats

order.number

value_count

order.payment_method_amount

avg

max

min

sum

stats

order.payment_method_tax_amount

avg

max

min

sum

stats

order.payment_method_taxable_amount

avg

max

min

sum

stats

order.reference

cardinality

value_count

order.reference_origin

cardinality

value_count

order.shipments_count

avg

max

min

sum

stats

order.shipping_amount

avg

max

min

sum

stats

order.shipping_taxable_amount

avg

max

min

sum

stats

order.skus_count

avg

max

min

sum

stats

order.subtotal_amount

avg

max

min

sum

stats

order.subtotal_tax_amount

avg

max

min

sum

stats

order.subtotal_taxable_amount

avg

max

min

sum

stats

order.total_amount

avg

max

min

sum

stats

order.total_amount_with_taxes

avg

max

min

sum

stats

order.total_tax_amount

avg

max

min

sum

stats

order.total_taxable_amount

avg

max

min

sum

stats

order.seconds_in_draft

avg

max

min

stats

percentiles

order.seconds_in_approved

avg

max

min

stats

percentiles

order.seconds_in_placed

avg

max

min

stats

percentiles

order.refunds_total_amount_with_taxes

avg

max

min

sum

stats

order.total_amount_with_taxes_net_of_refunds

avg

max

min

sum

stats

refunds.id

value_count

refunds.amount

avg

max

min

sum

stats

refunds.number

value_count

shipments.reference

cardinality

value_count

shipments.reference_origin

cardinality

value_count

shipments.seconds_in_picking

avg

max

min

stats

percentiles

shipments.seconds_in_ready_to_ship

avg

max

min

stats

percentiles

shipments.stock_location.reference

cardinality

value_count

shipments.stock_location_reference_origin

cardinality

value_count

shipments.shipping_method.reference

cardinality

value_count

shipments.shipping_method.reference_origin

cardinality

value_count

shipments.shipping_category.reference

cardinality

value_count

shipments.shipping_category.reference_origin

cardinality

value_count

Last updated