Skip to main content
This guide walks you through integrating the Form filling SDK in a JavaScript application. You create SukiAuthManager and FormFillingClient once, then call client.start() when the clinician opens Form filling.

Prerequisites

Before you start:
  • Install @suki-sdk/form-filling and @suki-sdk/core (Form filling SDK v0.1.0-beta.3 or later for dynamic forms).
  • Get your partnerId from Partner onboarding. Pass a partnerToken (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.
For webhooks and CSP, see Prerequisites.

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 as rootElement. That node must have real height, or the iframe looks blank.
HTML
Refer to Configuration for recommended CSS.

Step 2: Create auth manager

Create one SukiAuthManager to sign in to Suki. Use the following example code:
JavaScript
Refer to Authentication for provider fields and other sign-in options.

Step 3: Create Form filling client

Create one FormFillingClient 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, call await client.start({ ... }) from a click handler after the DOM is ready. Pass these options to start():
  • rootElement: Required The container from Step 1.
  • forms or form_template_ids: Required At least one form after resolve. Prefer forms for Suki template IDs, your own schema, or both. form_template_ids is deprecated, but still works when forms is 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 a FormFillingResult.
  • 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 on start() 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
Common events include 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, call start() 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
Your integration works when the Form filling UI appears, the microphone is active, and onSubmit returns structured_data.

Best practices

  • Reuse one client and one auth manager for the page. Do not create a new FormFillingClient on every click.
  • Pass onSubmit. It is required. Map structured_data.generated_values to your EHR or backend.
  • Pass correlation_id. Use your encounter ID so callbacks and webhooks match the correct record.
  • Register a partner webhook for production saves on your server, not browser onSubmit alone.
  • Give the container height before start(). Zero height is the most common cause of a blank UI.
  • Use template IDs from Suki support. The SDK validates IDs at start() and drops unsupported values.

Troubleshooting

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.
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.
The iframe did not complete the ready handshake within 10 seconds. Check network, ad blockers, and CSP. Confirm the page uses HTTPS.
Auth failed or the wrong environment (staging vs production) while loading the template list. Retry and confirm partnerId, partnerToken, and environment.
Microphone permission denied, session start/submit failed, or form generation failed. Read err.message, show a retry option, and confirm network access.
Sign-in failed before the hosted UI loads. Verify partnerId and partnerToken for your environment. Refer to Authentication.
The clinician closed the processing screen early, or the tab closed before processing finished. Register a partner webhook for server-side delivery.
Pass your encounter ID as correlation_id at session start so callbacks and webhooks match the correct record.
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 - All start() options. React integration - If you use React.
Last modified on October 16, 2026