Close Session
curl --request POST \
--url https://openapi.akool.com/api/open/v4/liveAvatar/session/close \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"id": "6698c9d69cf7b0d61d1b6420"
}
'import requests
url = "https://openapi.akool.com/api/open/v4/liveAvatar/session/close"
payload = { "id": "6698c9d69cf7b0d61d1b6420" }
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({id: '6698c9d69cf7b0d61d1b6420'})
};
fetch('https://openapi.akool.com/api/open/v4/liveAvatar/session/close', 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/v4/liveAvatar/session/close",
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([
'id' => '6698c9d69cf7b0d61d1b6420'
]),
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/v4/liveAvatar/session/close"
payload := strings.NewReader("{\n \"id\": \"6698c9d69cf7b0d61d1b6420\"\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/v4/liveAvatar/session/close")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"6698c9d69cf7b0d61d1b6420\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi.akool.com/api/open/v4/liveAvatar/session/close")
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 \"id\": \"6698c9d69cf7b0d61d1b6420\"\n}"
response = http.request(request)
puts response.read_body{
"code": 1000,
"msg": "OK"
}API Endpoints
Close Session
Close an active streaming avatar session
POST
/
api
/
open
/
v4
/
liveAvatar
/
session
/
close
Close Session
curl --request POST \
--url https://openapi.akool.com/api/open/v4/liveAvatar/session/close \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"id": "6698c9d69cf7b0d61d1b6420"
}
'import requests
url = "https://openapi.akool.com/api/open/v4/liveAvatar/session/close"
payload = { "id": "6698c9d69cf7b0d61d1b6420" }
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({id: '6698c9d69cf7b0d61d1b6420'})
};
fetch('https://openapi.akool.com/api/open/v4/liveAvatar/session/close', 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/v4/liveAvatar/session/close",
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([
'id' => '6698c9d69cf7b0d61d1b6420'
]),
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/v4/liveAvatar/session/close"
payload := strings.NewReader("{\n \"id\": \"6698c9d69cf7b0d61d1b6420\"\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/v4/liveAvatar/session/close")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"6698c9d69cf7b0d61d1b6420\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi.akool.com/api/open/v4/liveAvatar/session/close")
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 \"id\": \"6698c9d69cf7b0d61d1b6420\"\n}"
response = http.request(request)
puts response.read_body{
"code": 1000,
"msg": "OK"
}Both the avatar_id and voice_id can be easily obtained by copying them directly from the web interface. You can also create and manage your streaming avatars using our intuitive web platform.Create and manage your avatars at: https://akool.com/apps/upload/avatar?from=%2Fapps%2Fstreaming-avatar%2Fedit
Code Examples
curl -X POST --location "https://openapi.akool.com/api/open/v4/liveAvatar/session/close" \
-H "Authorization: Bearer your_token_here" \
-H "Content-Type: application/json" \
-d '{
"session_id": "session_123456789"
}'
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"session_id\": \"session_123456789\"\n}");
Request request = new Request.Builder()
.url("https://openapi.akool.com/api/open/v4/liveAvatar/session/close")
.method("POST", body)
.addHeader("Authorization", "Bearer your_token_here")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
const myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer your_token_here");
myHeaders.append("Content-Type", "application/json");
const raw = JSON.stringify({
"session_id": "session_123456789"
});
fetch("https://openapi.akool.com/api/open/v4/liveAvatar/session/close", {
method: "POST",
headers: myHeaders,
body: raw
})
.then(response => response.text())
.then(result => console.log(result));
<?php
$client = new Client();
$headers = [
'Authorization' => 'Bearer your_token_here',
'Content-Type' => 'application/json'
];
$body = '{
"session_id": "session_123456789"
}';
$request = new Request('POST', 'https://openapi.akool.com/api/open/v4/liveAvatar/session/close', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
?>
import requests
import json
url = "https://openapi.akool.com/api/open/v4/liveAvatar/session/close"
payload = json.dumps({
"session_id": "session_123456789"
})
headers = {
'Authorization': 'Bearer your_token_here',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Response Example
{
"code": 1000,
"msg": "ok",
"data": {
"session_id": "session_123456789",
"status": "closed",
"closed_at": 1700788730000
}
}
Authorizations
ApiKeyAuthBearerAuth
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
application/json
Session ID from the _id field returned by Create Session
⌘I