401 Error while using Azure Content Moderator

Teresa Hoang 20 Reputation points Microsoft Employee
2023-08-16T14:51:52.52+00:00

Hi! I'm trying to use the ImageAnalysis API, but I keep running into a 401 error.

{
    "error": {
        "code": "401",
        "message": "The Analyze Image Operation under Content Safety Service is not supported with the current subscription key and pricing tier ContentModerator.S0."
    }
}

I tried switching my pricing tier to F0 but I got the same error message

{
    "error": {
        "code": "401",
        "message": "The Analyze Image Operation under Content Safety Service is not supported with the current subscription key and pricing tier ContentModerator.F0."
    }
}

Here's a sample request:
POST https://{resource}.cognitiveservices.azure.com/contentsafety/image:analyze?api-version=2023-04-30-preview

Headers:

Ocp-Apim-Subscription-Key: {my key}

Content-Type: application/json

Body:

raw-json

{
  "image": {
 	"content": "data:image/jpeg;base64,/....."
  },
  "categories": [
    "Hate",
    "Sexual",
    "SelfHarm",
    "Violence"
  ]
}
Community Center Not monitored
{count} votes

Accepted answer
  1. romungi-MSFT 48,906 Reputation points Microsoft Employee Moderator
    2023-08-17T07:37:23.8666667+00:00

    @Teresa Hoang Are you using a multi service cognitive services resource or a content safety standalone resource key? If you are using the key of multi service account, I assume you might see such error irrespective of the tier. Try to create a standalone content safety resource and use the content safety studio to test your image before proceeding to use the REST API. If you lookup your resource in Azure portal the following should be the API type.

    User's image

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.