---
title: "Replace the peer leader's AI prompt In Use selections (AC1-AC2)"
method: PATCH
path: "/api/participant/sessions/{sessionId}/peer-leader-prep/ai-selections"
tags: ["Peer Leader Session Prep"]
---

# Replace the peer leader's AI prompt In Use selections (AC1-AC2)

`PATCH /api/participant/sessions/{sessionId}/peer-leader-prep/ai-selections`

## Request

- Base URL: `https://api.production.yourmedley.com`
- URL: `https://api.production.yourmedley.com/api/participant/sessions/{sessionId}/peer-leader-prep/ai-selections`
- Auth: HTTP bearer

MED-909 / E4.6 — replaces `peer_leader_session_prep.ai_prompt_selections`
atomically with the supplied document. The AC1 suggestions banner count
and AC2 per-step In Use badges both derive from this document. The row
is created lazily on the first selection.

Authorization: the caller must be the assigned `session_leader_id` for a
peer-led session. Rejected with 409 `AI_FEATURES_DISABLED` when the
cohort's modality has AI features off (the FE surface that writes here is
also absent in that case), and 410 once the session is live.

## Path parameters

- `sessionId` string, uuid, required

## Request body

- PeerLeaderUpdateAiSelectionsRequest
  - `selections` object, required: The full ai_prompt_selections document, keyed by agenda block_key. Each segment carries optional purpose/speaking/stall_recovery slots with an `in_use` boolean. Replaces the stored document atomically.

## Response `200`

Updated selections document.

- object
  - `success` boolean
  - `data` object
    - `ai_prompt_selections` object

## Other responses

- `400`: Validation error (selections must be an object)
- `401`: Unauthenticated
- `403`: Caller is not the assigned session leader / not peer-led
- `409`: AI features disabled for this cohort's modality
- `410`: Session is live — selections can no longer be edited

---

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