Rest Admin API request to get product_id from the handle of product

Topic summary

Issue: Requesting a product by handle via Admin REST (https://.myshopify/admin/products.json?handle=) began returning empty results. The goal was to retrieve product_id, including for draft (unpublished) products.

Attempts and constraints:

  • Suggested storefront endpoints (https://.myshopify.com/products/.js or .json) returned {“errors”:{“id”:“expected String to be a id”}} for the asker. These AJAX endpoints don’t use /admin and expose only published storefront data, so they aren’t suitable for draft products.

Working solution (most recent update):

  • Use the versioned Admin REST API with the handle query param:
    • https://.myshopify.com/admin/api/2024-01/products.json?handle=
    • To limit data: add fields, e.g., &fields=id or &fields=id,title,handle
  • Reported as working “as of today.” This approach returns standard Admin fields and supports drafts (given appropriate Admin API access).

Outcome: A concrete Admin API endpoint pattern that resolves the need to fetch product_id by handle, including for drafts. No remaining open questions noted.

Summarized with AI on January 2. AI used: gpt-5.

It does work on the product pages from the domain of the store directly but I does not seem to returning in the myshopify store request. And, I need it on there since I want to get the product_id of a product in draft status and they won’t be published on the store url. So, The only way to get those would be through

https://.myshopify/admin/products.json but that returns

{"errors":{"id":"expected String to be a id"}}