curl --request POST \
--url https://openapi.akool.com/api/open/v3/avatar/create \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"url": "https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4",
"avatar_id": "HHdEKhn7k7vVBlR5FSi0e",
"name": "My Streaming Avatar",
"type": 2,
"url_from": 1
}
'import requests
url = "https://openapi.akool.com/api/open/v3/avatar/create"
payload = {
"url": "https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4",
"avatar_id": "HHdEKhn7k7vVBlR5FSi0e",
"name": "My Streaming Avatar",
"type": 2,
"url_from": 1
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4',
avatar_id: 'HHdEKhn7k7vVBlR5FSi0e',
name: 'My Streaming Avatar',
type: 2,
url_from: 1
})
};
fetch('https://openapi.akool.com/api/open/v3/avatar/create', 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/v3/avatar/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4',
'avatar_id' => 'HHdEKhn7k7vVBlR5FSi0e',
'name' => 'My Streaming Avatar',
'type' => 2,
'url_from' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openapi.akool.com/api/open/v3/avatar/create"
payload := strings.NewReader("{\n \"url\": \"https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4\",\n \"avatar_id\": \"HHdEKhn7k7vVBlR5FSi0e\",\n \"name\": \"My Streaming Avatar\",\n \"type\": 2,\n \"url_from\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://openapi.akool.com/api/open/v3/avatar/create")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4\",\n \"avatar_id\": \"HHdEKhn7k7vVBlR5FSi0e\",\n \"name\": \"My Streaming Avatar\",\n \"type\": 2,\n \"url_from\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi.akool.com/api/open/v3/avatar/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4\",\n \"avatar_id\": \"HHdEKhn7k7vVBlR5FSi0e\",\n \"name\": \"My Streaming Avatar\",\n \"type\": 2,\n \"url_from\": 1\n}"
response = http.request(request)
puts response.read_body{
"code": 1000,
"msg": "ok",
"data": {
"_id": "655ffeada6976ea317087193",
"disabled": false,
"uid": 1,
"type": 2,
"from": 2,
"status": 1,
"sort": 12,
"create_time": 1700788730000,
"name": "Yasmin in White shirt",
"avatar_id": "Yasmin_in_White_shirt_20231121",
"url": "https://drz0f01yeq1cx.cloudfront.net/1700786304161-b574407f-f926-4b3e-bba7-dc77d1742e60-8169.png",
"modify_url": "https://drz0f01yeq1cx.cloudfront.net/1700786304161-b574407f-f926-4b3e-bba7-dc77d1742e60-8169.png",
"gender": "female",
"thumbnailUrl": "https://drz0f01yeq1cx.cloudfront.net/avatar/thumbnail/1700786304161-b574407f-f926-4b3e-bba7-dc77d1742e60-8169.png",
"crop_arr": []
}
}Upload Streaming Avatar
Create a new streaming avatar from a video URL
curl --request POST \
--url https://openapi.akool.com/api/open/v3/avatar/create \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"url": "https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4",
"avatar_id": "HHdEKhn7k7vVBlR5FSi0e",
"name": "My Streaming Avatar",
"type": 2,
"url_from": 1
}
'import requests
url = "https://openapi.akool.com/api/open/v3/avatar/create"
payload = {
"url": "https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4",
"avatar_id": "HHdEKhn7k7vVBlR5FSi0e",
"name": "My Streaming Avatar",
"type": 2,
"url_from": 1
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4',
avatar_id: 'HHdEKhn7k7vVBlR5FSi0e',
name: 'My Streaming Avatar',
type: 2,
url_from: 1
})
};
fetch('https://openapi.akool.com/api/open/v3/avatar/create', 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/v3/avatar/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4',
'avatar_id' => 'HHdEKhn7k7vVBlR5FSi0e',
'name' => 'My Streaming Avatar',
'type' => 2,
'url_from' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openapi.akool.com/api/open/v3/avatar/create"
payload := strings.NewReader("{\n \"url\": \"https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4\",\n \"avatar_id\": \"HHdEKhn7k7vVBlR5FSi0e\",\n \"name\": \"My Streaming Avatar\",\n \"type\": 2,\n \"url_from\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://openapi.akool.com/api/open/v3/avatar/create")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4\",\n \"avatar_id\": \"HHdEKhn7k7vVBlR5FSi0e\",\n \"name\": \"My Streaming Avatar\",\n \"type\": 2,\n \"url_from\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi.akool.com/api/open/v3/avatar/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4\",\n \"avatar_id\": \"HHdEKhn7k7vVBlR5FSi0e\",\n \"name\": \"My Streaming Avatar\",\n \"type\": 2,\n \"url_from\": 1\n}"
response = http.request(request)
puts response.read_body{
"code": 1000,
"msg": "ok",
"data": {
"_id": "655ffeada6976ea317087193",
"disabled": false,
"uid": 1,
"type": 2,
"from": 2,
"status": 1,
"sort": 12,
"create_time": 1700788730000,
"name": "Yasmin in White shirt",
"avatar_id": "Yasmin_in_White_shirt_20231121",
"url": "https://drz0f01yeq1cx.cloudfront.net/1700786304161-b574407f-f926-4b3e-bba7-dc77d1742e60-8169.png",
"modify_url": "https://drz0f01yeq1cx.cloudfront.net/1700786304161-b574407f-f926-4b3e-bba7-dc77d1742e60-8169.png",
"gender": "female",
"thumbnailUrl": "https://drz0f01yeq1cx.cloudfront.net/avatar/thumbnail/1700786304161-b574407f-f926-4b3e-bba7-dc77d1742e60-8169.png",
"crop_arr": []
}
}Authorizations
Your API Key used for request authorization. If both Authorization and x-api-key have values, Authorization will be used first and x-api-key will be discarded.
Body
Avatar resource link. It is recommended that the video be about one minute long, and the avatar in the video content should rotate at a small angle and be clear.
Avatar unique ID, can only contain alphanumeric characters
^[a-zA-Z0-9]+$Avatar display name for easier identification and management
Avatar type 2 represents stream avatar. When type is 2, you need to wait until status is 3 before you can use it. You can get the current status in real time through the Get Avatar Detail API.
2 URL source, 1 means akool and other links, 2 means other third-party links (currently only supports YouTube / TikTok / X / Google Drive)
1, 2