Face Detection
face_detection_detect_facesMCP guidance:
This starts an async face-detection task and returns an
id. Use the face-detection details endpoint with that id to retrieve detected faces before doing individual face swaps.For
*_file_path, use an existing Magic Hour path or the upload-URL endpoint'sfile_pathafter uploading raw bytes to its presigned URL. Direct public media URLs may work if stable and fetchable as raw bytes; hotlinked URLs can fail. Prefer the upload-URL endpoint when unsure.
Detect faces in an image or video.
Use this API to get the list of faces detected in the image or video to use in the face swap photo or face swap video API calls for multi-face swaps.
Note: Face detection is free to use for the near future. Pricing may change in the future.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assets | Yes | Provide the assets for face detection | |
| confidence_score | No | Confidence threshold for filtering detected faces. * Higher values (e.g., 0.9) include only faces detected with high certainty, reducing false positives. * Lower values (e.g., 0.3) include more faces, but may increase the chance of incorrect detections. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The id of the task. Use this value in the [get face detection details API](https://docs.magichour.ai/api-reference/files/get-face-detection-details) to get the details of the face detection task. | |
| credits_charged | Yes | The credits charged for the task. |