Access denied due to invalid subscription key (Face API)

azure api management access denied due to invalid subscription key
access denied due to missing subscription key.
ocp-apim-subscription-key
face api documentation
microsoft cognitive services api key
westus face api
microsoft emotion api
microsoft face api

I am having trouble using Microsoft Face API. Below is my sample request:

curl -v -X POST "https://westus.api.cognitive.microsoft.com/face/v1.0/detect?returnFaceId=true&returnFaceLandmarks=false&returnFaceAttributes=age,gender" -H "Content-Type: application/json" -H "Ocp-Apim-Subscription-Key: 1xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxd" --data-ascii "{\"url\":\"http://www.mrbeantvseries.co.uk/bean3.jpg\"}"

I use the subscription id from my cognitive services account and I got below response:

{
  "error": {
    "code": "Unspecified",
    "message": "Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and provide the right key."
  }
}

Not sure if I've missed out anything there. Can someone help me on this? Very much appreciated.

It appears that you've entered your Azure subscription ID instead? In the Azure portal, you can find the API key under 'Keys', shown below:

It will be a 32-digit hexadecimal number, no hyphens.

It appears that you've entered your Azure subscription ID instead? In the Azure portal, you can find the API key under 'Keys', shown below:. "message": "Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and provide the right key." This was tried out in face api console in API reference. The same error is seen in the c# code as well.

I ran into the same problem. I read the API documentation and it states the following.

You must use the same region in your REST API call as you used to obtain your subscription keys.

First, you must find the location of your subscription. In order to find the location of your subscription region, you must go to Cognitive Services -> Properties under the Label Location, you will find your subscription region. See below.

Second you must find the correct endpoint to make the call to. For example, if I want to make a call to the Computer Vision API, My location is East US, I will use either key 1 or 2, then I will use the following endpoint East US - https://eastus.api.cognitive.microsoft.com/face/v1.0/detect

You will now be able to have access to the API.

"error": { "code": "Unspecified", "message": "Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and  Invalid subscription Key or user/plan is blocked. "Unspecified", "message": "Access denied due to invalid subscription key. Make sure you are subscribed to an API

I had faced the same issue, it seems like there is some problem with the keys generated newly. To fix this you can actually add your endpoint as well, when you create the object for IFaceServiceClient. You can see the code below.

private readonly IFaceServiceClient faceServiceClient = new FaceServiceClient("your key", "Your endpoint");

Hence from the error – “Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription", it's quite clear that we are sending a wrong value of 'Ocp-Apim-Subscription-Key' request header while invoking 'Create resource' and 'Retrieve resource' operations. "message": "Access denied due to invalid subscription key. Make sure you are subscribed to an API you are trying to call and provide the right key."}} I am located in Denmark and have generated keys for Face API along with others related APIs and in the Intelligent Kiosk App setting, I have entered keys and selected Azure Zone like West Europ

CesarB is correct. You must create a Resource of Cognitive Service in Azure first and then get the subscription key from it. the region is not always 'westus', it really depends on what region you select when you created the resource. You can also check it on the endpoint of overview of the Resource

The default value is false. Request headers. Ocp-Apim-Subscription-Key. string. Subscription key which provides access to  "message": "Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription." I have tried both Key1 and Key2 from the Azure project on the CV Connection.

Endpoint https://westeurope.api.cognitive.microsoft.com/face/v1.0

Endpoint and the subscription key must be consistent.

look at Microsoft Overview for this info!

{ “statusCode”: 401, “message”: “Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription.” }. Face API - v1.0 . This API is currently available in: Invalid subscription Key or user/plan is blocked. "Unspecified", "message": "Access denied due to

I am having trouble using Microsoft Face API. Below is my sample request:curl -v -X POST. I'm getting a 401 when I use any key generated from Azure. I've added the key to my app in eu.luis.ai portal, it's there in the list. When I use that key in REST API it never works, always returns 401.

Recently while working with Face API we were getting the below error To get it working we had to define apiRoot along with the subscriptionkey  Alias - Delete API Applies to: S1 pricing tier. This API allows the caller to delete a previously created alias. You can also use this API to delete old/unused aliases to create space for new content. This API does not delete the references resource, only the alias referencing the resource. Submit Delete Request To delete your alias you will issue a DELETE request where the path will contain

Recently while working with Face API we were getting the below error To get it working we had to define apiRoot along with the subscriptionkey 

Comments