Date breakdown

A comprehensive list of the date breakdown query keys, allowed fields values, and operators for the cart resource

To perform a date breakdown query on the cart resource send a POST request to the /carts/date_breakdown endpoint specifying in the payload the query keys and filter parameters like in the generic example below:

{
  "date_breakdown": {
    "by": "...",
    "field": "...",
    "operator": "...",
    "interval": "...",
    "breakdown": {
      "by": "...",
      "field": "...",
      "operator": "...",
      "condition": { ... },
      "sort": "...",
      "limit": ...,
      "breakdown": {
        "by": "...",
        "field": "...",
        "operator": "...",
        "condition": { ... },
        "sort": "...",
        "limit": ...
      }
    }
  },
  "filter": { ... }
}

Please find more information on how date breakdown queries work here.

Query keys

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

Key
Type
Required
Description
Values

by

String

The date field you want the results of the query aggragated by.

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

field

String

The field you want the metrics or statistics computed on.

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

operator

String

The computing operator.

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

interval

String

The time interval over which the metrics / stats are computed. The results will be aggregated by date accordingly.

One of hour, day, week, month, or year (default is month).

breakdown

Object

The optional breakdown (eventually nested).

See the related section for any information about the breakdown query.

by values

These are the valid values you can specify for the by key of the date breakdown query:

Value
Description

order.created_at

The date and time at which the order was created (complete date plus hours, minutes and seconds — according to the ISO 8601 standard).

order.updated_at

The date and time at which the order was last updated (complete date plus hours, minutes and seconds — according to the ISO 8601 standard).

order.current_date

The date and time of the order's latest status change, regardless of the order's status (complete date plus hours, minutes and seconds — according to the ISO 8601 standard).

Operators and field values

These are the valid values you can specify for the field key of the date breakdown 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

Last updated