diff --git a/src/clients/RestApi.php b/src/clients/RestApi.php
index 626863280b252c6f086656b1efe047a17022a0ee..4985fbf9e7252d0706086ccb18d3189af89e8e8b 100644
--- a/src/clients/RestApi.php
+++ b/src/clients/RestApi.php
@@ -17,7 +17,7 @@ class RestApi
 
         // Set common options in the constructor
         $this->baseUrl = Application::$config['REST_API_URL'];
-        $apiKey = Application::$config['PHP_API_KEY'];
+        $apiKey = Application::$config['REST_API_KEY'];
         curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($this->ch, CURLOPT_HTTPHEADER, ['x-api-key: ' . $apiKey]);
     }
diff --git a/src/clients/SoapApi.php b/src/clients/SoapApi.php
index b3b09a5c0ca4b7e7e34277610e1fddf3021514ab..7af98d0e55c0202437dbd61938e05f0653bdd4e1 100644
--- a/src/clients/SoapApi.php
+++ b/src/clients/SoapApi.php
@@ -17,7 +17,7 @@ class SoapApi
         $baseUrl = Application::$config['SOAP_BASE_URL'];
         $headers = array(
             "http" => array(
-                "header" => "x-api-key: " . Application::$config['PHP_API_KEY']
+                "header" => "x-api-key: " . Application::$config['SOAP_API_KEY']
             )
         );
 
diff --git a/src/middlewares/ExternalServiceMiddleware.php b/src/middlewares/ExternalServiceMiddleware.php
index b1af51278f19cb379d2479bc6c276b464b8a7fad..0b1a636553fb94748fddecaa7329e251fc9bb454 100644
--- a/src/middlewares/ExternalServiceMiddleware.php
+++ b/src/middlewares/ExternalServiceMiddleware.php
@@ -14,7 +14,7 @@ class ExternalServiceMiddleware extends Middleware {
         if(!isset($_SERVER['HTTP_X_API_KEY'])){
             throw new UnauthorizedException($isView);
         }
-        if ($_SERVER['HTTP_X_API_KEY'] != Application::$config['SOAP_API_KEY'] && $_SERVER['HTTP_X_API_KEY'] != Application::$config['REST_API_KEY']) {
+        if ($_SERVER['HTTP_X_API_KEY'] != Application::$config['PHP_API_KEY']) {
             throw new UnauthorizedException($isView);
         }
     }