Wordpress - rewrite or hide wp-json in url
You can use the filter rest_url_prefix
to do the rewrite:
add_filter( 'rest_url_prefix', function() { return 'api';});
Remember to visit Settings->Permalinks to flush the permalinks after adding the above code to functions.php