Exchange Session SDP
curl --request POST \
--url https://platform.perso.ai/api/v1/session/{session_id}/exchange/ \
--header 'Content-Type: application/json' \
--data '
{
"client_sdp": "<unknown>"
}
'import requests
url = "https://platform.perso.ai/api/v1/session/{session_id}/exchange/"
payload = { "client_sdp": "<unknown>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({client_sdp: '<unknown>'})
};
fetch('https://platform.perso.ai/api/v1/session/{session_id}/exchange/', 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/v1/session/{session_id}/exchange/",
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([
'client_sdp' => '<unknown>'
]),
CURLOPT_HTTPHEADER => [
"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://platform.perso.ai/api/v1/session/{session_id}/exchange/"
payload := strings.NewReader("{\n \"client_sdp\": \"<unknown>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/session/{session_id}/exchange/")
.header("Content-Type", "application/json")
.body("{\n \"client_sdp\": \"<unknown>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.perso.ai/api/v1/session/{session_id}/exchange/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"client_sdp\": \"<unknown>\"\n}"
response = http.request(request)
puts response.read_body{
"client_sdp": "<unknown>",
"server_sdp": null
}Session Lifecycle
Exchange Session SDP
Exchange WebRTC Session Description Protocol (SDP) to establish a peer connection.
How It Works
- Client generates an SDP offer using WebRTC APIs
- Send the offer to this endpoint
- Receive the server’s SDP answer
- Use the answer to complete the WebRTC connection
Request Format
The client_sdp object must contain:
type: Must be"offer"sdp: The SDP string from your WebRTC offer
Example
Select “ExchangeSessionRequest” from the Examples dropdown to see the request format.
POST
/
api
/
v1
/
session
/
{session_id}
/
exchange
/
Exchange Session SDP
curl --request POST \
--url https://platform.perso.ai/api/v1/session/{session_id}/exchange/ \
--header 'Content-Type: application/json' \
--data '
{
"client_sdp": "<unknown>"
}
'import requests
url = "https://platform.perso.ai/api/v1/session/{session_id}/exchange/"
payload = { "client_sdp": "<unknown>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({client_sdp: '<unknown>'})
};
fetch('https://platform.perso.ai/api/v1/session/{session_id}/exchange/', 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/v1/session/{session_id}/exchange/",
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([
'client_sdp' => '<unknown>'
]),
CURLOPT_HTTPHEADER => [
"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://platform.perso.ai/api/v1/session/{session_id}/exchange/"
payload := strings.NewReader("{\n \"client_sdp\": \"<unknown>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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/v1/session/{session_id}/exchange/")
.header("Content-Type", "application/json")
.body("{\n \"client_sdp\": \"<unknown>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://platform.perso.ai/api/v1/session/{session_id}/exchange/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"client_sdp\": \"<unknown>\"\n}"
response = http.request(request)
puts response.read_body{
"client_sdp": "<unknown>",
"server_sdp": null
}Path Parameters
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
WebRTC SDP offer produced by the client; the server responds with server_sdp.
⌘I

