Faces - Detect
Detect faces in an image.
POST {endpoint}/contentunderstanding/faces:detect?api-version=2025-05-01-preview
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
endpoint
|
path | True |
string (uri) |
Content Understanding service endpoint. |
|
api-version
|
query | True |
string minLength: 1 |
The API version to use for this operation. |
Request Header
| Name | Required | Type | Description |
|---|---|---|---|
| x-ms-client-request-id |
string (uuid) |
An opaque, globally-unique, client-generated string identifier for the request. |
Request Body
| Name | Type | Description |
|---|---|---|
| data |
string (byte) |
Base64-encoded image data. Only one of url or data should be specified. |
| maxDetectedFaces |
integer (int32) |
Maximum number of faces to return (up to 100). |
| url |
string |
Image URL. Only one of url or data should be specified. |
Responses
| Name | Type | Description |
|---|---|---|
| 200 OK |
The request has succeeded. |
|
| Other Status Codes |
An unexpected error response. Headers x-ms-error-code: string |
Security
Ocp-Apim-Subscription-Key
Type:
apiKey
In:
header
OAuth2Auth
Type:
oauth2
Flow:
accessCode
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Token URL:
https://login.microsoftonline.com/common/oauth2/token
Scopes
| Name | Description |
|---|---|
| https://cognitiveservices.azure.com/.default |
Examples
Detect Faces in an Image
Sample request
POST {endpoint}/contentunderstanding/faces:detect?api-version=2025-05-01-preview
{
"url": "https://mystorageaccount.blob.core.windows.net/images/container/file.jpg",
"maxDetectedFaces": 50
}
Sample response
{
"detectedFaces": [
{
"boundingBox": {
"left": 33,
"top": 73,
"width": 262,
"height": 324
}
},
{
"boundingBox": {
"left": 87,
"top": 96,
"width": 235,
"height": 345
}
}
]
}
Definitions
| Name | Description |
|---|---|
|
Azure. |
The error object. |
|
Azure. |
A response containing error details. |
|
Azure. |
An object containing more specific information about the error. As per Azure REST API guidelines - https://aka.ms/AzureRestApiGuidelines#handling-errors. |
|
Bounding |
Bounding box in an image. |
|
Detected |
Detected bounding box of an object. |
|
Detect |
Detect faces parameters. |
|
Detect |
Detect faces response. |
Azure.Core.Foundations.Error
The error object.
| Name | Type | Description |
|---|---|---|
| code |
string |
One of a server-defined set of error codes. |
| details |
An array of details about specific errors that led to this reported error. |
|
| 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 |
The error object. |
Azure.Core.Foundations.InnerError
An object containing more specific information about the error. As per Azure REST API guidelines - https://aka.ms/AzureRestApiGuidelines#handling-errors.
| Name | Type | Description |
|---|---|---|
| code |
string |
One of a server-defined set of error codes. |
| innererror |
Inner error. |
BoundingBox
Bounding box in an image.
| Name | Type | Description |
|---|---|---|
| height |
integer (int32) |
Height of the bounding box. |
| left |
integer (int32) |
Left coordinate of the bounding box. |
| top |
integer (int32) |
Top coordinate of the bounding box. |
| width |
integer (int32) |
Width of the bounding box. |
DetectedBoundingBox
Detected bounding box of an object.
| Name | Type | Description |
|---|---|---|
| boundingBox |
Bounding box of the detected face. |
DetectFacesParameters
Detect faces parameters.
| Name | Type | Default value | Description |
|---|---|---|---|
| data |
string (byte) |
Base64-encoded image data. Only one of url or data should be specified. |
|
| maxDetectedFaces |
integer (int32) |
100 |
Maximum number of faces to return (up to 100). |
| url |
string |
Image URL. Only one of url or data should be specified. |
DetectFacesResult
Detect faces response.
| Name | Type | Description |
|---|---|---|
| detectedFaces |
List of detected faces. |