Unified endpoint to detect faces in either video or image from URL or base64-encoded image
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
url | string | Yes* | - | Image or video URL (publicly accessible) |
img | string | Yes* | - | Base64-encoded image data |
num_frames | integer | No | 5 | Number of frames for video analysis |
return_face_url | boolean | No | false | Return cropped face image URLs |
single_face | boolean | No | false | Return only the largest face |
url or img must be provided. If both are provided, url takes priority.| Field | Type | Description |
|---|---|---|
error_code | integer | 0 = success, 1 = error |
error_msg | string | Status message |
faces_obj | object | Face data keyed by frame index (“0”, “1”, etc.) |
| Field | Type | Description |
|---|---|---|
landmarks | array | 6-point landmarks for each face: Left Eye, Right Eye, Nose, Mouth Center, Left Mouth Corner, Right Mouth Corner |
landmarks_str | array | First 4 landmarks as string format "x1,y1:x2,y2:x3,y3:x4,y4" - use this for Face Swap opts parameter |
region | array | Bounding boxes [x, y, width, height] |
removed | array | Faces no longer visible (video only) |
frame_time | number/null | Timestamp in seconds (video only, null for images) |
face_urls | array/null | Cropped face URLs (when return_face_url=true) |
crop_region | array/null | Crop region in original image coordinates |
crop_landmarks | array/null | Landmarks relative to cropped image |
| error_code | error_msg | Description |
|---|---|---|
| 0 | SUCCESS | Success |
| 1 | Either ‘url’ or ‘img’ parameter must be provided | Missing input |
| 1 | Invalid URL format | Bad URL |
| 1 | Failed to download media from URL | Download failed |
landmarks_str directly as the opts parameter in Face Swap API:
single_face=true when only one face neededYour API Key used for request authorization. If both Authorization and x-api-key have values, Authorization will be used first and x-api-key will be discarded.
URL of the video or image to process. The media type will be auto-detected based on the file extension.
Either url or img must be provided. If both are provided, url takes priority.
"https://example.com/media.mp4"
Base64-encoded image data. Supports both plain base64 string and data URI format (e.g., "data:image/jpeg;base64,...").
Either url or img must be provided. If both are provided, url takes priority.
"data:image/jpeg;base64,/9j/4AAQSkZJRg..."
Number of frames to extract and analyze (only used for videos, ignored for images)
1 <= x <= 1005
Whether to return cropped face image URLs. When set to true, the response will include:
face_urls: URLs of cropped face imagescrop_region: The region used for cropping in original image coordinatescrop_landmarks: Landmarks relative to the cropped imagefalse
When set to true, only returns the largest face (by area) in each frame.
Useful when you only need the main/primary face in the image or video.
false
Face detection completed successfully
Error code (0: success, 1: error)
0
Error message or success message
"SUCCESS"
Dictionary of face detection results keyed by frame index (as string). For images, only frame "0" will be present. For videos, multiple frames will be present (e.g., "0", "5", "10", etc.)
{
"0": {
"landmarks": [
[
[120, 85],
[180, 88],
[150, 130],
[150, 165],
[125, 165],
[175, 168]
]
],
"landmarks_str": ["120,85:180,88:150,130:150,165"],
"region": [[80, 50, 150, 180]],
"removed": [],
"frame_time": null,
"face_urls": null,
"crop_region": null,
"crop_landmarks": null
}
}