Use this endpoint to end a Form filling session created with live WebSocket audio and start structured form processing.Ending a Form filling session closes that capture so Suki can finish form processing but it does not close the patient encounter. If the visit requires additional capture, create another Form filling session for the same encounter. Use your Form filling ambient_session_id to end the session.
Call this endpoint only for sessions created with input_type: "stream" or when input_type is omitted (the default). For other input types, processing starts automatically when you provide the input:
audio_file: Processing starts after you successfully upload the WAV file using the Presigned upload URL.
Do not call this endpoint to start processing for these input types. For any input type, seed at least one template or schema in Form filling session context before processing starts.
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 Anyimport requestsBASE_URL = "https://sdp.suki-stage.com"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 = urldef _post_expect_json_object(url: str, headers: dict[str, str], expect_status: int) -> dict[str, Any]: r = requests.post(url, 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 end_form_filling_session(suki_token: str, ambient_session_id: str) -> None: """POST /api/v1/form-filling/session/{ambient_session_id}/end (sdp_suki_token header required). HTTP 200. Use only for stream sessions (input_type "stream" or omitted). Do not call end for audio_file or transcript sessions. """ url = f"{BASE_URL}/api/v1/form-filling/session/{ambient_session_id}/end" headers = {"sdp_suki_token": suki_token, "sdp_provider_id": "<sdp_provider_id>"} _post_expect_json_object(url, headers, 200)if __name__ == "__main__": try: end_form_filling_session("YOUR_SUKI_TOKEN", "YOUR_AMBIENT_SESSION_ID") print("Session ended.") except (ApiHttpError, ValueError) as e: print(e)
const BASE_URL = "https://sdp.suki-stage.com";class ApiHttpError extends Error { status: number; url: string; constructor(status: number, url: string, detail: string) { super(`HTTP ${status} ${url}: ${detail}`); this.status = status; this.url = url; }}async function postExpectJsonObject(url: string, headers: Record<string, string>, expectStatus: number) { const res = await fetch(url, { method: "POST", headers }); const text = await res.text(); const json = text ? JSON.parse(text) : {}; if (res.status !== expectStatus) { const msg = typeof json?.message === "string" ? json.message : text?.slice(0, 500) || "(no body)"; throw new ApiHttpError(res.status, url, msg); } if (json && typeof json === "object" && !Array.isArray(json)) return json as Record<string, unknown>; throw new ApiHttpError(res.status, url, "response JSON was not an object");}/** Use only for stream sessions (input_type "stream" or omitted). Do not call end for audio_file or transcript. */export async function endFormFillingSession(sukiToken: string, ambientSessionId: string): Promise<void> { const url = `${BASE_URL}/api/v1/form-filling/session/${ambientSessionId}/end`; await postExpectJsonObject(url, { sdp_suki_token: sukiToken, sdp_provider_id: "<sdp_provider_id>" }, 200);}// Example usageawait endFormFillingSession("YOUR_SUKI_TOKEN", "YOUR_AMBIENT_SESSION_ID");console.log("Session ended.");
Endpoint reference
Authorizations
sdp_suki_token
string
header
required
Suki access token (suki_token) from Login or Register. Expires after one hour.
Headers
sdp_provider_id
string
Optional for standard partners.
Required for:
Bearer authentication. Use the same provider_id returned by the Login or Register API.
Single Auth Token authentication. Include the same provider_id on every request as sdp_provider_id.
Example:
"provider-123"
Path Parameters
ambient_session_id
string
required
Form-filling session ID. The path parameter is named ambient_session_id, but this value identifies the form-filling session, not an ambient clinical documentation session. Use the ID returned from Create Form filling Session, or the UUID you supplied in that request.