Skip to main content
What you will build

20 min | Intermediate

  • A shared platform client for your React app.
  • Sign-in with Headless auth.
  • An ambient session for recording.
  • Start, pause, resume, and submit controls, plus session context after start.
  • Optional microphone selection with config.audio.deviceId (Headless Web SDK v0.3.1 or later).
Using an AI coding tool?Copy the prompt below to point your agent at the Ambient skill and Documentation MCP. For every task skill, refer to AI coding tools.

Fetch the Ambient skill and connect the documentation MCP.

Open in Cursor
In this tutorial, you build a custom ambient recorder UI with the Headless Web SDK. You wrap the app with PlatformClientProvider, sign in with useAuth, create a session with useAmbient, and control recording with useAmbientSession. By the end of this tutorial, you will have a React page that authenticates, creates an ambient session, and exposes start, pause, resume, and submit controls. You can optionally pass a microphone deviceId so the recording uses a specific microphone.
The Headless Web SDK is in beta. APIs and docs may change. Confirm package versions with your Suki contact before production use.

Prerequisites

Before you begin, make sure you have:
Headless Web SDK is for custom UIs. If you want the hosted ambient chrome, use the Web SDK ambient session tutorial instead.

Architecture

Project setup

  1. Use a React 18+ app that meets Headless Web SDK prerequisites.
  2. Install the required dependencies:.
  1. Configure your credentials:.
    • Keep staging partnerId and partnerToken ready for sign-in.
    • Confirm beta expectations with your Suki contact before production use.

Tutorial steps

Work through each step in order. Read the explanation, review the code example, then continue to the next step. The full code example is available in the accordion below.
1

Create PlatformClient and Wrap the App

Create one PlatformClient and wrap your app with PlatformClientProvider so hooks share the same client.Check: One PlatformClient is passed into PlatformClientProvider.If it fails: Wrap the tree with PlatformClientProvider and pass client={client}. Hooks do not work outside that provider.
2

Authenticate with UseAuth

Call useAuth under the provider. When autoRegister is true, pass providerName, providerOrgId, and providerSpecialty.Check: useAuth runs under the provider, and when autoRegister is true you pass providerName, providerOrgId, and providerSpecialty.
3

Create an Ambient Session with UseAmbient

Use useAmbient to create a session. Wait for isSuccess before you pass ambientSessionId into recording hooks.Check: isSuccess is true and ambientSessionId is set before you pass it into recording hooks.If it fails: Create the session only when the user is signed in and you have not already created a session for this screen.
4

Start, Pause, Resume, and Submit with UseAmbientSession

Pass the session ID into useAmbientSession. After start(), call setSessionContext with patient and visit details to improve note quality. Track recording versus paused in local state. sessionStatus is only created, submitted, completed, or cancelled.Optionally pass config.audio.deviceId with a MediaDeviceInfo.deviceId from your own enumerateDevices() flow (v0.3.1 or later). Your app owns how you design and implement the microphone picker UI. Changing the microphone while recording does not switch the microphone that is already in use. Update deviceId in state, call pause(), then resume(). For the full enumerate-and-select sample, refer to Select a microphone guide.Check: You can start, pause, resume, and submit. sessionStatus is one of created, submitted, completed, or cancelled.If it fails: Changing config.audio.deviceId while recording does not switch the microphone already in use. Update deviceId in state, call pause(), then resume(). This path needs Headless Web SDK v0.3.1 or later.
When an exact deviceId is unavailable or disconnected, start or resume fails with code StartSessionFailed or ResumeSessionFailed and reason AudioRecorderFailure. The SDK does not fall back to the browser default. Refresh devices and ask the user to choose again. In React, the thrown value is often a string from error.toString().

Full code example

React

Troubleshooting

Wrap the tree with PlatformClientProvider and pass client={client}.
Create only when signed in and you have not already created the session for this screen.
Treat this SDK as beta; confirm package versions with your Suki contact.
Changing config.audio.deviceId while recording does not switch the microphone that is already in use. Update the deviceId in your app state, call pause(), then resume(). Requires Headless Web SDK v0.3.1 or later. Refer to Select a microphone guide for more details.

Summary

In this tutorial, you:
  • Wrapped the app with PlatformClientProvider.
  • Signed in with useAuth and created a session with useAmbient.
  • Controlled recording with useAmbientSession (start, pause, resume, and submit).
  • Optionally selected a microphone with config.audio.deviceId (v0.3.1 or later).

Other tutorials

Continue with another end-to-end tutorial.
Last modified on October 16, 2026