REST API Returns 404 on Order that is available in the admin UI

I’m working with the Shopify ruby gem on api version “2022-10”. I have records of Shopify order IDs in our database and when I do a get ShopifyAPI::Order.find(<order_id>) there are plenty that I am able to retrieve, and plenty that return a 404. I cannot seem to figure out a common pattern in the records that return a 404. They are visible in the Admin UI when I search for the id. I’ve got orders that I can fetch that are old and orders that are new that return 404, archived that I can fetch and archived that return 404, fulfilled that I can fetch and fulfilled that return 404. It’s baffling me. Does anybody have any clues on this?

Hello @rustychicken ,

Thank you for reaching out to the Shopify community.

It appears that you are facing an issue with the orders API. To resolve this matter, kindly ensure that you have the appropriate access to utilize this resource. The following scopes are required to access the order:

  • read_orders/write_orders (This allows you to access past 60 days orders)
  • read_all_orders (This allows you to access all the orders)

Once you have confirmed that you have these access scopes, we kindly request you to navigate to the API Access section on the manage app page. To do so, please follow these steps:

  1. Go to “All Apps” in your Shopify dashboard.
  2. Locate your app and click on it.
  3. Click on “API Access.”
  4. Request access to the “Read all orders scope” as shown in the attached screenshot for your reference.

If you encounter any difficulties or require further assistance, please do not hesitate to let me know.

Thanks.

Hello @rustychicken ,

Greetings! I am Gina from the flareAI app helping Shopify merchants get $7Million+ in sales from Google Search, on autopilot.

A 404 error typically occurs when a requested resource cannot be found.

Double-check that you are using the correct authentication credentials and have the necessary scopes to access order data. In some cases, certain orders might require specific permissions that you might not have granted to your API token.

Ensure that you are not hitting the rate limits of the Shopify API. Exceeding the rate limits can result in some requests being rejected with a 404 response.

It’s possible that some orders that return a 404 have been deleted or canceled, but they are still visible in the Admin UI for a short period due to caching. Try cross-referencing with the actual order status in the Shopify Admin to see if this is the case.

Check if there is any correlation between the order status and the ones that return a 404. It’s possible that certain order statuses are not accessible via the API or require specific permissions.

Hope this helps

Gina