---
title: "Preprocess Rag Query"
method: POST
path: "/api/v3/rag/preprocess"
tags: ["RAG"]
---

# Preprocess Rag Query

`POST /api/v3/rag/preprocess`

Preprocess a RAG query

Args:
    description: User's query/prompt
    search_category: Category to search (e.g., meeting_minutes, procurement_guidelines, youtube)
    keyword_config: Optional keywords and search logic (AND/OR)
    date_range: Optional date range filter

Returns:
    Preprocessed query data including extracted keywords and embeddings

## Request body

- RagPreprocessRequest
  - `description` string, required
  - `search_category` string, required
  - `keyword_config` AppRoutesV3RagKeywordConfig
    - `logic` 'AND' | 'OR', required
    - `keywords` string[], required
  - `date_range` AppRoutesV3RagDateRange
    - `from` string, date-time, nullable
    - `to` string, date-time, nullable

## Response `200`

Successful Response

- RagPreprocessResponse
  - `preprocessed_data` object, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/nationgraph/apis/nationgraph-api.md) · [All operations](https://skmtc.net/nationgraph/apis/nationgraph-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/nationgraph/nationgraph-api/revisions/85804e68d86d/schema)
