For anyone who is interested I found a solution. I extract this code into a Controller class that extends WP_REST_Controller I then set up three methods inside of that controller; register_routes, get_fields and handle. Inside of the register_routes method I simply set up the following;
register_rest_route( getenv('API_BASE') . '/v' . getenv('API_VERSION'), 'post', array(
'methods' => 'GET',
'callback' => array($this, 'handle'),
));
Inside the get_fields method I set up a simple handle to get the field by passing in a specific block;
public function get_fields($block) {
acf_setup_meta( $block['attrs']['data'], $block['attrs']['id'], true );
return get_fields();
acf_reset_meta( $block['attrs']['id'] );
}
From there the rest of the code stayed pretty much the same inside of the handle method I just changed $blocks[$key]['data'] = $fields; to $blocks[$key]['data'] = $this->get_fields($block);