From the API: "Invalid API request signature. Please refer to the documentation"


Hi, I get this from the API: "Invalid API request signature. Please refer to the documentation", what is the error?
The code did work correctly on my local env, but failed on staging, so I guess it's a matter of API keys or endpoint configuration, I'm testing it and will post more information, thanks.
@twisted1919 :
This is the code.
SCHEME_DOMAIN is the site's URL, it's correctly setup as well as both API keys.

Yii::registerAutoloader(['MailWizzApi_Autoloader', 'autoloader'], true);
$config = new MailWizzApi_Config([
    'apiUrl'        => SCHEME_DOMAIN.'/mailwizz/api/index.php',
    'publicKey'     => Yii::app()->params['mailwizz API keys']['public'],
    'privateKey'    => Yii::app()->params['mailwizz API keys']['private'],
    'components' => [
        'cache' => [
            'class'     => 'MailWizzApi_Cache_File',
            'filesPath' => MAILWIZZ_PATH.'/MailWizzApi/Cache/data/cache' // make sure it is writable by webserver
MailWizzApi_Base::setConfig( $config );
if( $author ) {
    $customer = self::getCustomer( $author );

// [...]

public static function getCustomer( $author )
    $customer_uid = $author->mailwizz_customer_uid;
    $response = (new MailWizzApi_Endpoint_Customers)->view( $customer_uid );
    if( $response->body['status'] == 'success' ) {
        return $response->body['data'];
    throw new \Exception( // [...]

mailwizz-php-sdk/MailwizzApi/Endpoint/Customers.php :
class MailWizzApi_Endpoint_Customers extends MailWizzApi_Base
    public function view( $customer_uid )
        $client = new MailWizzApi_Http_Client(array(
            'method'        => MailWizzApi_Http_Client::METHOD_GET,
            'url'           => $this->config->getApiUrl("customers/{$customer_uid}"),
            'paramsPost'    => null,
        return $response = $client->request();

And this was added to the API config/main.php urlManager rules:
array('customers/view',   'pattern' => 'customers/<customer_uid:([a-z0-9]+)>', 'verb' => 'GET'),
From searching the mailwizz API source, that message is only displayed in RequestAccessFilter.php line 149.
That filter has many other error messages that are very specific, like Invalid API key or Your IP address is not allowed but I'm not sure what Invalid API request signature, means, I can't control the signature.

I'm just testing the API and it not possible to add subscribers by bulk. I'm trying to create them with example [1] and I get this error [2].
If I comment in file [3] from line 183 to 189, it works.

Is there any config I need to change for working without comment the fragment of code I explain?

MW version I'm testing: 1.9.6

Thanks in advanced


MailWizzApi_Params Object
[_data:MailWizzApi_Params.private] => Array
[status] => error
[error] => Invalid API request signature. Please refer to the documentation.

[_readOnly:MailWizzApi_Params.private] =>

Last edited:
Easiest way is to simply disable the api signature check from backend > settings > api.
We will remove this option anyway, so it's okay to disable it.