Text Operations - Detect Text Protected Material

Detect Protected Material for Text
A synchronous API for detecting protected material in the given text.

POST {endpoint}/contentsafety/text:detectProtectedMaterial?api-version=2024-09-01

URI Parameters

Name In Required Type Description
endpoint
path True

string

Supported Cognitive Services endpoints (protocol and hostname, for example: https://.cognitiveservices.azure.com).

api-version
query True

string

The API version to use for this operation.

Request Body

Name Required Type Description
text True

string

The text to be analyzed, which may contain protected material. The characters will be counted in Unicode code points.

Responses

Name Type Description
200 OK

DetectTextProtectedMaterialResult

The request has succeeded.

Other Status Codes

Azure.Core.Foundations.ErrorResponse

An unexpected error response.

Headers

x-ms-error-code: string

Security

Ocp-Apim-Subscription-Key

Type: apiKey
In: header

OAuth2Auth

Type: oauth2
Flow: application
Token URL: https://login.microsoftonline.com/common/oauth2/v2.0/token

Scopes

Name Description
https://cognitiveservices.azure.com/.default

Examples

Detect Protected Material for Text

Sample request

POST {endpoint}/contentsafety/text:detectProtectedMaterial?api-version=2024-09-01

{
  "text": "to everyone, the best things in life are free. the stars belong to everyone, they gleam there for you and me. the flowers in spring, the robins that sing, the sunbeams that shine"
}

Sample response

{
  "protectedMaterialAnalysis": {
    "detected": true
  }
}

Definitions

Name Description
Azure.Core.Foundations.Error

The error object.

Azure.Core.Foundations.ErrorResponse

A response containing error details.

Azure.Core.Foundations.InnerError

An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.

DetectTextProtectedMaterialOptions

The request of detecting potential protected material present in the given text.

DetectTextProtectedMaterialResult

The combined detection results of potential protected material.

TextProtectedMaterialAnalysisResult

The individual detection result of potential protected material.

Azure.Core.Foundations.Error

The error object.

Name Type Description
code

string

One of a server-defined set of error codes.

details

Azure.Core.Foundations.Error[]

An array of details about specific errors that led to this reported error.

innererror

Azure.Core.Foundations.InnerError

An object containing more specific information than the current object about the error.

message

string

A human-readable representation of the error.

target

string

The target of the error.

Azure.Core.Foundations.ErrorResponse

A response containing error details.

Name Type Description
error

Azure.Core.Foundations.Error

The error object.

Azure.Core.Foundations.InnerError

An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.

Name Type Description
code

string

One of a server-defined set of error codes.

innererror

Azure.Core.Foundations.InnerError

Inner error.

DetectTextProtectedMaterialOptions

The request of detecting potential protected material present in the given text.

Name Type Description
text

string

The text to be analyzed, which may contain protected material. The characters will be counted in Unicode code points.

DetectTextProtectedMaterialResult

The combined detection results of potential protected material.

Name Type Description
protectedMaterialAnalysis

TextProtectedMaterialAnalysisResult

Analysis result for the given text.

TextProtectedMaterialAnalysisResult

The individual detection result of potential protected material.

Name Type Description
detected

boolean

Whether potential protected material is detected or not.