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

# Provide Additional Clinical Context

> Attach clinical context, medication orders, and encounter details to an ambient session with `setSessionContext(with:)` in the iOS SDK

<Callout type="updates" color="orange" icon="bell">
  **Updated:**

  Starting with Mobile SDK `v2.6.0+` on iOS SDK, you can attach structured **medication orders** to an ambient session's context by passing `SukiAmbientConstant.kOrdersInfo` into `setSessionContext(with:)` after you create the session.

  Learn more in the [Medication orders](/mobile-sdk/ambient-guides/provide-clinical-context#orders-info) section.
</Callout>

<div className="quick-summary-wrapper">
  <div className="quick-summary-header">
    <span className="quick-summary-icon" aria-hidden="true" />

    <span className="quick-summary-title">Quick summary</span>
  </div>

  <div className="quick-summary-content">
    The `setSessionContext(with:)` method in the mobile SDK allows you to provide optional clinical context to the ambient session for better note generation. This context helps Suki generate more accurate and relevant clinical notes.
    Call `setSessionContext(with:)` multiple times. Each call updates or adds to the existing context. This allows you to provide information as it becomes available in your app.
  </div>

  <div className="quick-summary-footer">
    <span className="quick-summary-footer-icon" aria-hidden="true" />

    <span className="quick-summary-footer-text">Last updated:</span>
    <span className="quick-summary-footer-date">August 2026</span>
  </div>
</div>

After creating a session, you can provide additional clinical information using the `setSessionContext(with:)` method. This context helps Suki's AI generate more accurate and relevant clinical notes.

<Note>
  All context parameters mentioned below are **optional**. Use one or more of these parameters to help Suki generate more accurate and relevant clinical notes. The absence of any parameter will not break existing functionality.
</Note>

**Why provide context?**

* **Better note quality**: More accurate sections and diagnoses.
* **Specialty-specific formatting**: Notes match your medical specialty.
* **Structured organization**: Notes organized by the sections you need.
* **Diagnosis accuracy**: Better identification of conditions discussed.

## Set session context (optional but recommended)

After the session is created, call `setSessionContext(with:)` and pass a dictionary of optional parameters. In one call you can mix patient info, provider context, visit context, EMR info, note sections, diagnosis info, and medication orders, or send just one of them. For each parameter, see the keys and types in [Additional context parameters](/mobile-sdk/ambient-guides/provide-clinical-context#additional-context-parameters). If you do not have data for a parameter yet, leave it out of the dictionary; call `setSessionContext(with:)` again when you want to add or change values.

<Note>
  Call `setSessionContext(with:)` multiple times. Each call updates or adds to the existing context. This allows you to provide information as it becomes available in your app.
</Note>

<CodeGroup>
  ```swift Swift expandable theme={"theme":{"light":"github-dark","dark":"material-theme-darker"}}
  do {
      let contextDetail: [String: AnyHashable] = [
          SukiAmbientConstant.kPatientInfo: [
              SukiAmbientConstant.kBirthdate: Date(), // Use yyyy-mm-dd format
              SukiAmbientConstant.kGender: "FEMALE",
              // [!code ++:10]
              SukiAmbientConstant.kPatientId: "emr-patient-42",
              SukiAmbientConstant.kPatientName: [
                  SukiAmbientConstant.kPatientFamily: "Doe",
                  SukiAmbientConstant.kPatientGiven: ["Jane", "Marie"],
                  SukiAmbientConstant.kPatientSuffix: ["Jr"],
                  SukiAmbientConstant.kPatientNameUse: "official"
              ] as [String: AnyHashable]
          ],
          SukiAmbientConstant.kProviderContext: [
              SukiAmbientConstant.kSpeciality: "FAMILY_MEDICINE",
              SukiAmbientConstant.kProviderRole: "PRIMARY/ATTENDING" // [!code ++] New in v2.5.0: Optional provider role (Primary/Attending or Consulting)
          ],
          SukiAmbientConstant.kVisitContext: [
            // [!code ++:5] New in v2.5.0: Visit context parameters for improved note generation
              SukiAmbientConstant.kVisitType: "ESTABLISHED_PATIENT", // Optional: New Patient / Intake, Established patient, Wellness, ED
              SukiAmbientConstant.kEncounterType: "AMBULATORY", // Optional: ambulatory, inpatient, ED
              SukiAmbientConstant.kReasonForVisit: "Annual checkup", // Optional: String, max 255 characters
              SukiAmbientConstant.kChiefComplaint: "Routine follow-up" // Optional: String, max 255 characters
          ],

          SukiAmbientConstant.kEmrInfo: [ // [!code ++:2] New in v2.6.0: Optional EMR info (string)
              SukiAmbientConstant.kTargetEmr: "<emr_identifier>" // Required: which EMR this session uses (string)
          ],
          SukiAmbientConstant.kSections: [
              [SukiAmbientConstant.kCode: "51848-0", SukiAmbientConstant.kCodeType: "loinc"],
              [SukiAmbientConstant.kCode: "11450-4", SukiAmbientConstant.kCodeType: "loinc"]
          ],
          SukiAmbientConstant.kDiagnosisInfo: [
              [
                  SukiAmbientConstant.kDiagnosisNote: "Patient presents with chest pain",
                  SukiAmbientConstant.kCodes: [
                      [
                          SukiAmbientConstant.kCodeType: "ICD-10",
                          SukiAmbientConstant.kCode: "R06.02",
                          SukiAmbientConstant.kCodeDescription: "Shortness of breath"
                      ]
                  ]
              ]
          ],
          // [!code ++:23] New in v2.6.0: medication orders context parameter for suggesting medication orders
          SukiAmbientConstant.kOrdersInfo: [
              MedicationOrderKeys.kMedicationOrders: [
                  [
                      MedicationOrderKeys.kDrugName: "Atorvastatin",
                      MedicationOrderKeys.kMedicationCode: [
                          SukiAmbientConstant.kCodeType: "<code_type>", // optional; coded values must match a supported catalog in your SDK version
                          SukiAmbientConstant.kCode: "<code>" // optional
                      ],
                      MedicationOrderKeys.kStrength: "10 mg", // optional
                      MedicationOrderKeys.kFormat: "tablet", // optional
                      MedicationOrderKeys.kRoute: "oral", // optional
                      MedicationOrderKeys.kLinkedDiagnosisCodes: [
                          [
                              SukiAmbientConstant.kCodeType: "ICD-10",
                              SukiAmbientConstant.kCode: "E78.5"
                          ]
                      ],
                      MedicationOrderKeys.kMetadata: [
                          MedicationOrderKeys.kOrigin: "EMR",
                          MedicationOrderKeys.kEncounterRelation: "CURRENT_ENCOUNTER"
                      ]
                      // Optional: MedicationOrderKeys.kDosage, kFrequency, kMedicationTiming, kStatus, kQuantityDispensed, kNumberOfRefills, kStartDate, kEndDate, kDurationInDays, kInstructions, etc

                  ]
              ]
          ]
      ]

      try SukiAmbientCoreManager.shared.setSessionContext(with: contextDetail) { result in
          switch result {
          case .success:
              print("Context updated successfully")
          case .failure(let error):
              print("Error updating context: \(error)")
          }
      }
  } catch {
      print(error)
  }
  ```
</CodeGroup>

<Warning>
  Call `setSessionContext(with:)` only **after** a session has been successfully created. Call `createSession` first and wait for it to succeed before calling `setSessionContext`.
</Warning>

<Tip>
  **Retrieve the generated note and structured data**

  After you call `setSessionContext` with your additional clinical context (such as provider, patient, or visit details), you can use the Suki Mobile SDK to retrieve your results.

  Use the `content(for:)` method to retrieve the generated clinical note and extracted blocks. To pull structured output once processing completes, call `getStructuredData(for:)`. The structured output includes all data the service produces from your specific context, including diagnoses and medication order payloads.

  For more information on how to retrieve these elements, read our guide on [Session status and content retrieval](/mobile-sdk/ambient-guides/session-status-and-content-retrieval#get-structured-data).
</Tip>

## Additional context parameters

### Patient info

<ResponseField name="SukiAmbientConstant.kPatientInfo" type="dictionary" required={false}>
  Use this parameter to provide demographic information that helps personalize the note generation.

  <Note>
    You can now pass a **partner** or **EMR patient id** and a **structured patient name** when you have them.
  </Note>

  <Expandable title="properties" defaultOpen={true}>
    <ResponseField name="SukiAmbientConstant.kBirthdate" type="date" required={false}>
      Patient's date of birth in yyyy-mm-dd format.
    </ResponseField>

    <ResponseField name="SukiAmbientConstant.kGender" type="string" required={false}>
      Patient's gender. Valid values: "MALE" or "FEMALE".
    </ResponseField>

    <ResponseField name="SukiAmbientConstant.kPatientId" type="string" required={false}>
      Partner or EMR patient identifier. String key: `"patient_id"`. Optional.
    </ResponseField>

    <ResponseField name="SukiAmbientConstant.kPatientName" type="dictionary" required={false}>
      Structured patient name. String key: `"name"`.

      **Optional**, pass one or more of the nested fields below when you have them.

      <Expandable title="properties" defaultOpen={true}>
        <ResponseField name="SukiAmbientConstant.kPatientFamily" type="string" required={false}>
          Family or last name. String key: `"family"`. Optional.
        </ResponseField>

        <ResponseField name="SukiAmbientConstant.kPatientGiven" type="array of strings" required={false}>
          Given or first names, in order. String key: `"given"`.

          **Optional**. For example, `["Jane", "Marie"]`.
        </ResponseField>

        <ResponseField name="SukiAmbientConstant.kPatientSuffix" type="array of strings" required={false}>
          Name suffixes. String key: `"suffix"`.

          **Optional**. For example, `["Jr"]`.
        </ResponseField>

        <ResponseField name="SukiAmbientConstant.kPatientNameUse" type="string" required={false}>
          How this name is used. String key: `"use"`.

          **Optional**. Examples: `"official"`, `"usual"`, `"nickname"`.
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

### Provider context

<ResponseField name="SukiAmbientConstant.kProviderContext" type="dictionary" required={false}>
  Use this parameter to provide information about the healthcare provider to tailor note generation to your specialty and role.

  <Expandable title="properties" defaultOpen={true}>
    <ResponseField name="SukiAmbientConstant.kSpeciality" type="string" required={false}>
      The provider's medical specialty (e.g., "FAMILY\_MEDICINE", "CARDIOLOGY"). This helps format notes according to your specialty's conventions.
    </ResponseField>

    <ResponseField name="SukiAmbientConstant.kProviderRole" type="string" required={false}>
      The provider's role in the encounter. Valid values: "Primary/Attending" or "Consulting". This helps distinguish between primary care providers and consulting specialists.
    </ResponseField>
  </Expandable>
</ResponseField>

### Visit context

<ResponseField name="SukiAmbientConstant.kVisitContext" type="dictionary" required={false}>
  Use this parameter to provide visit-related metadata that provides context about the type and purpose of the encounter.

  <Expandable title="properties" defaultOpen={true}>
    <ResponseField name="SukiAmbientConstant.kVisitType" type="string" required={false}>
      The type of patient visit. Valid values: "New Patient / Intake", "Established patient", "Wellness", "ED". This helps format notes appropriately for the visit type.
    </ResponseField>

    <ResponseField name="SukiAmbientConstant.kEncounterType" type="string" required={false}>
      The setting where the encounter occurs. Valid values: "ambulatory", "inpatient", "ED". This helps structure notes for the appropriate care setting.
    </ResponseField>

    <ResponseField name="SukiAmbientConstant.kReasonForVisit" type="string" required={false}>
      A free-text description explaining why the patient is visiting. Maximum 255 characters. This helps focus the note on the primary reason for the visit.
    </ResponseField>

    <ResponseField name="SukiAmbientConstant.kChiefComplaint" type="string" required={false}>
      The patient's primary complaint or concern. Maximum 255 characters. This helps structure the note's chief complaint section.
    </ResponseField>
  </Expandable>
</ResponseField>

### EMR info

<ResponseField name="SukiAmbientConstant.kEmrInfo" type="dictionary" required={false}>
  Use this parameter to identify which EMR applies to an ambient session. Provide a string identifier that matches what your integration and Suki use for that EMR (for example a vendor code or environment-specific label).

  <Expandable title="properties" defaultOpen={true}>
    <ResponseField name="SukiAmbientConstant.kTargetEmr" type="string" required>
      The target EMR for this encounter. Provide a string identifier that matches what your integration and Suki use for that EMR (for example a vendor code or environment-specific label).
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="SukiAmbientConstant.kSections" type="array of dictionaries" required={false}>
  An array of LOINC codes that specify which clinical note sections you want in the generated note. Each dictionary contains a LOINC code.

  <Note>
    You only need to provide LOINC codes. The SDK automatically generates the appropriate clinical section titles based on the codes you provide.
  </Note>

  **Code example**:

  ```swift Swift theme={"theme":{"light":"github-dark","dark":"material-theme-darker"}}
  SukiAmbientConstant.kSections: [
      [SukiAmbientConstant.kCode: "51848-0", SukiAmbientConstant.kCodeType: "loinc"],
      [SukiAmbientConstant.kCode: "11450-4", SukiAmbientConstant.kCodeType: "loinc"]
  ]
  ```
</ResponseField>

### Diagnosis info

<ResponseField name="SukiAmbientConstant.kDiagnosisInfo" type="array of dictionaries" required={false}>
  Structured diagnosis information that helps the AI identify and code conditions discussed during the encounter. Each dictionary represents one diagnosis.

  <Expandable title="properties" defaultOpen={true}>
    <ResponseField name="SukiAmbientConstant.kDiagnosisNote" type="string" required={false}>
      A text note describing the diagnosis or condition.
    </ResponseField>

    <ResponseField name="SukiAmbientConstant.kCodes" type="array of dictionaries" required={false}>
      An array of diagnosis codes. Each code dictionary must contain:

      <Expandable title="code properties" defaultOpen={true}>
        <ResponseField name="SukiAmbientConstant.kCodeType" type="string" required>
          The coding system used (e.g., "ICD-10", "IMO", "SNOMED").
        </ResponseField>

        <ResponseField name="SukiAmbientConstant.kCode" type="string" required>
          The actual diagnosis code.
        </ResponseField>

        <ResponseField name="SukiAmbientConstant.kCodeDescription" type="string" required={false}>
          A human-readable description of what the code represents. Recommended for clarity.
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

### Orders info

<Warning>
  This feature is not enabled by default. To enable it, contact Suki to request access (if not already enabled).
</Warning>

<ResponseField name="SukiAmbientConstant.kOrdersInfo" type="dictionary" required={false}>
  Use this parameter to provide information about medications relevant to a patient visit, such as existing prescriptions or the patient's current medication list.

  The data is structured as a single bundle. On the wire, the outer payload key is `orders`. Inside this bundle, you must include a single list keyed by `MedicationOrderKeys.kMedicationOrders` (wire string `medication_orders`). Each entry in this list represents a single medication order and must be formatted as an individual dictionary.

  You can skip `kOrdersInfo` entirely if it is not required for your workflow. If you do send the `MedicationOrderKeys.kMedicationOrders` list, each order in that list should satisfy the following recommendations.

  <Warning>
    Missing information or incomplete metadata fails with `invalidMedicationOrder`. If you include `origin` or `encounter_relation` under `metadata`, each value must be non-empty and match one of the allowed choices. Values that do not match can fail parsing with `invalidOrderMetadata`.
  </Warning>

  **Payload keys**

  The following payload (wire) keys are important when present in the `MedicationOrderKeys.kMedicationOrders` array:

  * `medication_code`: If provided, include both `code_type` and `code`.

  * `linked_diagnosis_codes`: If provided, include at least one item containing both `code_type` and `code`.

  * `metadata.origin` and `metadata.encounter_relation`: You must use only the approved values for these fields.

  <Warning>
    When you use optional fields that carry **codes** (`medication_code.code_type`, `dosage.unit`, `frequency`, `medication_timing`, `status`), the SDK checks them against its own supported lists.
    Use only values that your SDK already accepts to avoid validation errors.
  </Warning>

  **Code example**:

  ```swift Swift theme={"theme":{"light":"github-dark","dark":"material-theme-darker"}}
  SukiAmbientConstant.kOrdersInfo: [
      MedicationOrderKeys.kMedicationOrders: [
          [
              MedicationOrderKeys.kDrugName: "Atorvastatin", // optional
              MedicationOrderKeys.kMedicationCode: [
                  SukiAmbientConstant.kCodeType: "<code_type>", // optional
                  SukiAmbientConstant.kCode: "<code>" // optional
              ],
              MedicationOrderKeys.kStrength: "10 mg", // optional
              MedicationOrderKeys.kFormat: "tablet", // optional
              MedicationOrderKeys.kRoute: "oral", // optional
              MedicationOrderKeys.kLinkedDiagnosisCodes: [
                  [SukiAmbientConstant.kCodeType: "ICD-10", SukiAmbientConstant.kCode: "E78.5"]
              ],
              MedicationOrderKeys.kMetadata: [
                  MedicationOrderKeys.kOrigin: "EMR",
                  MedicationOrderKeys.kEncounterRelation: "CURRENT_ENCOUNTER"
              ]
          ]
      ]
  ]
  ```

  <Expandable title="properties" defaultOpen={true}>
    Each object in the `MedicationOrderKeys.kMedicationOrders` array can include the following. The **payload keys** checklist above defines the minimum; the `ResponseField` entries use Swift constant names for the same rules.

    <ResponseField name="MedicationOrderKeys.kDrugName" type="string" required>
      The medication name. Required when this order is included in the array.
    </ResponseField>

    <ResponseField name="MedicationOrderKeys.kMedicationCode" type="dictionary" required={false}>
      The coded medication identifier. Optional when this order is included.

      <Expandable title="medication_code properties" defaultOpen={true}>
        <ResponseField name="SukiAmbientConstant.kCodeType" type="string" required={false}>
          The coding system for the medication code. Optional for validation. Must match a supported catalog when you send a coded value.
        </ResponseField>

        <ResponseField name="SukiAmbientConstant.kCode" type="string" required={false}>
          The medication code. Optional for validation. Must match a supported catalog when you send a coded value.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="MedicationOrderKeys.kStrength" type="string" required={false}>
      The medication strength (for example dosage amount with unit). Optional when this order is included.
    </ResponseField>

    <ResponseField name="MedicationOrderKeys.kFormat" type="string" required={false}>
      The dose form (for example tablet, capsule). Optional when this order is included.
    </ResponseField>

    <ResponseField name="MedicationOrderKeys.kRoute" type="string" required={false}>
      The route of administration. Optional when this order is included.
    </ResponseField>

    <ResponseField name="MedicationOrderKeys.kDosage" type="dictionary" required={false}>
      Optional structured dosage information.

      <Expandable title="dosage properties" defaultOpen={false}>
        <ResponseField name="MedicationOrderKeys.kRawValue" type="string" required={false}>
          Free-text dosage as entered in your system.
        </ResponseField>

        <ResponseField name="MedicationOrderKeys.kQuantity" type="number" required={false}>
          Numeric quantity for the dose.
        </ResponseField>

        <ResponseField name="MedicationOrderKeys.kUnit" type="string" required={false}>
          Unit for the quantity. When used as a coded field, must match a supported catalog.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="MedicationOrderKeys.kFrequency" type="dictionary" required={false}>
      Optional dosing frequency. Uses the same inner keys as `MedicationOrderKeys.kMedicationTiming`.

      <Expandable title="frequency properties" defaultOpen={false}>
        <ResponseField name="MedicationOrderKeys.kRawValue" type="string" required={false}>
          Free-text frequency.
        </ResponseField>

        <ResponseField name="MedicationOrderKeys.kStructuredValue" type="string" required={false}>
          Structured frequency value. When used as a coded field, must match a supported catalog.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="MedicationOrderKeys.kQuantityDispensed" type="string" required={false}>
      Quantity dispensed.
    </ResponseField>

    <ResponseField name="MedicationOrderKeys.kNumberOfRefills" type="integer" required={false}>
      Number of refills.
    </ResponseField>

    <ResponseField name="MedicationOrderKeys.kStartDate" type="date" required={false}>
      Start date for the order when you supply it through context bridging.
    </ResponseField>

    <ResponseField name="MedicationOrderKeys.kEndDate" type="date" required={false}>
      End date for the order.
    </ResponseField>

    <ResponseField name="MedicationOrderKeys.kDurationInDays" type="integer" required={false}>
      Duration of therapy in days.
    </ResponseField>

    <ResponseField name="MedicationOrderKeys.kInstructions" type="string" required={false}>
      Patient- or pharmacy-facing instructions.
    </ResponseField>

    <ResponseField name="MedicationOrderKeys.kMedicationTiming" type="dictionary" required={false}>
      Optional timing details for the medication. Same shape as `MedicationOrderKeys.kFrequency`.

      <Expandable title="medication_timing properties" defaultOpen={false}>
        <ResponseField name="MedicationOrderKeys.kRawValue" type="string" required={false}>
          Free-text timing.
        </ResponseField>

        <ResponseField name="MedicationOrderKeys.kStructuredValue" type="string" required={false}>
          Structured timing value. When used as a coded field, must match a supported catalog.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="MedicationOrderKeys.kLinkedDiagnosisCodes" type="array of dictionaries" required={false}>
      Optional for validation: if provided, include at least one object. Each array element uses `code_type` and `code` (`SukiAmbientConstant.kCodeType` and `SukiAmbientConstant.kCode` in Swift).

      <Expandable title="code properties" defaultOpen={true}>
        <ResponseField name="SukiAmbientConstant.kCodeType" type="string" required={false}>
          The coding system for the diagnosis (for example "ICD-10"). Must match a supported catalog when you send a coded value.
        </ResponseField>

        <ResponseField name="SukiAmbientConstant.kCode" type="string" required={false}>
          The diagnosis code. Must match a supported catalog when you send a coded value.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="MedicationOrderKeys.kStatus" type="string" required={false}>
      Order status. When used as a coded field, must match a supported catalog.
    </ResponseField>

    <ResponseField name="MedicationOrderKeys.kMetadata" type="dictionary" required={false}>
      Provenance for the order. Optional when this order is included. If provided, you should set `origin` and `encounter_relation` under `metadata` (use `MedicationOrderKeys.kOrigin` and `MedicationOrderKeys.kEncounterRelation` in Swift). Each value must be non-empty after trim and must be one of the allowed strings below.

      <Expandable title="metadata properties" defaultOpen={true}>
        <ResponseField name="MedicationOrderKeys.kOrigin" type="string" required={false}>
          **Payload key** `origin`. Where the order came from. Valid values: `SUKI_AMBIENT`, `EMR`.
        </ResponseField>

        <ResponseField name="MedicationOrderKeys.kEncounterRelation" type="string" required={false}>
          **Payload key** `encounter_relation`. How the order relates to the encounter. Valid values: `PRIOR_ENCOUNTER`, `CURRENT_ENCOUNTER`.

          <Note>
            This field is **required** if the origin is EMR.
          </Note>
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

## Best practices

Follow these practices to ensure reliable session management:

<Tip>
  * **Always initialize the SDK first**: Make sure `SukiAmbientCoreManager.shared.initialize()` has been called successfully before creating a session.

  * **Store the session ID**: Save the `sessionId` returned from `createSession` immediately. Use it for recording controls and session-scoped APIs.

  * **Handle errors properly**: Use the completion handler's result to check for success or failure. Display appropriate error messages to users.

  * **Provide context when available**: Call `setSessionContext` with any clinical information you have. Even partial context improves note quality.

  * **Medication orders**: If you send `MedicationOrderKeys.kMedicationOrders` under `kOrdersInfo`, include required fields per order and valid metadata values, or the SDK can reject the update.

  * **Call setSessionContext after createSession**: Wait for `createSession` to succeed before calling `setSessionContext`.

  * **Handle background limitations**: On iOS, you cannot start a recording while the app is in the background. Ensure your app is active before starting a recording.
</Tip>

## FAQs

<AccordionGroup>
  <Accordion title="Why Is Session Creation Failing?">
    Session creation can fail for several reasons:

    **Common causes:**

    * SDK not initialized: Make sure you've called `initialize()` before creating a session.
    * Invalid partner information: Check that your `partnerId` and provider information are correct.
    * Network connectivity issues: Ensure the device has an active internet connection.
    * Authentication token problems: Verify your token provider is returning valid tokens.
    * Missing microphone permissions: Ensure your app has microphone access permissions.

    **How to debug:**
    Check the error returned in the completion handler's `.failure` case. The error will indicate the specific reason for failure.
  </Accordion>

  <Accordion title="Why Isn't My Session Context Updating?">
    The session context may not update if:

    * **Session not created**: You must call `createSession` first and wait for it to succeed.
    * **Method not called**: Ensure you're actually calling `setSessionContext` after session creation.
    * **Invalid parameters**: Check that specialty strings and codes match the expected formats. For medication orders, confirm required fields per order, valid `metadata` values, and at least one linked diagnosis code object.
    * **Network error**: The update request may have failed due to connectivity issues.

    **How to verify:**
    Check the completion handler result. If it returns `.failure`, examine the error to understand what went wrong.
  </Accordion>

  <Accordion title="Can I Start Recording Immediately After Creating a Session?">
    Yes, once `createSession` succeeds and returns a `sessionId`, you can start recording. However, it's recommended to call `setSessionContext` first if you have clinical context available, as this improves note quality.

    The typical flow is:

    1. Create session → Get `sessionId`.
    2. Set session context (optional but recommended).
    3. Start recording.
  </Accordion>
</AccordionGroup>

## Next steps

<Icon icon="file-lines" iconType="solid" /> After you create a session and optionally set context, proceed to the [Recording controls](/mobile-sdk/ambient-guides/recording) guide to learn how to start recording and manage the recording lifecycle.
