You can't replace by regex in one step, which would be ideal. Instead, you must tease out a possible id, coalesce to give it a default value, then replace that explicit value with a placeholder. This will allow you to get endpoint counts regardless of specific record ids.
This simple version works for endpoints that have AT MOST one id:
filter path like /\/api\/v/
| parse path /(?<@id1>\/[0-9]+)(\/|$)/
| fields coalesce(@id1, "") as id1
| fields replace(path, id1, "/{id}") as unique_path
| stats count(*) as requests by unique_path
| sort requests desc
| display unique_path, requests
If your record ids are more complex, you can update the regex accordingly. I had to do this because some of our app's endpoints accept ids as hex strings, ie "0x04f5".
This next version will work for up to 2 ids. For more, you can see how to repeat the given pattern, but I didn't find a shortcut for n-count ids in a URL path.
filter path like /\/api\/v/
| parse path /(?<@id1>\/[0-9]+)(\/|$)/
| fields coalesce(@id1, "") as id1
| fields replace(path, id1, "/{id}") as unique_path1
| parse unique_path1 /(?<@id2>\/[0-9]+)(\/|$)/
| fields coalesce(@id2, "") as id2
| fields replace(unique_path1, id2, "/{id2}") as unique_path
| stats count(*) as requests by unique_path
| sort requests desc
| display unique_path, requests