---
title: "Chat"
method: POST
path: "/api/knowledge/chat"
---

# Chat

`POST /api/knowledge/chat`

Ask a question against the farm's knowledge base. Works for both admins and workers.

## Request body

- KnowledgeChatRequest
  - `question` string, required
  - `language` string, nullable
  - `history` ChatMessage[]
    - `role` 'user' | 'assistant', required
    - `content` string, required

## Response `200`

Successful Response

- KnowledgeChatResponse
  - `answer` string, required
  - `citations` object[]

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/nexa/apis/farm-intel-api.md) · [All operations](https://skmtc.dev/nexa/apis/farm-intel-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/nexa/farm-intel-api/revisions/b1933769082d/schema)
