Title: API whitelist problem
Last modified: December 11, 2019

---

# API whitelist problem

 *  Resolved [diashima](https://wordpress.org/support/users/diashima/)
 * (@diashima)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/api-whitelist-problem/)
 * Hello! I successfully added endpoint ‘/wp-json/wp/v2/posts’ to whitelist, but
   I still can’t open particular post.
    My question is – what endpoint I must write
   to make available without authorization every post? Something like: ‘/wp-json/
   wp/v2/posts/{ID}’ Putting * in place of {ID} is not working.
 *     ```
       add_filter('api_bearer_auth_unauthenticated_urls', 'api_bearer_auth_unauthenticated_urls_filter', 10, 2);
       function api_bearer_auth_unauthenticated_urls_filter($custom_urls, $request_method) {
         switch ($request_method) {
           case 'POST':
             $custom_urls[] = '/wp-json/wp/v2/users/register';
             break;
           case 'GET':
             $custom_urls[] = '/wp-json/wp/v2/posts';
             break;
         }
         return $custom_urls;
       }
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [diashima](https://wordpress.org/support/users/diashima/)
 * (@diashima)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/api-whitelist-problem/#post-12227566)
 * And how i can put two endpoints for GET to whitelist?
 *  Plugin Author [michielve](https://wordpress.org/support/users/michielve/)
 * (@michielve)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/api-whitelist-problem/#post-12234523)
 * Hi,
 * You have to use regular expressions, so for posts it will be:
 * /wp-json/wp/v2/posts/[\d]+
 * To add 2 or more endpoints, just add them, for example:
 * $custom_urls[] = ‘/wp-json/wp/v2/posts’;
    $custom_urls[] = ‘/wp-json/wp/v2/pages’;
   $custom_urls[] = ‘/wp-json/wp/v2/posts/[\d]+’;
 * Best wishes,
    Michiel

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘API whitelist problem’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/api-bearer-auth.svg)
 * [API Bearer Auth](https://wordpress.org/plugins/api-bearer-auth/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/api-bearer-auth/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/api-bearer-auth/)
 * [Active Topics](https://wordpress.org/support/plugin/api-bearer-auth/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/api-bearer-auth/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/api-bearer-auth/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [michielve](https://wordpress.org/support/users/michielve/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/api-whitelist-problem/#post-12234523)
 * Status: resolved