Sales Intelligence Queries

Access sales analytics and performance insights.

SalesIntelligences — Returns a paginated list of sales intelligence data for line items

query GetSalesIntelligences(
  $where: QuerySalesIntelligencesWhereWhereConditions,
  $orderBy: [QuerySalesIntelligencesOrderByOrderByClause!]
) {
  SalesIntelligences(
    where: $where
    orderBy: $orderBy
  ) {
    paginatorInfo {
      total
      lastPage
    }
    data {
      line_item_id
      variant_sku
      variant_label
      product_label
      customer_label
      customer_tax_number
      document_label
      location_label
      brand_label
      season_label
      quantity
      total_without_taxes
      total_with_taxes
      tax_amount
      on_hand
      margin
      profit
      year
      month_year
    }
  }
}

Example Variables:

{
  "where": {
    "AND": [
      { "column": "YEAR_CUSTOM", "operator": "EQ", "value": "2024" },
      { "column": "MONTH_YEAR_CUSTOM", "operator": "EQ", "value": "2024-01" }
    ]
  },
  "orderBy": [{ "column": "TOTAL_WITHOUT_TAXES", "order": "DESC" }]
}

Available fields

FieldTypeDescription
line_item_idIntLine item identifier.
variant_skuStringVariant SKU code.
variant_labelStringVariant label/name.
variant_barcodeStringVariant barcode.
product_labelStringProduct label/name.
customer_labelStringCustomer name.
customer_tax_numberStringCustomer tax number.
document_labelStringDocument reference number.
location_labelStringLocation name.
brand_labelStringBrand name.
season_labelStringSeason name.
account_representative_labelStringAccount representative name.
external_referenceStringExternal reference number.
payment_information_labelStringPayment method label.
yearStringYear of the document date.
month_yearStringYear-month of the document date (YYYY-MM).
day_month_yearStringFull date (YYYY-MM-DD).
shipping_typeStringShipping type.
quantityFloatQuantity sold.
total_without_taxesFloatTotal before taxes.
total_with_taxesFloatTotal including taxes.
tax_amountFloatTax amount.
on_handFloatCurrent stock on hand.
ecotaxFloatEcotax amount.
discountFloatDiscount amount.
average_discountFloatAverage discount rate.
cogsFloatCost of goods sold.
marginFloatProfit margin percentage.
profitFloatProfit amount.
product_tags_labelStringProduct tags (comma-separated).
customer_tags_labelStringCustomer tags (comma-separated).
suppliers_labelStringSupplier names (comma-separated).
sales_order_labelStringRelated sales order reference.
bill_to_countryStringBilling country.
bill_to_cityStringBilling city.
bill_to_stateStringBilling state/province.
bill_to_postal_codeStringBilling postal code.
ship_to_countryStringShipping country.
ship_to_cityStringShipping city.
ship_to_stateStringShipping state/province.
ship_to_postal_codeStringShipping postal code.

Data Types

SalesIntelligence

FieldTypeDescription
line_item_idIntLine item identifier.
variant_skuStringVariant SKU code.
variant_labelStringVariant label/name.
variant_barcodeStringVariant barcode.
product_labelStringProduct label/name.
customer_labelStringCustomer name.
customer_tax_numberStringCustomer tax number.
document_labelStringDocument reference number.
location_labelStringLocation name.
brand_labelStringBrand name.
season_labelStringSeason name.
account_representative_labelStringAccount representative name.
external_referenceStringExternal reference number.
payment_information_labelStringPayment method label.
yearStringYear of the document date.
month_yearStringYear-month of the document date (YYYY-MM).
day_month_yearStringFull date (YYYY-MM-DD).
shipping_typeStringShipping type.
quantityFloatQuantity sold.
total_without_taxesFloatTotal before taxes.
total_with_taxesFloatTotal including taxes.
tax_amountFloatTax amount.
on_handFloatCurrent stock on hand.
ecotaxFloatEcotax amount.
discountFloatDiscount amount.
average_discountFloatAverage discount rate.
cogsFloatCost of goods sold.
marginFloatProfit margin percentage.
profitFloatProfit amount.
product_tags_labelStringProduct tags (comma-separated).
customer_tags_labelStringCustomer tags (comma-separated).
suppliers_labelStringSupplier names (comma-separated).
sales_order_labelStringRelated sales order reference.
bill_to_countryStringBilling country.
bill_to_cityStringBilling city.
bill_to_stateStringBilling state/province.
bill_to_postal_codeStringBilling postal code.
ship_to_countryStringShipping country.
ship_to_cityStringShipping city.
ship_to_stateStringShipping state/province.
ship_to_postal_codeStringShipping postal code.

Filters

The following fields can be used in the where parameter:

document_id_custom, document_label_custom, document_type_custom, document_status_custom, variant_label_custom, variant_id_custom, variant_barcode_custom, variant_sku_custom, product_label_custom, product_id_custom, customer_label_custom, customer_tax_number_custom, customer_id_custom, location_label_custom, location_id_custom, brand_label_custom, brand_id_custom, season_label_custom, season_id_custom, account_representative_label_custom, account_representative_id_custom, external_reference_custom, payment_information_id_custom, year_custom, month_year_custom, day_month_year_custom, shipping_type_custom, quantity, total_without_taxes, total_with_taxes, tax_amount, on_hand, ecotax, discount, average_discount, cogs, margin, profit, bill_to_country_custom, bill_to_city_custom, bill_to_state_custom, bill_to_postal_code_custom, ship_to_country_custom, ship_to_city_custom, ship_to_state_custom, ship_to_postal_code_custom


Sorting

You can sort data based on following fields: line_item_id_custom, document_id_custom, document_label_custom, variant_id_custom, variant_label_custom, variant_sku_custom, variant_barcode_custom, product_label_custom, customer_label_custom, customer_tax_number_custom, location_label_custom, brand_label_custom, season_label_custom, account_representative_label_custom, external_reference_custom, year_custom, month_year_custom, day_month_year_custom, shipping_type_custom, quantity, total_without_taxes, total_with_taxes, tax_amount, on_hand, ecotax, discount, average_discount, cogs, margin, profit, bill_to_country_custom, bill_to_city_custom, bill_to_state_custom, bill_to_postal_code_custom, ship_to_country_custom, ship_to_city_custom, ship_to_state_custom, ship_to_postal_code_custom