HTTP Request (API, Orders)

AI-generated summary

Issue: A Python script retrieving Shopify orders intermittently returns empty or “Not Found” for certain months while the same request succeeds for others.

Details: The URL used is /admin/api/2021-07/orders.json with status=any; changing “07” to other numbers was assumed to target different months. Some 2021 months (Jan, Apr, Jul) return orders; others (e.g., Aug) do not.

Key clarification: “2021-07” in the path is the API version, not a month filter. To fetch orders by date, use created_at_min/max or updated_at_min/max query parameters (e.g., updated_at_max=2021-07-31T00:00:00-04:00). Different version paths (2021-01 vs 2021-07) will return the same data when using identical date filters.

Additional consideration: Accessing orders older than 60 days may require the read_all_orders scope in the app settings.

Outcome: The original poster still receives “Not Found” for most months after trying created_at_max. No confirmed resolution yet; troubleshooting remains open.

Action items:

  • Verify app scopes (read_all_orders for >60-day orders).
  • Use proper date range filters (created_at_min/max or updated_at_min/max).
  • Review Shopify API versioning and changelog for potential changes.

Note: An image illustrating quarterly API version releases is referenced but not central to the fix.

Dear Shopify Developers & Experts,

As we were writing a Python script to retrieve Orders from our online store, we faced a confusing issue.

The HTTP request works for some months only and returns an empty response for other months (using the same request). Please find below the HTTP request URL:

url = f’https://{api_key}:{password}@myOnlineStore.com/admin/api/2021-07/orders.json&status=any’

If we change 07 to 05 for example it doesn’t return any orders, and this happens for several other months, even though there are orders during these months.

Kindly let me know if you need further information or if I’m doing something wrong.

Thank you in advance.

Youssef

Are you trying to access orders made more than 60 days ago? I believe you need to request read_all_orders through your app settings to see orders over 60 days old. https://shopify.dev/api/usage/access-scopes

I don’t think this is the issue since we were able to get orders from July 2021 but not August 2021 AND we also got orders from some of 2020’s months.

Hi @Moussa1997

If you try doing something like

/admin/api/2021-01/orders.json?created_at_max=2021-06-31T15:57:11-04:00

Are you able to see older orders?

You can see more examples of different order request on our Docs page here: https://shopify.dev/api/admin/rest/reference/orders/order

Hi @csam ,

thank you for your reply. Yes, I did and unfortunately, I’m still getting the same error:

{'errors': 'Not Found'}

In 2021, only Jan, April & July return the orders. However, all the other months return the same response mentioned above.

I really don’t know the reason behind this inconsistency, I also tried using status=any, created_at_max as you suggested but it’s still not working.

Hi @Moussa1997

The 2021-07 or 2021-01 part of the URL is referencing the version of the API being requested, not the date range of the orders themselves. You’ll want to use the created_at_min/max or updated_at_min/max as parameters for requesting specific order dates.

So, for example:

/admin/api/2021-01/orders.json?updated_at_max=2021-07-31T00:00:00-04:00

and

/admin/api/2021-07/orders.json?updated_at_max=2021-07-31T00:00:00-04:00

Are requesting the same information, but they are requesting different versions of the API.

Our API releases a new version each quarter:

You can read more about our versioning system here: https://shopify.dev/api/usage/versioning

I would also recommend following our API Changelog here: https://changelog.shopify.com/ This will let you know of any large changes to the API that might affect your app in future.