face_detection_detect_faces
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.
MCP 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_pathvalues, prefer an existing Magic Hour file path or afile_pathreturned by the upload-URL endpoint after the file bytes are uploaded. Direct public media URLs may work when they are stable, fetchable, and return raw file bytes, but hotlinked URLs can fail; when in doubt, use the presigned upload flow first and pass the returnedfile_path.
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. |