Created_at_min with event endpoint does not work

Topic summary

A developer encountered issues using the created_at_min parameter with Shopify’s REST Admin API event endpoint. The server either ignored the parameter or returned a 500 error.

Attempted Solutions:

  • Tried multiple date format variations (ISO 8601, URL-encoded, simple date format)
  • Tested different encoding methods including base64 encoding of the parameter

Root Cause:
The 500 error was caused by the server attempting to return too much data when using only created_at_min without an upper bound.

Resolution:
Adding the created_at_max parameter alongside created_at_min successfully resolved the issue by limiting the date range and reducing the data volume returned by the API.

Summarized with AI on November 23. AI used: claude-sonnet-4-5-20250929.

I am attempting to get a list of orders from the event endpoint.

The server either ignores the created_at_min parameter, or returns a 500 error.

Here is what I have tried so far:

  options = {
    'headers': {
      'Authorization': 'Basic ' + Utilities.base64Encode(`${key}:${pass}`),
      'Content-type': 'application/json'
    },
    method: 'GET'
  }
// attempt 1
UrlFetchApp.fetch("https://<storeUrl>.myshopify.com/admin/api/2023-01/events.json?created_at_min=2022-04-25T16:15:47-04:00", options));
// attempt 2
UrlFetchApp.fetch("https://<storeUrl>.myshopify.com/admin/api/2023-01/events.json?created_at_min=2022-04-25T16:15:47%2B04:00", options));
// attempt 3
UrlFetchApp.fetch("https://<storeUrl>.myshopify.com/admin/api/2023-01/events.json?created_at_min=2022-04-25", options));
// attempt 4
UrlFetchApp.fetch("https://<storeUrl>.myshopify.com/admin/api/2023-01/events.json?created_at_min="+Utilities.base64encode("2022-04-25T16:15:47-04:00"), options));
// attempt 5
UrlFetchApp.fetch("https://<storeUrl>.myshopify.com/admin/api/2023-01/events.json?created_at_min="+Utilities.base64encode("2022-04-25"), options));

What am I doing wrong?

Ok, I solved this issue.

The problem was the amount of data the server was attempting to return was too large, so it was returning a 500 error.

Modifying the fetch URL to include created_at_max solved the issue!

UrlFetchApp.fetch("[https://lily-and-fox-usa.myshopify.com/admin/api/2023-01/events.json?created_at_min=2022-04-25T16:15:47%2B04:00&created_at_max=2022-04-26T16:15:47%2B04:00](https://lily-and-fox-usa.myshopify.com/admin/api/2023-01/events.json?created_at_min=2022-04-25T16:15:47%2B04:00&created_at_max=2022-04-26T16:15:47%2B04:00)", options)

1 Like