Python
from magic_hour import Client
from os import getenv
client = Client(token=getenv("API_TOKEN"))
res = client.v1.face_detection.get(id="uuid-example")import { Client } from "magic-hour";
const client = new Client({ token: process.env["API_TOKEN"]!! });
const res = await client.v1.faceDetection.get({ id: "uuid-example" });package main
import (
os "os"
sdk "github.com/magichourhq/magic-hour-go/client"
face_detection "github.com/magichourhq/magic-hour-go/resources/v1/face_detection"
)
func main() {
client := sdk.NewClient(
sdk.WithBearerAuth(os.Getenv("API_TOKEN")),
)
res, err := client.V1.FaceDetection.Get(face_detection.GetRequest{
Id: "uuid-example",
})
}let client = magic_hour::Client::default()
.with_bearer_auth(&std::env::var("API_TOKEN").unwrap());
let res = client
.v1()
.face_detection()
.get(magic_hour::resources::v1::face_detection::GetRequest {
id: "uuid-example".to_string(),
})
.await;curl --request GET \
--url https://api.magichour.ai/v1/face-detection/id \
--header 'accept: application/json' \
--header 'authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.magichour.ai/v1/face-detection/id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"accept: application/json",
"authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.magichour.ai/v1/face-detection/id")
.header("accept", "application/json")
.header("authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magichour.ai/v1/face-detection/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "uuid-example",
"credits_charged": 0,
"status": "complete",
"faces": [
{
"path": "api-assets/id/0-0.png",
"url": "https://videos.magichour.ai/api-assets/id/0-0.png"
}
]
}{
"code": "invalid_request",
"message": "<string>"
}{
"code": "unauthorized",
"message": "<string>"
}{
"code": "insufficient_credits",
"message": "<string>"
}{
"code": "not_found",
"message": "<string>"
}{
"code": "unprocessable_entity",
"message": "<string>"
}{
"code": "internal_server_error",
"message": "<string>"
}Files
Get face detection details
Get the details of a face detection task.
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.
GET
/
v1
/
face-detection
/
{id}
Python
from magic_hour import Client
from os import getenv
client = Client(token=getenv("API_TOKEN"))
res = client.v1.face_detection.get(id="uuid-example")import { Client } from "magic-hour";
const client = new Client({ token: process.env["API_TOKEN"]!! });
const res = await client.v1.faceDetection.get({ id: "uuid-example" });package main
import (
os "os"
sdk "github.com/magichourhq/magic-hour-go/client"
face_detection "github.com/magichourhq/magic-hour-go/resources/v1/face_detection"
)
func main() {
client := sdk.NewClient(
sdk.WithBearerAuth(os.Getenv("API_TOKEN")),
)
res, err := client.V1.FaceDetection.Get(face_detection.GetRequest{
Id: "uuid-example",
})
}let client = magic_hour::Client::default()
.with_bearer_auth(&std::env::var("API_TOKEN").unwrap());
let res = client
.v1()
.face_detection()
.get(magic_hour::resources::v1::face_detection::GetRequest {
id: "uuid-example".to_string(),
})
.await;curl --request GET \
--url https://api.magichour.ai/v1/face-detection/id \
--header 'accept: application/json' \
--header 'authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.magichour.ai/v1/face-detection/id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"accept: application/json",
"authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api.magichour.ai/v1/face-detection/id")
.header("accept", "application/json")
.header("authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magichour.ai/v1/face-detection/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "uuid-example",
"credits_charged": 0,
"status": "complete",
"faces": [
{
"path": "api-assets/id/0-0.png",
"url": "https://videos.magichour.ai/api-assets/id/0-0.png"
}
]
}{
"code": "invalid_request",
"message": "<string>"
}{
"code": "unauthorized",
"message": "<string>"
}{
"code": "insufficient_credits",
"message": "<string>"
}{
"code": "not_found",
"message": "<string>"
}{
"code": "unprocessable_entity",
"message": "<string>"
}{
"code": "internal_server_error",
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <api_key>, where <api_key> is your API key. To get your API key, go to Developer Hub and click "Create new API Key".
Path Parameters
The id of the task. This value is returned by the face detection API.
Example:
"uuid-example"
Response
200
The id of the task. This value is returned by the face detection API.
Example:
"uuid-example"
The credits charged for the task.
Example:
0
The status of the detection.
Available options:
queued, rendering, complete, error Example:
"complete"
The faces detected in the image or video. The list is populated as faces are detected.
Show child attributes
Show child attributes
Example:
[
{
"path": "api-assets/id/0-0.png",
"url": "https://videos.magichour.ai/api-assets/id/0-0.png"
}
]
Was this page helpful?