获取人脸检测结果
curl --request GET \
--url https://api.crun.ai/api/v1/client/job/detect-face-result \
--header 'x-api-key: <api-key>'import requests
url = "https://api.crun.ai/api/v1/client/job/detect-face-result"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.crun.ai/api/v1/client/job/detect-face-result', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.crun.ai/api/v1/client/job/detect-face-result",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.crun.ai/api/v1/client/job/detect-face-result"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.crun.ai/api/v1/client/job/detect-face-result")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.crun.ai/api/v1/client/job/detect-face-result")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "success",
"data": {
"detect_task_id": "dit60yt8reqplt1c16",
"result": {
"id": "m1oZzqYp9dN",
"status": "succeed",
"type": "face_detect",
"hair_id": null,
"faces": [
{
"id": 0,
"link": "https://example.com/detected-face-0.jpg"
},
{
"id": 1,
"link": "https://example.com/detected-face-1.jpg"
}
],
"started_at": "2026-05-27 12:14:03",
"finished_at": "2026-05-27 12:14:04",
"error": null
},
"status": "succeeded",
"error": null
}
}人脸交换
人脸检测结果
查询图片、视频或 GIF 人脸检测任务状态,并获取多人换脸需要的 detect_id 与 faces 列表。
GET
/
api
/
v1
/
client
/
job
/
detect-face-result
获取人脸检测结果
curl --request GET \
--url https://api.crun.ai/api/v1/client/job/detect-face-result \
--header 'x-api-key: <api-key>'import requests
url = "https://api.crun.ai/api/v1/client/job/detect-face-result"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.crun.ai/api/v1/client/job/detect-face-result', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.crun.ai/api/v1/client/job/detect-face-result",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.crun.ai/api/v1/client/job/detect-face-result"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.crun.ai/api/v1/client/job/detect-face-result")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.crun.ai/api/v1/client/job/detect-face-result")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": 200,
"message": "success",
"data": {
"detect_task_id": "dit60yt8reqplt1c16",
"result": {
"id": "m1oZzqYp9dN",
"status": "succeed",
"type": "face_detect",
"hair_id": null,
"faces": [
{
"id": 0,
"link": "https://example.com/detected-face-0.jpg"
},
{
"id": 1,
"link": "https://example.com/detected-face-1.jpg"
}
],
"started_at": "2026-05-27 12:14:03",
"finished_at": "2026-05-27 12:14:04",
"error": null
},
"status": "succeeded",
"error": null
}
}概述
创建人脸检测任务后,调用此接口查询检测状态。任务成功后,data.result.id 即为多人换脸请求中的 detect_id,
data.result.faces 包含每张检测到的人脸 ID 和人脸图片 URL。
detect_id 有效期为 1 小时。换脸时传入的资源地址要和检测时相同。接口地址
GET https://api.crun.ai/api/v1/client/job/detect-face-result
请求参数
创建检测任务时返回的
detect_task_id。状态枚举
| 状态 | 说明 |
|---|---|
starting | 启动中 |
processing | 处理中 |
succeeded | 成功 |
failed | 失败 |
成功响应示例
{
"code": 200,
"message": "success",
"data": {
"detect_task_id": "dit60yt8reqplt1c16",
"result": {
"id": "m1oZzqYp9dN",
"status": "succeed",
"type": "face_detect",
"hair_id": null,
"faces": [
{
"id": 0,
"link": "https://example.com/detected-face-0.jpg"
},
{
"id": 1,
"link": "https://example.com/detected-face-1.jpg"
}
],
"started_at": "2026-05-27 12:14:03",
"finished_at": "2026-05-27 12:14:04",
"error": null
},
"status": "succeeded",
"error": null
}
}
处理中响应示例
{
"code": 200,
"message": "success",
"data": {
"detect_task_id": "dit9ka6i5qoc519iv0",
"result": null,
"status": "processing",
"error": null
}
}
失败响应示例
{
"code": 200,
"message": "success",
"data": {
"detect_task_id": "dit9ka6i5qoc519iv0",
"result": null,
"status": "failed",
"error": {
"code": "FaceSwap.Detect.Failed",
"message": "[任务NDm40D2DQp6] 未检测到人脸,源文件未检测到人脸"
}
}
}
相关资源
检测人脸(图片)
创建图片人脸检测任务
检测人脸(视频和 GIF)
创建视频或 GIF 人脸检测任务
授权
所有 API 都需要通过 API Key 认证。
获取 API Key:
- 访问 API Key 管理页面 获取你的 API Key
使用方式: 添加到请求头:
x-api-key: YOUR_API_KEY
注意:
- 请妥善保管你的 API Key,不要分享给他人
- 如果怀疑 API Key 已泄露,请立即在管理页面重置
查询参数
创建人脸检测任务时返回的 detect_task_id。
响应
请求成功
响应状态码
- 200:成功 - 请求已成功处理
- 401:未授权 - 认证凭据缺失或无效
- 402:余额不足 - 账户积分不足,无法执行操作
- 404:未找到 - 请求的资源或接口不存在
- 422:验证错误 - 请求参数未通过校验
- 429:请求过多 - 已超过该资源的请求限制
- 455:服务不可用 - 系统正在维护
- 500:服务器错误 - 处理请求时发生意外错误
- 501:生成失败 - 内容生成任务失败
- 505:功能已禁用 - 请求的功能当前不可用
可用选项:
200, 401, 402, 404, 422, 429, 455, 500, 501, 505 响应消息,失败时为错误描述
示例:
"success"
Show child attributes
Show child attributes
此页面对您有帮助吗?
⌘I
