SukiAuthManager and FormFillingClient once, then call client.start() when the clinician opens Form filling.
Prerequisites
Before you start:- Install
@suki-sdk/form-fillingand@suki-sdk/core(Form filling SDK v0.1.0-beta.3 or later for dynamic forms). - Get your
partnerIdfrom Partner onboarding. Pass apartnerToken(JWT from your identity provider) with that Partner ID to sign in. - Decide which forms to fill: Suki Medical form templates (ask Suki support for the template IDs), your own form
schema, or both. See Dynamic Form filling. - Have an encounter ID ready to pass as
correlation_id. - Run the app over HTTPS, with microphone access, and a container with height for the Form filling UI.
Integration pattern
Create auth and the client once per page. Open Form filling only when the clinician taps your button.Suki Auth Manager
One
SukiAuthManager after the partner token is available.Form Filling Client
One
FormFillingClient. Reuse it for every start() call on that page.Install the packages
Step 1: Add container HTML
The hosted Form filling UI mounts inside the element you pass asrootElement. That node must have real height, or the iframe looks blank.
HTML
Step 2: Create auth manager
Create oneSukiAuthManager to sign in to Suki. Use the following example code:
JavaScript
Step 3: Create Form filling client
Create oneFormFillingClient and pass the auth manager. Optionally wire onError for configuration and runtime errors.
JavaScript
Step 4: Start a session on user action
When the clinician taps your button, callawait client.start({ ... }) from a click handler after the DOM is ready.
Pass these options to start():
rootElement: Required The container from Step 1.formsorform_template_ids: Required At least one form after resolve. Preferformsfor Suki template IDs, your ownschema, or both.form_template_idsis deprecated, but still works whenformsis omitted.correlation_id: Optional Your encounter or appointment ID. Strongly recommended so results map to the correct record.onSubmit: Required Called when structured JSON is ready after processing, not when the clinician taps submit. Receives aFormFillingResult.onReady,onCancel: Optional.
JavaScript
Callbacks and events
Your app needs to know when Form filling is ready, when structured results arrive, and when the clinician cancels. You can handle that in two ways. Option 1: Pass callbacks onstart()
Use this for logic tied to one session. Pass functions on the same object as rootElement and forms:
Option 2: Listen with
client.on()
Use this for handlers that stay active across many sessions, such as logging, analytics, or a shared error handler. Register once when you create the client:
JavaScript
form-filling:session-started, form-filling:background-submitted (results for a superseded session), and form-filling:error.
Refer to Callbacks for FormFillingResult shape and Events for every event and payload.
Starting another session
When the clinician opens Form filling again, callstart() a second time. The SDK closes the previous session and opens a new one. You do not need stop() first.
Complete code example
Below is a full page example: sign-in, client setup, and a button that opens Form filling.JavaScript
onSubmit returns structured_data.
Best practices
Troubleshooting
Blank UI After start()
Blank UI After start()
Set height on
#suki-form-container before start(). Add CSP frame-src for https://sdk.suki.ai (production) or https://sdk.suki-stage.com (staging). Refer to Configuration and Prerequisites.SUKI_FF_001 Immediately
SUKI_FF_001 Immediately
No forms after resolve, invalid XOR entries, duplicate IDs, or no matching static IDs with no valid dynamic entries. Prefer
forms. Refer to Error handling and Dynamic Form filling.SUKI_FF_002 Handshake Timeout
SUKI_FF_002 Handshake Timeout
The iframe did not complete the ready handshake within 10 seconds. Check network, ad blockers, and CSP. Confirm the page uses HTTPS.
SUKI_FF_003 Fetch Templates Failed
SUKI_FF_003 Fetch Templates Failed
Auth failed or the wrong environment (staging vs production) while loading the template list. Retry and confirm
partnerId, partnerToken, and environment.SUKI_FF_004 Iframe Runtime Error
SUKI_FF_004 Iframe Runtime Error
Microphone permission denied, session start/submit failed, or form generation failed. Read
err.message, show a retry option, and confirm network access.UI Never Opens
UI Never Opens
Sign-in failed before the hosted UI loads. Verify
partnerId and partnerToken for your environment. Refer to Authentication.No onSubmit Callback
No onSubmit Callback
The clinician closed the processing screen early, or the tab closed before processing finished. Register a partner webhook for server-side delivery.
onSubmit Never Maps to Your Encounter
onSubmit Never Maps to Your Encounter
Pass your encounter ID as
correlation_id at session start so callbacks and webhooks match the correct record.Log Errors During Development
Log Errors During Development
Wire
onError or client.on("form-filling:error", ...) so errors are visible in the console:JavaScript
Refer to Error handling for the full error code table.
Next steps
Session workflow - Single-form vs multi-form behavior. Configuration - Allstart() options.
React integration - If you use React.