You can use an api search query as below, to target the url_key
by using a combination of searchCriteria and fields https://devdocs.magento.com/guides/v2.4/rest/retrieve-filtered-responses.html
We also use the fields to filter the response and only return the information we need
https://www.domain.com/rest/V1/products? // url
searchCriteria[filter_groups][0][filters][0][field]=sku& // search for field sku
searchCriteria[filter_groups][0][filters][0][condition_type]=neq& // not equal to
searchCriteria[filter_groups][0][filters][0][value]=null& // null (we do this to target all products)
searchCriteria[filter_groups][1][filters][1][field]=type_id& // target the type of product
searchCriteria[filter_groups][1][filters][1][condition_type]=in& // where in
searchCriteria[filter_groups][1][filters][1][value]=configurable,giftcard& // configurable, giftcard (these products are the products you can view in the store)
searchCriteria[filter_groups][2][filters][2][field]=website_id& // we target the website_id to shrink our product scope to a website
searchCriteria[filter_groups][2][filters][2][condition_type]=eq& // website_id equal too
searchCriteria[filter_groups][2][filters][2][value]=1& // website id
searchCriteria[filter_groups][3][filters][3][field]=status& // we target the status to shrink the product result set even more
searchCriteria[filter_groups][3][filters][3][condition_type]=eq& // equal to
searchCriteria[filter_groups][3][filters][3][value]=1& // enabled
fields=items[sku,type_id,created_at,updated_at,custom_attributes[publish_date,url_key]] // we are only interested in the following fields
An example response looks like
{
"items": [
{
"sku": "XYZ123",
"type_id": "configurable",
"created_at": "2019-05-24 23:48:42",
"updated_at": "2021-07-30 10:18:29",
"custom_attributes": {
"1": {
"attribute_code": "url_key",
"value": "xyz-123"
},
"7": {
"attribute_code": "publish_date",
"value": "2020-09-29 00:00:00"
}
}
},
{
"sku": "ABCDEF",
"type_id": "configurable",
"created_at": "2019-05-24 23:52:25",
"updated_at": "2021-05-28 22:21:35",
"custom_attributes": {
"1": {
"attribute_code": "url_key",
"value": "product-abc-def"
}
}
},
From there you can construct it by hand as example
http://www.domain.com/[store_code]/[url_key](.html)