Create embed context
curl --request POST \
--url https://platform.perso.ai/api/console/b2c/contexts/ \
--header 'Content-Type: application/json' \
--header 'PersoPlatform-APIKey: <api-key>' \
--data '
{
"name": "<string>",
"tts_type": "<string>",
"model_style": "<string>",
"greeting": "<string>",
"instructions": "<string>",
"background_image": "<string>",
"max_session_sec": 1073741823,
"is_active": true,
"embed_config": "<unknown>"
}
'import requests
url = "https://platform.perso.ai/api/console/b2c/contexts/"
payload = {
"name": "<string>",
"tts_type": "<string>",
"model_style": "<string>",
"greeting": "<string>",
"instructions": "<string>",
"background_image": "<string>",
"max_session_sec": 1073741823,
"is_active": True,
"embed_config": "<unknown>"
}
headers = {
"PersoPlatform-APIKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'PersoPlatform-APIKey': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
tts_type: '<string>',
model_style: '<string>',
greeting: '<string>',
instructions: '<string>',
background_image: '<string>',
max_session_sec: 1073741823,
is_active: true,
embed_config: '<unknown>'
})
};
fetch('https://platform.perso.ai/api/console/b2c/contexts/', 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://platform.perso.ai/api/console/b2c/contexts/",
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([
'name' => '<string>',
'tts_type' => '<string>',
'model_style' => '<string>',
'greeting' => '<string>',
'instructions' => '<string>',
'background_image' => '<string>',
'max_session_sec' => 1073741823,
'is_active' => true,
'embed_config' => '<unknown>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"PersoPlatform-APIKey: <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://platform.perso.ai/api/console/b2c/contexts/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"tts_type\": \"<string>\",\n \"model_style\": \"<string>\",\n \"greeting\": \"<string>\",\n \"instructions\": \"<string>\",\n \"background_image\": \"<string>\",\n \"max_session_sec\": 1073741823,\n \"is_active\": true,\n \"embed_config\": \"<unknown>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("PersoPlatform-APIKey", "<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://platform.perso.ai/api/console/b2c/contexts/")
.header("PersoPlatform-APIKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"tts_type\": \"<string>\",\n \"model_style\": \"<string>\",\n \"greeting\": \"<string>\",\n \"instructions\": \"<string>\",\n \"background_image\": \"<string>\",\n \"max_session_sec\": 1073741823,\n \"is_active\": true,\n \"embed_config\": \"<unknown>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.perso.ai/api/console/b2c/contexts/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["PersoPlatform-APIKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"tts_type\": \"<string>\",\n \"model_style\": \"<string>\",\n \"greeting\": \"<string>\",\n \"instructions\": \"<string>\",\n \"background_image\": \"<string>\",\n \"max_session_sec\": 1073741823,\n \"is_active\": true,\n \"embed_config\": \"<unknown>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"context_id": "<string>",
"name": "<string>",
"tts_type": "<string>",
"model_style": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"greeting": "<string>",
"instructions": "<string>",
"background_image": "<string>",
"max_session_sec": 1073741823,
"is_active": true,
"embed_config": "<unknown>"
}Embed
Create embed context
Creates a new embed context from an avatar (model style), voice, background, and prompt. The response includes the context’s id (used to manage it via this API) and its context_id (the public key the embed snippet uses to launch the widget).
POST
/
api
/
console
/
b2c
/
contexts
/
Create embed context
curl --request POST \
--url https://platform.perso.ai/api/console/b2c/contexts/ \
--header 'Content-Type: application/json' \
--header 'PersoPlatform-APIKey: <api-key>' \
--data '
{
"name": "<string>",
"tts_type": "<string>",
"model_style": "<string>",
"greeting": "<string>",
"instructions": "<string>",
"background_image": "<string>",
"max_session_sec": 1073741823,
"is_active": true,
"embed_config": "<unknown>"
}
'import requests
url = "https://platform.perso.ai/api/console/b2c/contexts/"
payload = {
"name": "<string>",
"tts_type": "<string>",
"model_style": "<string>",
"greeting": "<string>",
"instructions": "<string>",
"background_image": "<string>",
"max_session_sec": 1073741823,
"is_active": True,
"embed_config": "<unknown>"
}
headers = {
"PersoPlatform-APIKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'PersoPlatform-APIKey': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
tts_type: '<string>',
model_style: '<string>',
greeting: '<string>',
instructions: '<string>',
background_image: '<string>',
max_session_sec: 1073741823,
is_active: true,
embed_config: '<unknown>'
})
};
fetch('https://platform.perso.ai/api/console/b2c/contexts/', 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://platform.perso.ai/api/console/b2c/contexts/",
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([
'name' => '<string>',
'tts_type' => '<string>',
'model_style' => '<string>',
'greeting' => '<string>',
'instructions' => '<string>',
'background_image' => '<string>',
'max_session_sec' => 1073741823,
'is_active' => true,
'embed_config' => '<unknown>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"PersoPlatform-APIKey: <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://platform.perso.ai/api/console/b2c/contexts/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"tts_type\": \"<string>\",\n \"model_style\": \"<string>\",\n \"greeting\": \"<string>\",\n \"instructions\": \"<string>\",\n \"background_image\": \"<string>\",\n \"max_session_sec\": 1073741823,\n \"is_active\": true,\n \"embed_config\": \"<unknown>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("PersoPlatform-APIKey", "<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://platform.perso.ai/api/console/b2c/contexts/")
.header("PersoPlatform-APIKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"tts_type\": \"<string>\",\n \"model_style\": \"<string>\",\n \"greeting\": \"<string>\",\n \"instructions\": \"<string>\",\n \"background_image\": \"<string>\",\n \"max_session_sec\": 1073741823,\n \"is_active\": true,\n \"embed_config\": \"<unknown>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.perso.ai/api/console/b2c/contexts/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["PersoPlatform-APIKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"tts_type\": \"<string>\",\n \"model_style\": \"<string>\",\n \"greeting\": \"<string>\",\n \"instructions\": \"<string>\",\n \"background_image\": \"<string>\",\n \"max_session_sec\": 1073741823,\n \"is_active\": true,\n \"embed_config\": \"<unknown>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"context_id": "<string>",
"name": "<string>",
"tts_type": "<string>",
"model_style": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"greeting": "<string>",
"instructions": "<string>",
"background_image": "<string>",
"max_session_sec": 1073741823,
"is_active": true,
"embed_config": "<unknown>"
}Authorizations
PersoPlatform-APIKeycookieAuth
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
Console serializer for Context CRUD.
Required string length:
1 - 200Minimum string length:
1Minimum string length:
1Minimum string length:
1Required range:
0 <= x <= 2147483647Response
201 - application/json
Console serializer for Context CRUD.
Maximum string length:
200Required range:
0 <= x <= 2147483647⌘I

