order_history

Fetch order history records matching the supplied arguments.

Arguments

ArgumentTypeRequiredDefaultDescription
order_idStringNo

Filter by order ID; pass the public API ID unless the field name says legacy ID.

user_idStringNo

Filter by user ID; pass the public API ID unless the field name says legacy ID.

order_numberStringNo

Filter by order number.

usernameStringNo

Filter by username.

date_fromDateNo

Inclusive start of the date range, in YYYY-MM-DD date format.

date_toDateNo

Inclusive end of the date range, in YYYY-MM-DD date format.

analyzeBooleanNo

If true, the query will only be analyzed (cost estimated) without executing it.

Return Type

OrderHistoryQueryResult

Query

query order_history(
  $order_id: String,
  $user_id: String,
  $order_number: String,
  $username: String,
  $date_from: Date,
  $date_to: Date,
  $analyze: Boolean
) {
  order_history(
    order_id: $order_id,
    user_id: $user_id,
    order_number: $order_number,
    username: $username,
    date_from: $date_from,
    date_to: $date_to,
    analyze: $analyze
  ) {
    request_id
    complexity
    data {
      ...OrderHistoryConnectionFragment
    }
  }
}

Variables

{
  "order_id": "T3JkZXI6MTIzNA==",
  "user_id": "VXNlcjoxMjM0",
  "order_number": "SO-100045",
  "username": "SO-100045",
  "date_from": "2026-07-15",
  "date_to": "2026-07-15",
  "analyze": true
}

Response

{
  "data": {
    "order_history": {
      "request_id": "UmVjb3JkOjEyMzQ=",
      "complexity": 100,
      "data": [{id: "T3JkZXI6MTIzNA==", order_number: "SO-100045"}]
    }
  }
}