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.

I know you posted about this a while ago but I eventually found a solution when getting stuck myself so this might help others if not you…

https://.myshopify.com/admin/api/2024-01/products.json?handle=toy-rocking-horse (for all the usual fields)

https://.myshopify.com/admin/api/2024-01/products.json?handle=toy-rocking-horse&fields=id (if you just wanted the id as you originally asked about)

https://.myshopify.com/admin/api/2024-01/products.json?handle=toy-rocking-horse&fields=id,title,handle (if a subset of the fields was useful by also passing in a comma separated list of values)
(if
All working as of today