Form Filling Session Management
Create Form Filling Session
Create a Form filling session and obtain a session identifier for subsequent calls
Listen to this pageabout 3 min
POST
/
api
/
v1
/
form-filling
/
session
/
create
cURL
curl --request POST \
--url https://sdp.suki.ai/api/v1/form-filling/session/create \
--header 'Content-Type: application/json' \
--header 'sdp_suki_token: <sdp_suki_token>' \
--header 'sdp_provider_id: <sdp_provider_id>' \
--data '{}'import requests
url = "https://sdp.suki.ai/api/v1/form-filling/session/create"
payload = {}
headers = {
"sdp_suki_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {sdp_suki_token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://sdp.suki.ai/api/v1/form-filling/session/create', 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/api/v1/form-filling/session/create",
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([
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sdp.suki.ai/api/v1/form-filling/session/create"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("sdp_suki_token", "<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://sdp.suki.ai/api/v1/form-filling/session/create")
.header("sdp_suki_token", "<api-key>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sdp.suki.ai/api/v1/form-filling/session/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["sdp_suki_token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"ambient_session_id": "123dfg-456dfg-789dfg-012dfg"
}{
"code": 400,
"message": "invalid request"
}{
"code": 401,
"message": "invalid token"
}{
"code": 500,
"message": "internal server error"
}Updated
- Multiple input types: You can now fill forms from live audio, a pre-recorded WAV file, or a completed transcript. Set the input type when you create the session. See Session input types, Get audio file upload URL, and Submit transcript input for details.
ambient_session_id: Identifies the Form filling session. Use it for session-level operations such as setting context, streaming audio, uploading a WAV, submitting a transcript, checking processing status, and retrieving structured form output.
Both Form filling and the Ambient APIs use the field name
ambient_session_id, but the values identify different sessions. Do not pass an Ambient API session ID here. Use only the Form filling ambient_session_id returned from this endpoint for Form filling REST calls and for /ws/stream.- To choose when to use live audio, a WAV upload, or completed transcript text, refer to Session input types.
- For the upload and transcript workflows, refer to Upload a pre-recorded audio file and Submit a finished transcript.
- For the full Form filling create, stream, end, and retrieve flow, refer to Form filling basic usage.
Request body fields
All request body fields are optional. You can create a Form filling session with an empty JSON body. If you do not provideambient_session_id, Suki generates one and returns it in the response.
If you omit input_type, the session defaults to stream, which uses live WebSocket audio.
Use the following fields to configure the session, correlate it in your systems, or choose how to provide the conversation.
| Field | Type | Details |
|---|---|---|
ambient_session_id | string (UUID) | Optional Identifies the Form filling session. If you provide a value, it must be a valid UUID. If omitted, Suki generates the ID and returns it in the response. Do not pass an Ambient clinical documentation session ID. |
correlation_id | string | Optional Client-supplied identifier for tracing or correlating the session in your own systems. |
input_type | string (stream, audio_file, or transcript) | Optional Specifies how the conversation is provided to the session. Omit this field or set it to stream for live WebSocket audio, then explicitly end the session. Set it to audio_file to upload one WAV file using Get audio file upload URL. Set it to transcript to submit completed transcript text using Submit transcript input. Those shared endpoints accept this Form filling ambient_session_id. Send input_type in the JSON request body only. Query parameters are ignored. The input type cannot be changed after the session is created. |
Choose an input type
Setinput_type based on how you provide the conversation to Suki. Each input type determines how Suki receives the data, when processing starts, and whether you need to explicitly end the session.
input_type | What you provide | When processing starts | Do you need to end the session? |
|---|---|---|---|
stream (default) | Live audio through the Audio streaming endpoint. | After you call End Form filling session. | Yes. |
audio_file | One WAV file uploaded using a Presigned upload URL. | After the file is successfully uploaded through a PUT request. | No. |
transcript | Completed transcript text submitted through the Transcript input endpoint. | After the transcript is successfully submitted. | No. |
Retrieve session results
Seed Form filling session context with at least one template or schema before processing starts. Once processing starts, the remaining workflow is the same for all three input types:- Check processing status by polling the status endpoint or receiving a webhook.
- Retrieve the structured form output.
- For
streamandaudio_file, you can retrieve the recording. - For
transcript, recording retrieval returns 404 because the session was created from transcript text rather than an audio recording.
Code examples
The code examples below use placeholders and the stage host
sdp.suki-stage.com only as examples.
For credentials, base URLs, where to run Python or TypeScript, CORS, and cURL, refer to Using code examples in your integration in the API Reference Guidelines.- Python
- TypeScript
from typing import Any, Optional, TypedDict, cast
import requests
BASE_URL = "https://sdp.suki-stage.com"
class CreateFormFillingSessionRequest(TypedDict, total=False):
ambient_session_id: str
correlation_id: str
input_type: str # "stream" | "audio_file" | "transcript"
class CreateFormFillingSessionResponse(TypedDict):
ambient_session_id: str
class ApiHttpError(RuntimeError):
"""Wrong HTTP status; OpenAPI errors usually include JSON with message + code."""
def __init__(self, status: int, url: str, detail: str) -> None:
super().__init__(f"HTTP {status} {url}: {detail}")
self.status = status
self.url = url
def _post_json_expect(url: str, headers: dict[str, str], payload: dict[str, Any], expect_status: int) -> dict[str, Any]:
r = requests.post(url, json=payload, headers=headers, timeout=60)
if r.status_code == expect_status:
data = r.json()
if isinstance(data, dict):
return data
raise ApiHttpError(expect_status, url, "response JSON was not an object")
detail = ""
try:
err = r.json()
if isinstance(err, dict) and isinstance(err.get("message"), str):
detail = err["message"]
except ValueError:
detail = (r.text or "")[:500]
raise ApiHttpError(r.status_code, url, detail or "(no body)")
def login_for_suki_token(partner_id: str, partner_token: str, *, provider_id: Optional[str] = None) -> str:
"""POST /api/v1/auth/login -> suki_token (HTTP 200)."""
url = f"{BASE_URL}/api/v1/auth/login"
body: dict[str, Any] = {"partner_id": partner_id, "partner_token": partner_token}
if provider_id is not None:
body["provider_id"] = provider_id
data = _post_json_expect(url, {"Content-Type": "application/json"}, body, 200)
token = data.get("suki_token")
if not isinstance(token, str) or not token:
raise ValueError(f"{url}: 200 response missing suki_token")
return token
def create_form_filling_session(
suki_token: str,
body: Optional[CreateFormFillingSessionRequest] = None,
) -> CreateFormFillingSessionResponse:
"""POST /api/v1/form-filling/session/create (sdp_suki_token header required). HTTP 201."""
url = f"{BASE_URL}/api/v1/form-filling/session/create"
headers = {"sdp_suki_token": suki_token, "sdp_provider_id": "<sdp_provider_id>", "Content-Type": "application/json"}
data = _post_json_expect(url, headers, dict(body or {}), 201)
sid = data.get("ambient_session_id")
if not isinstance(sid, str) or not sid:
raise ValueError(f"{url}: 201 response missing ambient_session_id")
return cast(CreateFormFillingSessionResponse, {"ambient_session_id": sid})
if __name__ == "__main__":
try:
token = login_for_suki_token("<partner_id>", "<partner_token>")
# Optional body fields: ambient_session_id, correlation_id, input_type.
# input_type: omit or "stream" (live audio), "audio_file" (WAV upload), or "transcript".
session = create_form_filling_session(token, {})
print(session["ambient_session_id"])
except (ApiHttpError, ValueError) as e:
print(e)
const BASE_URL = "https://sdp.suki-stage.com";
type AuthenticationRequest = {
partner_id: string;
partner_token: string;
provider_id?: string;
};
type AuthenticationResponse = { suki_token: string };
type CreateFormFillingSessionRequest = {
ambient_session_id?: string;
correlation_id?: string;
input_type?: "stream" | "audio_file" | "transcript";
};
type CreateFormFillingSessionResponse = { ambient_session_id: string };
/** POST helper: reads body once, checks status, returns parsed JSON object on success. */
async function postJsonExpect<T extends Record<string, unknown>>(
url: string,
init: RequestInit,
expectStatus: number,
): Promise<T> {
const res = await fetch(url, init);
const text = await res.text();
let data: unknown;
try {
data = text ? JSON.parse(text) : {};
} catch {
throw new Error(`HTTP ${res.status} ${url}: invalid JSON`);
}
if (res.status !== expectStatus) {
const msg =
data && typeof data === "object" && "message" in data
? String((data as { message?: string }).message)
: text.slice(0, 500);
throw new Error(`HTTP ${res.status} ${url}: ${msg || "(no body)"}`);
}
if (!data || typeof data !== "object") {
throw new Error(`${url}: expected JSON object`);
}
return data as T;
}
async function loginForSukiToken(body: AuthenticationRequest): Promise<string> {
const url = `${BASE_URL}/api/v1/auth/login`;
const data = await postJsonExpect<AuthenticationResponse>(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
}, 200);
if (!data.suki_token) throw new Error(`${url}: missing suki_token`);
return data.suki_token;
}
async function createFormFillingSession(
sukiToken: string,
body: CreateFormFillingSessionRequest = {},
): Promise<CreateFormFillingSessionResponse> {
const url = `${BASE_URL}/api/v1/form-filling/session/create`;
const data = await postJsonExpect<CreateFormFillingSessionResponse>(url, {
method: "POST",
headers: {
sdp_suki_token: sukiToken, sdp_provider_id: "<sdp_provider_id>",
"Content-Type": "application/json",
},
body: JSON.stringify(body),
}, 201);
if (!data.ambient_session_id) throw new Error(`${url}: missing ambient_session_id`);
return data;
}
async function main(): Promise<void> {
try {
const token = await loginForSukiToken({
partner_id: "<partner_id>",
partner_token: "<partner_token>",
});
// Optional body fields: ambient_session_id, correlation_id, input_type.
// input_type: omit or "stream" (live audio), "audio_file" (WAV upload), or "transcript".
const session = await createFormFillingSession(token, {});
console.log(session.ambient_session_id);
} catch (e) {
console.error(e instanceof Error ? e.message : e);
}
}
void main();
Endpoint reference
Authorizations
Headers
Body
application/json
Optional form-filling session ID and correlation metadata. Suki generates a form-filling session ID when omitted.
Optional - How you send visit content into this Form filling session. Omit or set stream for live WebSocket audio (default). Set audio_file to upload one pre-recorded WAV. Set transcript to submit finished transcript text. Send this field in the JSON body only. Query params are ignored. Fixed for the life of the session. Use the same upload and transcript-input endpoints as Ambient, with this Form filling ambient_session_id.
Available options:
stream, audio_file, transcript Example:
"stream"
Last modified on November 25, 2026
Was this page helpful?
cURL
curl --request POST \
--url https://sdp.suki.ai/api/v1/form-filling/session/create \
--header 'Content-Type: application/json' \
--header 'sdp_suki_token: <sdp_suki_token>' \
--header 'sdp_provider_id: <sdp_provider_id>' \
--data '{}'import requests
url = "https://sdp.suki.ai/api/v1/form-filling/session/create"
payload = {}
headers = {
"sdp_suki_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {sdp_suki_token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://sdp.suki.ai/api/v1/form-filling/session/create', 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/api/v1/form-filling/session/create",
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([
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sdp.suki.ai/api/v1/form-filling/session/create"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("sdp_suki_token", "<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://sdp.suki.ai/api/v1/form-filling/session/create")
.header("sdp_suki_token", "<api-key>")
.header("Content-Type", "application/json")
.body("{}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sdp.suki.ai/api/v1/form-filling/session/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["sdp_suki_token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{}"
response = http.request(request)
puts response.read_body{
"ambient_session_id": "123dfg-456dfg-789dfg-012dfg"
}{
"code": 400,
"message": "invalid request"
}{
"code": 401,
"message": "invalid token"
}{
"code": 500,
"message": "internal server error"
}