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

# Seed Patient Context for the Web SDK

> Seed patient profile fields before opening an interoperable note in the Web SDK

**Problem:** You start ambient with only `emr_encounter_id`, then open the Web SDK and the patient profile is empty.

**Solution:** [Seed ambient session context](/api-reference/ambient-sessions/context) with `patient_id`, `name`, `dob`, and `sex` before mount. Open the Web SDK with the same `encounter.identifier`.

<Note>
  This cookbook assumes you already have your Partner ID, authentication tokens, and the other prerequisites for Ambient APIs and the Web SDK.
</Note>

### Seed context

<Tabs>
  <Tab title="CURL">
    ```bash theme={"theme":{"light":"github-dark","dark":"material-theme-darker"}}
    curl --request POST \
      --url https://sdp.suki.ai/api/v1/ambient/session/<ambient_session_id>/context \
      --header 'Content-Type: application/json' \
      --header 'sdp_suki_token: <sdp_suki_token>' \
      --header 'sdp_provider_id: <sdp_provider_id>' \
      --data '{
        "patient": {
          "patient_id": "905c2521-25eb-4324-9978-724636df3436",
          "name": {
            "given": ["Alex"],
            "family": "Patient"
          },
          "dob": "2000-01-01",
          "sex": "female"
        }
      }'
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={"theme":{"light":"github-dark","dark":"material-theme-darker"}}
    import requests

    response = requests.post(
        f"https://sdp.suki.ai/api/v1/ambient/session/{ambient_session_id}/context",
        headers={
            "Content-Type": "application/json",
            "sdp_suki_token": sdp_suki_token,
            "sdp_provider_id": sdp_provider_id,
        },
        json={
            "patient": {
                "patient_id": "905c2521-25eb-4324-9978-724636df3436",
                "name": {"given": ["Alex"], "family": "Patient"},
                "dob": "2000-01-01",
                "sex": "female",
            },
        },
    )
    response.raise_for_status()
    ```
  </Tab>

  <Tab title="TypeScript">
    ```typescript theme={"theme":{"light":"github-dark","dark":"material-theme-darker"}}
    const response = await fetch(
      `https://sdp.suki.ai/api/v1/ambient/session/${ambientSessionId}/context`,
      {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          sdp_suki_token: sdpSukiToken,
          sdp_provider_id: sdpProviderId,
        },
        body: JSON.stringify({
          patient: {
            patient_id: "905c2521-25eb-4324-9978-724636df3436",
            name: { given: ["Alex"], family: "Patient" },
            dob: "2000-01-01",
            sex: "female",
          },
        }),
      }
    );

    if (!response.ok) {
      throw new Error(`Seed ambient session context failed: ${response.status}`);
    }
    ```
  </Tab>
</Tabs>

### Open Web SDK

```jsx React theme={"theme":{"light":"github-dark","dark":"material-theme-darker"}}
<SukiAssistant
  encounter={{
    identifier: "6ec3920f-b0b1-499d-a4e9-889bf788e5ab", // same emr_encounter_id
    patient: {
      identifier: "905c2521-25eb-4324-9978-724636df3436",
      name: {
        use: "official",
        family: "Patient",
        given: ["Alex"],
        suffix: [],
      },
      birthDate: "2000-01-01",
      gender: "FEMALE",
    },
  }}
/>
```

## Common mistakes

* Seed before the Web SDK opens.
* Keep `encounter.identifier` identical to `emr_encounter_id`.

## Other cookbooks

<div className="cookbook-hub-wrap">
  <div className="hp-io-method-grid tut-hub-card-grid" data-cookbook-related-grid>
    <a className="hp-io-method-card tut-hub-method-card" href="/documentation/cookbooks/pass-emr-encounter-id">
      <div className="tut-hub-card-media" aria-hidden="true" />

      <div className="hp-io-method-card-body">
        <div className="tut-hub-card-badges">
          <span className="hp-wn-badge hp-wn-badge-new">Ambient</span>
          <span className="hp-wn-badge cookbook-hub-badge-surface cookbook-hub-badge-surface--api">API</span>
        </div>

        <h3 className="hp-io-method-card-title">Share One Note Across Products</h3>

        <p className="hp-io-method-card-desc cookbook-hub-card-desc">
          Share one note with emr\_encounter\_id.
        </p>

        <div className="hp-io-method-card-meta tut-hub-card-foot" aria-label="5 min">
          <div className="tut-hub-card-foot-meta">
            <span className="hp-io-method-card-meta-time">5 min</span>
          </div>
        </div>
      </div>
    </a>

    <a className="hp-io-method-card tut-hub-method-card" href="/documentation/cookbooks/get-note-content-by-composition-id">
      <div className="tut-hub-card-media tut-hub-card-media--blue" aria-hidden="true" />

      <div className="hp-io-method-card-body">
        <div className="tut-hub-card-badges">
          <span className="hp-wn-badge hp-wn-badge-new">Ambient</span>
          <span className="hp-wn-badge cookbook-hub-badge-surface cookbook-hub-badge-surface--api">API</span>
        </div>

        <h3 className="hp-io-method-card-title">Fetch Note Content with composition\_id</h3>

        <p className="hp-io-method-card-desc cookbook-hub-card-desc">
          Retrieve the note with composition\_id.
        </p>

        <div className="hp-io-method-card-meta tut-hub-card-foot" aria-label="5 min">
          <div className="tut-hub-card-foot-meta">
            <span className="hp-io-method-card-meta-time">5 min</span>
          </div>
        </div>
      </div>
    </a>
  </div>
</div>
