> ## 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.

# SessionContext Types

> Type definitions for session context you pass to setSessionContext

## SessionContext type

`SessionContext` is the patient, provider, visit, section, and diagnosis data you attach to an ambient session with `setSessionContext`. You send it so Suki knows who the patient is, what kind of visit this is, and which note sections you want, instead of relying on the audio alone, which helps Suki generate more accurate and meaningful clinical notes.

For Embedded Forms, put templates and optional prior section text on `sections[].precharted_content`.

```tsx theme={"theme":{"light":"one-light","dark":"material-theme-darker"}}
type SessionContext = {
  patient?: {
    dob: string;
    sex: string;
    patient_id?: string;
    name?: {
      family?: string;
      given?: string[];
      suffix?: string[];
      use?: string;
    };
  };
  provider?: {
    specialty: string; // Enum token, for example FAMILY_MEDICINE
    role?: string;
  };
  visit?: {
    visit_type?: string;
    encounter_type?: string;
    reason_for_visit?: string;
    chief_complaint?: string;
    visit_id?: string;
  };
  sections?: Array<{
    loinc: string;
    precharted_content?: Array< // [!code ++:15] New in v0.3.1
      | { type: "string"; text: string }
      | {
          type: "structured";
          template_id: string;
          language?: string;
          fields: Array<{
            id?: string;
            key: string;
            context?: string;
            type: "text" | "radio" | "multi_select" | "date";
            options?: string[];
          }>;
        }
    >;
  }>;
  diagnoses?: {
    values: Array<{
      codes: Array<{
        code: string;
        description: string;
        type: string;
      }>;
      diagnosisNote: string;
    }>;
  };
};
```

### Sections and Embedded Forms

| Field | Type | Description |
| - | - | - |
| `sections[].loinc` | `string` | LOINC code that identifies the note section. |
| `sections[].precharted_content` | `PrechartedContent[]` (optional) | Existing section text (`type: "string"`) or Embedded Form templates (`type: "structured"`), or both. |

Use `sections` to specify which note sections Suki should work with. Each section must include a LOINC code. Add `precharted_content` to provide existing text, define Embedded Form fields for Suki to fill, or do both.

Pass the complete context to `setSessionContext`. If you change the sections during a visit, call `updateSessionContext` and include `sections` in `updateMask`. For examples of how to seed, update, and read Embedded Forms, refer to [Seed and read Embedded Forms](https://developer.suki.ai/headless-web-sdk/guides/seed-and-read-embedded-forms.md).

### Patient identity and name

| Field | Type | Description |
| - | - | - |
| `patient.patient_id` | `string` (optional) | Patient identifier in your EMR or application. |
| `patient.name.family` | `string` (optional) | Family name. |
| `patient.name.given` | `string[]` (optional) | Given names. |
| `patient.name.suffix` | `string[]` (optional) | Name suffixes. |
| `patient.name.use` | `string` (optional) | Name use, for example `official`. |

> [!NOTE]
>
> * An empty `name` object is dropped and is not sent.
> * Name values are passed through as provided. The SDK does not force normalization.
> * **Web SDK handoff:** If you capture audio in Headless but the clinician reviews the note in the Web SDK, send `patient_id` and structured `name` with `setSessionContext`. Suki uses those fields to fill in the patient header in the Web SDK. Refer to [Seed patient context for Web SDK handoff](https://developer.suki.ai/headless-web-sdk/guides/read-shared-ambient-notes.md#seed-patient-context-for-web-sdk-handoff).

## setSessionContext return type

`setSessionContext` returns **`Promise<void>`**. On success the promise resolves with no value. On failure it throws `AmbientSessionError` with `code: "ContextUpdateFailed"`. Refer to [Error handling](https://developer.suki.ai/headless-web-sdk/guides/error-handling.md#setsessioncontext-contextupdatefailed).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.