Exclude post_meta from Rest API Endpoint

Yes, it’s surely possible, but not out-of-the-box.

I.e. There’s no such REST query parameter in the WordPress core, but you can add it to your REST API request, e.g. via the URL query string, and then use the rest_<post type>_query hook which “Filters WP_Query arguments when querying posts via the REST API” and “Enables adding extra arguments or setting defaults for a post collection request“.

And here’s an example for the post post type:

add_filter( 'rest_post_query', 'my_rest_post_query', 10, 2 );
function my_rest_post_query( array $args, WP_REST_Request $request ) {
    if ( $meta_key = $request->get_param( 'exclude_postmeta_key' ) ) {
        $args['meta_key']     = $meta_key;
        $args['meta_compare'] = 'NOT EXISTS';
    }

    return $args;
}

So with that, example.com/wp-json/wp/v2/posts?exclude_postmeta_key=global would now give you the posts that do not have the meta named global.

If you need help with WordPress meta query, see the documentation. ( and/or post another question 🙂 )