Create realtime session
curl --request POST \
--url https://app.nicecall.ai/api/user/realtime/session \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assistant_id": "<string>",
"variables": {},
"external_identifier": "<string>"
}
'import requests
url = "https://app.nicecall.ai/api/user/realtime/session"
payload = {
"assistant_id": "<string>",
"variables": {},
"external_identifier": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({assistant_id: '<string>', variables: {}, external_identifier: '<string>'})
};
fetch('https://app.nicecall.ai/api/user/realtime/session', 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://app.nicecall.ai/api/user/realtime/session",
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([
'assistant_id' => '<string>',
'variables' => [
],
'external_identifier' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.nicecall.ai/api/user/realtime/session"
payload := strings.NewReader("{\n \"assistant_id\": \"<string>\",\n \"variables\": {},\n \"external_identifier\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://app.nicecall.ai/api/user/realtime/session")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"assistant_id\": \"<string>\",\n \"variables\": {},\n \"external_identifier\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.nicecall.ai/api/user/realtime/session")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"assistant_id\": \"<string>\",\n \"variables\": {},\n \"external_identifier\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyRealtime
Create realtime session
Create realtime session with the Nicecall API.
POST
/
user
/
realtime
/
session
Create realtime session
curl --request POST \
--url https://app.nicecall.ai/api/user/realtime/session \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assistant_id": "<string>",
"variables": {},
"external_identifier": "<string>"
}
'import requests
url = "https://app.nicecall.ai/api/user/realtime/session"
payload = {
"assistant_id": "<string>",
"variables": {},
"external_identifier": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({assistant_id: '<string>', variables: {}, external_identifier: '<string>'})
};
fetch('https://app.nicecall.ai/api/user/realtime/session', 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://app.nicecall.ai/api/user/realtime/session",
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([
'assistant_id' => '<string>',
'variables' => [
],
'external_identifier' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.nicecall.ai/api/user/realtime/session"
payload := strings.NewReader("{\n \"assistant_id\": \"<string>\",\n \"variables\": {},\n \"external_identifier\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://app.nicecall.ai/api/user/realtime/session")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"assistant_id\": \"<string>\",\n \"variables\": {},\n \"external_identifier\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.nicecall.ai/api/user/realtime/session")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"assistant_id\": \"<string>\",\n \"variables\": {},\n \"external_identifier\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyCreate a short-lived browser voice session from your backend. Use the returned URL and token with the Realtime Voice SDK.
The response includes
curl --request POST 'https://app.nicecall.ai/api/user/realtime/session' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{"assistant_id":"9c1f8e2a-4d3b-4a17-9f6e-2b5c8d0a7e31"}'
url, token, and expires_in in seconds. Send the browser only the session credentials it needs. Limit creation to 10 requests per minute per API key and 10 concurrent sessions per account, including widget sessions.
