Form Filling Audio Streaming
WebSocket endpoint for streaming visit audio during Form filling sessions
curl --request GET \
--url https://sdp.suki.ai/ws/stream \
--header 'sdp_suki_token: <sdp_suki_token>' \
--header 'sdp_provider_id: <sdp_provider_id>' \
--header 'ambient_session_id: <ambient_session_id>'import requests
url = "https://sdp.suki.ai/ws/stream"
headers = {
"ambient_session_id": "<ambient_session_id>",
"sdp_suki_token": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {ambient_session_id: '<ambient_session_id>', sdp_suki_token: '<api-key>'}
};
fetch('https://sdp.suki.ai/ws/stream', 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://sdp.suki.ai/ws/stream",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"ambient_session_id: <ambient_session_id>",
"sdp_suki_token: <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"
"net/http"
"io"
)
func main() {
url := "https://sdp.suki.ai/ws/stream"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("ambient_session_id", "<ambient_session_id>")
req.Header.Add("sdp_suki_token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sdp.suki.ai/ws/stream")
.header("ambient_session_id", "<ambient_session_id>")
.header("sdp_suki_token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sdp.suki.ai/ws/stream")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["ambient_session_id"] = '<ambient_session_id>'
request["sdp_suki_token"] = '<api-key>'
response = http.request(request)
puts response.read_body"<string>""<string>""<string>""<string>""<string>""<string>"GET /ws/stream) for Form filling sessions.
Related guides
Stream Ambient Audio Overview
Ambient Streaming Wire Format
Complete the Ambient Session after Streaming
ambient_session_id returned by Create Form filling session in the WebSocket handshake.Do not reuse an ambient_session_id from Create ambient session. Both APIs return a field named ambient_session_id, but each ID belongs to a different product session and is not interchangeable.Prerequisites
Complete these steps before you open the WebSocket./ws/stream before the session and context are ready can cause handshake failures or a broken stream.- Authenticate and obtain
sdp_suki_token. - Create a Form filling session with POST
/api/v1/form-filling/session/create. Save theambient_session_idfrom the 201 Created response. - Seed session context (recommended) with POST
/api/v1/form-filling/session/{ambient_session_id}/context. Includeform_template_idvalues when you send context. - Open the WebSocket at
wss://sdp.suki-stage.com/ws/stream(staging) orwss://sdp.suki.ai/ws/stream(production). Use your Form fillingambient_session_idin the handshake.
Browser clients
SendSec-WebSocket-Protocol during the handshake as one comma-separated string, in this order:
- Subprotocol name.
sdp_suki_token.- Form filling session ID (
ambient_session_id).
Sec-WebSocket-Protocol: SukiAmbientAuth,<sdp_suki_token>,<ambient_session_id>
Non-browser clients
For mobile apps, backend services, or testing tools, pass headers on the WebSocket upgrade request. Do not useSec-WebSocket-Protocol.
sdp_suki_token- Session token from login.sdp_provider_id- Provider identifier. Optional for standard partners; required for Single Auth Token authentication.ambient_session_id- Form filling session ID from Create Form filling session.
Full code examples
For end-to-end Form filling streaming examples, start with these tutorials:Authorizations
Suki access token (suki_token) from Login or Register. Expires after one hour.
Headers
Required FOR BROWSER CLIENTS ONLY. Sent during WebSocket handshake. Browsers must use the same subprotocol the grpc-wsproxy maps to Authorization: 'SukiAmbientAuth,<sdp_suki_token>,<ambient_session_id>' (comma-separated; token second, ambient session id third). Other subprotocol names are not mapped and typically yield 401.
Required for non-browser clients only. Session UUID from Create Ambient Session or Create Form filling Session.
Optional for standard partners.
Required for:
- Bearer authentication. Use the same
provider_idreturned by the Login or Register API. - Single Auth Token authentication. Include the same
provider_idon every request assdp_provider_id.
"provider-123"
Response
Switching Protocols - Indicates successful WebSocket handshake.
The response is of type string.
Was this page helpful?
curl --request GET \
--url https://sdp.suki.ai/ws/stream \
--header 'sdp_suki_token: <sdp_suki_token>' \
--header 'sdp_provider_id: <sdp_provider_id>' \
--header 'ambient_session_id: <ambient_session_id>'import requests
url = "https://sdp.suki.ai/ws/stream"
headers = {
"ambient_session_id": "<ambient_session_id>",
"sdp_suki_token": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {ambient_session_id: '<ambient_session_id>', sdp_suki_token: '<api-key>'}
};
fetch('https://sdp.suki.ai/ws/stream', 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://sdp.suki.ai/ws/stream",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"ambient_session_id: <ambient_session_id>",
"sdp_suki_token: <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"
"net/http"
"io"
)
func main() {
url := "https://sdp.suki.ai/ws/stream"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("ambient_session_id", "<ambient_session_id>")
req.Header.Add("sdp_suki_token", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sdp.suki.ai/ws/stream")
.header("ambient_session_id", "<ambient_session_id>")
.header("sdp_suki_token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sdp.suki.ai/ws/stream")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["ambient_session_id"] = '<ambient_session_id>'
request["sdp_suki_token"] = '<api-key>'
response = http.request(request)
puts response.read_body"<string>""<string>""<string>""<string>""<string>""<string>"