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

# Orders Info

> Retrieve structured Medication orders from an ambient session with kOrdersInfo and getStructuredData

Use orders info when Medication orders is enabled and you want structured medication orders from an ambient session. When the provider prescribes medications during the visit conversation, Suki includes those orders in the session output. After processing completes, retrieve them with `getStructuredData(for:)` so your application can submit them through your EHR workflow.

Pass optional `SukiAmbientConstant.kOrdersInfo` in `setSessionContext(with:)` after you create the session when your workflow needs medication order context for the visit. This parameter is optional.

<Warning>
  This feature is not enabled by default. To enable it, contact [Suki support](mailto:support@suki.ai) to request access (if not already enabled).
</Warning>

<ResponseField name="SukiAmbientConstant.kOrdersInfo" type="dictionary" required={false}>
  Use this parameter when you need to attach medication order context for the ambient visit. Generated Medication orders from the encounter still come from what the provider prescribes during the session, and you retrieve them with `getStructuredData(for:)` after processing completes.

  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":"one-light","dark":"material-theme-darker"}}
  do {
      let contextDetail: [String: AnyHashable] = [
          SukiAmbientConstant.kOrdersInfo: [
              MedicationOrderKeys.kMedicationOrders: [
                  [
                      MedicationOrderKeys.kDrugName: "Atorvastatin", // optional
                      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"
                      ]
                  ]
              ]
          ]
      ]

      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)
  }
  ```

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

## Next steps

<Icon icon="file-lines" iconType="solid" /> **[Provide clinical context](/mobile-sdk/ambient-guides/provide-clinical-context)** - Full `setSessionContext` overview and combined example.

<Icon icon="file-lines" iconType="solid" /> **[Medication orders](/documentation/concepts/ambient-clinical-notes/medication-orders)** - platform concept across ambient products.

<Icon icon="file-lines" iconType="solid" /> **[Check status and retrieve content](/mobile-sdk/ambient-guides/check-status-and-retrieve-content#get-structured-data)** - Pull structured medication order payloads.


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