I am using the products API (rest/V1/products/:sku) and getting back an id for a product.

I'd like to use that to build a URL to the product page - something like


What is the correct URL?

Note: Direct link to a category works properly:


One of the custom_attributes returned by the products API is url_key, but I can't seem to get that to work either:

[10] => stdClass Object ( [attribute_code] => url_key [value] => zoltan-gym-tee-l-blue )

http://my-store.com/zoltan-gym-tee-l-blue doesn't work (with or without .html suffix).

I wonder if this is a bug in the products API, because the real url key does not include attribute information - i.e., the URL

http://my-store.com/zoltan-gym-tee.html does work. (But note that this is not the URL key - the url key is "zoltan-gym-tee-l-blue".)

  • Should use a user friendly SEO url- url key of product. For example: http://my-store.com/product-url-key. Commented Jul 18, 2017 at 4:17
  • Tried that too - updated the question to show it. Commented Jul 18, 2017 at 10:49
  • 1
    How about my-store.com/zoltan-gym-tee-l-blue.html
    – PY Yick
    Commented Jul 18, 2017 at 10:51
  • Nope. That didn't work either. Or product/zoltan-gym-tee-l-blue with or without .html. Commented Jul 18, 2017 at 10:54
  • Did you try to reindex database? Commented Jul 18, 2017 at 11:15

2 Answers 2


The answer is,


is indeed the correct URL. However, this will not work if the product does not have the Visibility setting (in Admin->Products->Catalog->edit product) set so that "Catalog" is included in the value (e.g. "Catalog" or "Catalog,Search").

Note that once this has been done, PY Yick's comment that you should be able to use use http://my-store.com/zoltan-gym-tee-l-blue.html (i.e. http://my-store.com/product-url-key.html) is correct - provided ".html" is the configured suffix set in Admin->Stores->Configuration->Catalog->SEO->Product URL Suffix.

The Magento team says they have a backlog item to add URL to the Products API, so hopefully this improvement will be made soon.


This FOSS Module might help.

It overwrites the router and redirects exact SKU matches to the product


So you would have link like example.com/1337 if your SKU is 1337

There is also this one which uses a specific route


Here the link is example.com/gotosku/?sku=1337

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.