Skip to main content
POST
/
v1
/
mind
/
chat
Chat
curl --request POST \
  --url http://localhost:8000/v1/mind/chat \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "body": "<string>",
  "action": "free-chat",
  "context": {
    "channel": "student",
    "conversation_id": "<string>",
    "page": {
      "course_code": "<string>",
      "material_id": "<string>",
      "path": "<string>",
      "title": "<string>"
    }
  }
}
'
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}
The chat endpoint accepts a single message and streams the reply over Server-Sent Events. The interactive playground above covers the request; the response is a stream, documented here.
The playground sends the request but won’t render a streamed body. To see the live stream, use curl -N or the frontend client.

Request

{
  "action": "free-chat",
  "body": "Explain Newton's second law",
  "context": { "conversation_id": "1f0c…" }
}
action
string
default:"free-chat"
One of free-chat, explain-concept, submission-guide, advisor. Set a specific value when the student taps a quick action; otherwise leave free-chat and the router decides.
body
string
required
The student’s message (1–8000 characters).
context.conversation_id
string
The conversation to continue. Omit on the first message; the response returns one to reuse.
context.page
object
What the student is viewing — title, path, course_code, material_id. Used as a routing hint. All optional.

Response — the event stream

Content-Type: text/event-stream. Frames arrive in order:
meta
event
Emitted once after routing. { conversation_id, action, confidence } — the resolved lane.
delta
event
Emitted repeatedly. { text } — a chunk of the answer; concatenate in order.
done
event
Emitted once at the end. { conversation_id, action, revised, remaining }. revised is a guardrail-corrected final answer (usually null); remaining is the day’s quota left (null when unlimited).
message
event
Emitted instead of deltas when the turn is blocked. { text, reason } where reason is quota_exceeded, assessment_lock, or prompt_injection. Followed by done.

Example

curl -N -X POST https://staging-be.mind.miva.university/v1/mind/chat \
  -H "Authorization: Bearer <access_token>" \
  -H "Content-Type: application/json" \
  -d '{"action":"free-chat","body":"What is photosynthesis?","context":{"conversation_id":"demo-1"}}'
event: meta
data: {"conversation_id":"demo-1","action":"explain-concept","confidence":1.0}

event: delta
data: {"text":"Photosynthesis "}

event: delta
data: {"text":"is how plants make food."}

event: done
data: {"conversation_id":"demo-1","action":"explain-concept","revised":null,"remaining":null}
Send the next message with the same conversation_id and MIND continues the thread. See Streaming for the full frontend client and resumption.

Authorizations

Authorization
string
header
required

Enter your JWT access token

Body

application/json
body
string
required
Required string length: 1 - 8000
action
enum<string>
default:free-chat
Available options:
submission-guide,
advisor,
explain-concept,
free-chat
context
ChatContext · object

Response

Successful Response