---
title: "Get in-session context for a session (internal service-to-service)"
method: GET
path: "/api/ai/in-session-context/{sessionId}"
tags: ["AI"]
---

# Get in-session context for a session (internal service-to-service)

`GET /api/ai/in-session-context/{sessionId}`

## Request

- Base URL: `https://api.production.yourmedley.com`
- URL: `https://api.production.yourmedley.com/api/ai/in-session-context/{sessionId}`
- Auth: none declared. Required headers: `x-internal-key`

Internal-only endpoint consumed by the session-intelligence microservice to pull authoritative cohort/session context for in-session AI nudges. Authenticated by the shared-secret `x-internal-key` header (NOT coach bearer auth). Returns the session's topic, guide content, duration, and group participant roster. Field names match session-intelligence's `StartSessionData`/`ParticipantContext` so the caller maps them directly.
Responds **503** when `INTERNAL_API_KEY` is not configured (the internal surface is unavailable; callers should fall back to the legacy path) and **401** when the key is missing or incorrect.

## Path parameters

- `sessionId` string, uuid, required

## Headers

- `x-internal-key` string, required

## Response `200`

In-session context for the session.

- object
  - `success` boolean
  - `data` object
    - `sessionId` string, uuid
    - `cohortId` string, uuid
    - `topicName` string
    - `guideContent` string, nullable: Plain-text session guide, or null when none is uploaded.
    - `durationMinutes` integer
    - `segmentTiming` object, nullable: Pacing windows; always null today (caller defaults it).
    - `participants` object[]
      - `firstName` string
      - `lastName` string
      - `primaryGoal` string, nullable
      - `developmentGoal` string, nullable
      - `role` string, nullable
      - `businessUnit` string, nullable

## Other responses

- `401`: Missing or incorrect `x-internal-key` header.
- `404`: Session not found.
- `503`: INTERNAL_API_KEY not configured on medley-api.

---

[API](https://skmtc.dev/withmedley/apis/medley-api.md) - [All operations](https://skmtc.dev/withmedley/apis/medley-api/llms.txt) - [OpenAPI document](https://skmtc.dev/withmedley/apis/medley-api/revisions/40aaac5ca6bd?raw)
