How would I get a customer's total purchase history for the past year?

Hi, I am wondering if there is a way to get each customer’s purchase amount over the past year.

Would I need to create a database and store the customer’s purchases? Is there a way to retrieve it with a simple GET request? Thanks

:wave: With the Orders API you can SearchOrders with a query for specific customers get their order history. It would look something like this:

    "location_ids": [
    "query": {
      "filter": {
        "customer_filter": {
          "customer_ids": [
        "date_time_filter": {
          "created_at": {
            "end_at": "2022-06-16T19:29:49.582Z",
            "start_at": "2021-06-16T19:29:49.582Z"
      "sort": {
        "sort_order": "DESC"


1 Like

@Bryan-Square What would the query look like if you wanted to get all of your customers orders?

If you want to get all orders for a customer you’ll need to call SearchOrders and parse the results for all the known customer_ids for a given customer. I say that cause there may be more than one customer_id for a customer due to merges. Is your application tracking merges? :slightly_smiling_face:

1 Like