> ## Documentation Index
> Fetch the complete documentation index at: https://developer.suki.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Classes Reference

> Web SDK class definitions, constructors, and methods reference

This section provides a detailed reference for all classes available in the Suki Web SDK.

## SDKClient instance

The `SDKClientInstance` is the primary interface for interacting with the Suki Web SDK, providing comprehensive methods for managing encounters, ambient sessions, and event subscriptions.

The code snippet below shows how to use the `SDKClientInstance` class to interact with the Suki Web SDK.

```js JavaScript theme={"theme":{"light":"github-dark","dark":"material-theme-darker"}}
interface SDKClientInstance {
  activeAmbientId: string | null;
  attemptLogin(): Promise<true | void>;
  setPartnerToken(partnerToken: string): void;
  cancelAmbient(): void;
  cleanup(): void;
  destroy(): void;
  mount(options: MountOptions): Promise<void>;
  on<T extends keyof EmitterEvents>(
    type: T,
    handler: (data: EmitterEvents[T]) => void | Promise<void>,
  ): () => void;
  pauseAmbient(): void;
  resumeAmbient(): void;
  setAmbientOptions(options: AmbientOptions): void;
  setEncounter(encounter: Encounter): Promise<void>;
  startAmbient(): void;
  submitAmbient(): void;
}
```

### Properties

<ResponseField name="activeAmbientId" type="string | null">
  The ID of the currently active ambient session, or `null` if no session is active.
</ResponseField>

### Available methods

<Expandable title="available methods" defaultOpen="true">
  <ResponseField name="attemptLogin" type="Promise<true | void>">
    Re-authenticates the user with the SDK. This method does not take any parameters.
  </ResponseField>

  <ResponseField name="cancelAmbient" type="void">
    Cancels the current ambient session. This method does not take any parameters.
  </ResponseField>

  <ResponseField name="cleanup" type="void">
    Cleans up the SDK and removes all event listeners. This method does not take any parameters.
  </ResponseField>

  <ResponseField name="destroy" type="void">
    Destroys the SDK instance and stops the token refresh mechanism. This method does not take any parameters. For more information, see the [Token refresh](/web-sdk/guides/token-refresh) guide.
  </ResponseField>

  <ResponseField name="mount" type="Promise<void>">
    Mounts the SDK to a specified DOM element with the provided configuration options.

    <Expandable title="parameters" defaultOpen="true">
      <ResponseField name="options" type="MountOptions" href="/web-sdk/api-reference/types#mountoptions" required>
        The configuration options for mounting the SDK.
      </ResponseField>
    </Expandable>
  </ResponseField>

  <ResponseField name="on" type="() => void">
    Subscribes to SDK events. This method returns an unsubscribe function.

    <Expandable title="parameters" defaultOpen="true">
      <ResponseField name="type" type="T" required>
        The type of event to subscribe to (e.g., `'ready'`, `'ambient:update'`).
      </ResponseField>

      <ResponseField name="handler" type="(data: EmitterEvents[T]) => void | Promise<void>" required>
        The callback function to be executed when the event is emitted.
      </ResponseField>
    </Expandable>
  </ResponseField>

  <ResponseField name="pauseAmbient" type="void">
    Pauses the current ambient session. This method does not take any parameters.
  </ResponseField>

  <ResponseField name="resumeAmbient" type="void">
    Resumes a paused ambient session. This method does not take any parameters.
  </ResponseField>

  <ResponseField name="setAmbientOptions" type="void">
    Updates the ambient session configuration dynamically.

    <Expandable title="parameters" defaultOpen="true">
      <ResponseField name="options" type="AmbientOptions" href="/web-sdk/api-reference/types#ambientoptions" required>
        The new ambient session configuration options.
      </ResponseField>
    </Expandable>
  </ResponseField>

  <ResponseField name="setEncounter" type="Promise<void>">
    Sets the encounter context for the ambient session.

    <Expandable title="parameters" defaultOpen="true">
      <ResponseField name="encounter" type="Encounter" href="/web-sdk/api-reference/types#encounter" required>
        Full [`Encounter`](/web-sdk/api-reference/types/encounter) payload. **`patient.identifier`** is required. **`encounter.identifier`** is optional. Each value must be **at most 36 characters** (<Tooltip tip="VARCHAR is a variable-length SQL string type. varchar(36) caps these identifiers at 36 characters. See the Glossary." cta="View in Glossary" href="/Glossary/v#varchar-36">varchar(36)</Tooltip>) when present.
      </ResponseField>
    </Expandable>
  </ResponseField>

  <ResponseField name="setPartnerToken" type="void">
    Updates the `partnerToken` for authentication after a token refresh.

    <Expandable title="parameters" defaultOpen="true">
      <ResponseField name="partnerToken" type="string" required>
        The new `partnerToken` string.
      </ResponseField>
    </Expandable>
  </ResponseField>

  <ResponseField name="startAmbient" type="void">
    Starts a new ambient session. This method does not take any parameters.
  </ResponseField>

  <ResponseField name="submitAmbient" type="void">
    Submits the current ambient session for processing. This method does not take any parameters.
  </ResponseField>
</Expandable>

## Next steps

<Icon icon="file-lines" iconType="solid" /> Refer to the [Functions](/web-sdk/api-reference/functions) to learn more about the available functions in the Suki Web SDK.
