src/includes/classes/Core/Utils/RequestType.php
public function isApi(bool $flag = null): bool
    {
        if (isset($flag)) {
            $this->is_api = $flag;
        }
        if (!isset($this->is_api) && $this->is_wordpress) {
            if ((defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) || (defined('REST_REQUEST') && REST_REQUEST)) {
                $this->is_api = true; // Via WP constants.
            }
        }
        return (bool) $this->is_api;
    }
public function isApi(bool $flag = null): bool
    {
        if (isset($flag)) {
            $this->is_api = $flag;
        }
        if (!isset($this->is_api) && $this->is_wordpress) {
            if ((defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) || (defined('REST_REQUEST') && REST_REQUEST)) {
                $this->is_api = true; // Via WP constants.
            }
        }
        return (bool) $this->is_api;
    }
An API request?

@since 160605 Request types.

@param bool|null $flag If setting flag.

@return bool Is an API request?