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

# Get Note Context

> Retrieve Ambient note context aggregated across Ambient sessions

Use this endpoint to get ambient note context aggregated across ambient sessions.
The response `context` object can include fileds related to the visit context aggregated across sessions in the note.

To know the supported visit type, encounter type, and provider role values, refer to the ambient [Info](/api-reference/info/information) endpoint.

Use `composition_id` from [Create ambient session](/api-reference/ambient-sessions/create) as `note_id`.

## Code examples

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

    BASE_URL = "https://sdp.suki.ai"

    # Use composition_id from Create Ambient Session as note_id
    note_id = "<composition_id>"

    # Get sdp_suki_token from Login: POST /api/v1/auth/login
    sdp_suki_token = "<sdp_suki_token>"

    # Required for single_auth partners
    sdp_provider_id = "<sdp_provider_id>"

    url = f"{BASE_URL}/api/v1/ambient/note/{note_id}/context"

    headers = {
        "sdp_suki_token": sdp_suki_token,
        "sdp_provider_id": sdp_provider_id,
    }

    response = requests.get(url, headers=headers, timeout=60)

    print("HTTP status:", response.status_code)

    try:
        response_body = response.json()
    except ValueError:
        print("Response was not JSON:")
        print(response.text)
        raise SystemExit(1)

    print("Response body:")
    print(json.dumps(response_body, indent=2))

    if response.status_code == 200:
        context = response_body.get("context") or {}

        print("visit_type:", context.get("visit_type"))
        print("encounter_type:", context.get("encounter_type"))
        print("provider_role:", context.get("provider_role"))
        print("reason_for_visit:", context.get("reason_for_visit"))
        print("chief_complaint:", context.get("chief_complaint"))
    else:
        print("Get Note Context failed.")
        if isinstance(response_body, dict):
            print("code:", response_body.get("code"))
            print("message:", response_body.get("message"))
    ```
  </Tab>

  <Tab title="TypeScript">
    ```typescript expandable theme={"theme":{"light":"github-dark","dark":"material-theme-darker"}}
    const BASE_URL = "https://sdp.suki.ai";

    // Use composition_id from Create Ambient Session as note_id
    const noteId = "<composition_id>";

    // Get sdp_suki_token from Login: POST /api/v1/auth/login
    const sdpSukiToken = "<sdp_suki_token>";

    // Required for single_auth partners
    const sdpProviderId = "<sdp_provider_id>";

    type NoteContext = {
      visit_type?: string;
      encounter_type?: string;
      provider_role?: string;
      reason_for_visit?: string;
      chief_complaint?: string;
    };

    type GetNoteContextResponse = {
      context?: NoteContext;
    };

    type ApiErrorResponse = {
      code?: number;
      message?: string;
    };

    const response = await fetch(
      `${BASE_URL}/api/v1/ambient/note/${noteId}/context`,
      {
        method: "GET",
        headers: {
          sdp_suki_token: sdpSukiToken,
          sdp_provider_id: sdpProviderId,
        },
      }
    );

    const responseText = await response.text();
    let responseBody: GetNoteContextResponse | ApiErrorResponse | unknown;

    try {
      responseBody = responseText ? JSON.parse(responseText) : {};
    } catch {
      console.error("Response was not JSON:");
      console.error(responseText);
      throw new Error("Get Note Context returned non-JSON response");
    }

    console.log("HTTP status:", response.status);
    console.log("Response body:", JSON.stringify(responseBody, null, 2));

    if (response.status === 200) {
      const payload = responseBody as GetNoteContextResponse;
      const context = payload.context || {};

      console.log("visit_type:", context.visit_type);
      console.log("encounter_type:", context.encounter_type);
      console.log("provider_role:", context.provider_role);
      console.log("reason_for_visit:", context.reason_for_visit);
      console.log("chief_complaint:", context.chief_complaint);
    } else {
      const error = responseBody as ApiErrorResponse;
      console.error("Get Note Context failed.");
      console.error("code:", error.code);
      console.error("message:", error.message);
    }
    ```
  </Tab>
</Tabs>


## OpenAPI

````yaml GET /api/v1/ambient/note/{note_id}/context
openapi: 3.0.1
info:
  title: Suki Developer Platform
  description: >-
    REST and WebSocket APIs for the Suki Developer Platform. Authenticate with
    Login or Register to obtain a Suki access token, then integrate ambient
    clinical documentation, form filling, transcription, and reference metadata
    endpoints.
  contact: {}
  version: '1.0'
servers:
  - url: https://sdp.suki.ai
    description: >-
      Production base URL for Suki Developer Platform REST APIs. WebSocket
      endpoints use the same host with `wss://`.
security:
  - SukiTokenAuth: []
paths:
  /api/v1/ambient/note/{note_id}/context:
    get:
      tags:
        - /api/v1/ambient/note
      summary: Gets the ambient context for a note.
      parameters:
        - $ref: '#/components/parameters/ProviderIdHeader'
        - name: note_id
          in: path
          required: true
          description: >-
            Note identifier. Use the `composition_id` returned from Ambient
            session create.
          schema:
            type: string
      responses:
        '200':
          description: Success Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/controllers.GetNoteContextResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/controllers.BadRequestError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/controllers.AuthenticationError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/controllers.NotFoundError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/controllers.InternalServerError'
      security:
        - SukiTokenAuth: []
components:
  parameters:
    ProviderIdHeader:
      name: sdp_provider_id
      in: header
      description: >-
        **Optional** for standard partners.


        **Required** for:


        - **Bearer authentication.** Use the same `provider_id` returned by the
        Login or Register API.

        - **Single Auth Token authentication.** Include the same `provider_id`
        on every request as `sdp_provider_id`.
      required: false
      schema:
        type: string
        example: provider-123
  schemas:
    controllers.GetNoteContextResponse:
      description: Visit context aggregated across sessions in the note.
      type: object
      properties:
        context:
          description: Note-level ambient context.
          allOf:
            - $ref: '#/components/schemas/controllers.NoteContext'
    controllers.BadRequestError:
      description: Bad Request Response
      type: object
      properties:
        code:
          type: integer
          example: 400
        message:
          type: string
          example: invalid request
    controllers.AuthenticationError:
      description: Authentication Failure Response
      type: object
      properties:
        code:
          type: integer
          example: 401
        message:
          type: string
          example: invalid token
    controllers.NotFoundError:
      description: Not Found Response
      type: object
      properties:
        code:
          type: integer
          example: 404
        message:
          type: string
          example: not found
    controllers.InternalServerError:
      description: Internal Server Error Response
      type: object
      properties:
        code:
          type: integer
          example: 500
        message:
          type: string
          example: internal server error
    controllers.NoteContext:
      description: Aggregated visit context for the note.
      type: object
      properties:
        chief_complaint:
          type: string
          example: Headache
          description: Chief complaint. Maximum 255 characters.
        encounter_type:
          type: string
          example: AMBULATORY
          description: Encounter type aggregated across sessions in the note.
        provider_role:
          type: string
          example: ATTENDING
          description: Provider role aggregated across sessions in the note.
        reason_for_visit:
          type: string
          example: Follow-up for migraines
          description: Reason for visit. Maximum 255 characters.
        visit_type:
          type: string
          example: ESTABLISHED_PATIENT
          description: Visit type aggregated across sessions in the note.
  securitySchemes:
    SukiTokenAuth:
      type: apiKey
      in: header
      name: sdp_suki_token
      description: >-
        Suki access token (`suki_token`) from Login or Register. Expires after
        one hour.

````