cURL
curl --request GET \
--url 'https://openapi.akool.com/api/open/v5/hairswap/task/detail?_id=670000000000000000000002' \
--header 'x-api-key: <api-key>'import requests
url = "https://openapi.akool.com/api/open/v5/hairswap/task/detail"
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://openapi.akool.com/api/open/v5/hairswap/task/detail', 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://openapi.akool.com/api/open/v5/hairswap/task/detail",
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://openapi.akool.com/api/open/v5/hairswap/task/detail"
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://openapi.akool.com/api/open/v5/hairswap/task/detail")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi.akool.com/api/open/v5/hairswap/task/detail")
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": 1000,
"msg": "OK",
"data": {
"_id": "<string>",
"task_id": "<string>",
"status": 1,
"media_type": "image",
"model_name": "<string>",
"deduction_credit": 123,
"create_time": 123,
"progress": 123,
"url": "<string>",
"error_reason": "<string>",
"multi_shot_results": [
{}
]
}
}API Endpoints
Get Task Result
Get Task Result for Hair Swap V5.
GET
/
api
/
open
/
v5
/
hairswap
/
task
/
detail
cURL
curl --request GET \
--url 'https://openapi.akool.com/api/open/v5/hairswap/task/detail?_id=670000000000000000000002' \
--header 'x-api-key: <api-key>'import requests
url = "https://openapi.akool.com/api/open/v5/hairswap/task/detail"
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://openapi.akool.com/api/open/v5/hairswap/task/detail', 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://openapi.akool.com/api/open/v5/hairswap/task/detail",
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://openapi.akool.com/api/open/v5/hairswap/task/detail"
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://openapi.akool.com/api/open/v5/hairswap/task/detail")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi.akool.com/api/open/v5/hairswap/task/detail")
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": 1000,
"msg": "OK",
"data": {
"_id": "<string>",
"task_id": "<string>",
"status": 1,
"media_type": "image",
"model_name": "<string>",
"deduction_credit": 123,
"create_time": 123,
"progress": 123,
"url": "<string>",
"error_reason": "<string>",
"multi_shot_results": [
{}
]
}
}GET https://openapi.akool.com/api/open/v5/hairswap/task/detail?_id={{id}}
| Parameter | Value | Description |
|---|---|---|
| x-api-key | API Key | API key used for authorization. Authorization takes precedence when both headers are supplied. |
| Authorization | Bearer {token} | Get Token. |
| Content-Type | application/json | Required for JSON requests. |
| Parameter | Type | Required | Description |
|---|---|---|---|
| _id | String | true | A task ID from the creation response. Only tasks belonging to your user/team are accessible. |
| Parameter | Type | Description |
|---|---|---|
| code | Integer | 1000 for a successful query. |
| msg | String | Response message. |
| data | Object | Task detail, including the task fields returned by creation. |
| - _id | String | Stable local task ID used for this query. |
| - task_id | String | Downstream algorithm/provider task ID; may be empty until submission. Use _id, not this value, for task-detail queries. It may change between workflow stages. |
| - status | Integer | 1 = queueing, 2 = processing, 3 = completed, 4 = failed. |
| - url | String | Output URL, available after completion. |
| - progress | Number | Processing progress, when available. |
| - error_reason | String | Failure reason, when available. |
| - multi_shot_results | Array | Additional hairstyle views; empty for other operations. |
cURL
curl --location 'https://openapi.akool.com/api/open/v5/hairswap/task/detail?_id=670000000000000000000002' \
--header 'x-api-key: {{API Key}}'
url field may be empty before completion. Use it only when status is 3. Poll until status is 3 or 4. A query with code: 1000 may still describe a failed generation task; inspect data.status and data.error_reason.
For input limits, billing, callbacks, and error codes, see the Hair Swap V5 overview.
Authorizations
ApiKeyAuthBearerAuth
Query Parameters
Stable task data.list[]._id returned by create, not downstream task_id; the record must belong to your user/team.
Pattern:
^[a-fA-F0-9]{24}$