---
title: "Answer a query using Retrieval-Augmented Generation (RAG)"
method: POST
path: "/rag/rag_session"
tags: ["rag"]
---

# Answer a query using Retrieval-Augmented Generation (RAG)

`POST /rag/rag_session`

## Query parameters

- `proj_id` integer, required
- `top_k` integer, required
- `threshold` number, required
- `model` string, required
- `session_id` string, nullable

## Request body

- BodyRagRagSession
  - `query` union, required
    - string
    - string[]
    - integer
  - `sdoc_ids` integer[], nullable, required

## Response `200`

Successful Response

- ChatSessionResponse
  - `response` string, required — The response of the model
  - `session_id` string, required — The session ID of the chat

## Other responses

- `422` — Validation Error

## Changes

> 73 revisions in range; 14 could not be searched.

- **2026-06-30** `ea28bda836c5` — 1 breaking
  - added the new required `query` request parameter `model`
- **2025-08-22** `53e769440a25` — 3 warning
  - deleted the `query` request parameter `model`
  - removed the optional property `detail/items/ctx` from the response with the `422` status
  - removed the optional property `detail/items/input` from the response with the `422` status

[Change history](https://skmtc.dev/uhh-lt/apis/discourse-analysis-tool-suite-api/changes/rag/rag_session/post.md)

---

[API](https://skmtc.dev/uhh-lt/apis/discourse-analysis-tool-suite-api.md) · [All operations](https://skmtc.dev/uhh-lt/apis/discourse-analysis-tool-suite-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/uhh-lt/discourse-analysis-tool-suite-api/revisions/a84d27ef7a0d/schema)
