edutap.ai developers
Mooni Chat

API Reference

Direct HTTP API for Mooni chat

Most integrations use the <mooni-frame> Web Component, which calls these endpoints internally. Use this reference only if you need server-side or custom-client integration.

Base URL

EnvironmentBase URL
Productionhttps://tap-cs.coxwave.link

Authentication

All endpoints require the mooni-api-key header:

mooni-api-key: mooni_your_api_key_here

An invalid key returns 401.

POST /chat

Streams a chat response as Server-Sent Events.

Request

POST /chat
Content-Type: application/json
mooni-api-key: mooni_xxx
{
  "query": "How do I reset my password?",
  "sessionId": "550e8400-e29b-41d4-a716-446655440000",
  "userId": "user@example.com",
  "organizationId": "school-a"
}
FieldTypeRequiredDescription
querystringUser question. Trimmed. Max 500 chars.
sessionIdstringoptionalConversation identifier (UUID recommended). Required for admin-side persistence.
userIdstring | nulloptionalHost-site user ID. Null/absent → anonymous session.
organizationIdstringoptionalFilter FAQ search by organization. When omitted, the search covers the tenant's entire FAQ set. Used when a single tenant serves multiple organizations.

Response (Server-Sent Events)

Content-Type: text/event-stream. Events are JSON payloads in data: lines, terminated by data: [DONE].

Event typePayloadWhen
status{ status: "searching", level: "loading" }Search started
status{ status: "out_of_scope", level: "warning" }No suitable FAQ match found
text{ content: "..." }Answer text chunk
faq{ results: [...] }Related FAQ suggestions, if any
status{ status: "done", level: "success" }Stream complete
error{ message: "search_failed" }Server-side error (followed by [DONE])

Example stream:

data: {"type":"status","status":"searching","level":"loading"}

data: {"type":"text","content":"To reset your password, "}

data: {"type":"text","content":"go to Settings → "}

data: {"type":"text","content":"Account → Reset."}

data: {"type":"faq","results":[{"id":"faq_1","title":"Password recovery"}]}

data: {"type":"status","status":"done","level":"success"}

data: [DONE]

Errors

StatusBodyCause
400{"error":"invalid_json"}Body is not valid JSON
400{"error":"missing_query"}query empty or not a string
400{"error":"query_too_long","maxLength":500}query exceeds 500 chars
401Missing or invalid mooni-api-key

GET /config

Returns tenant-public configuration (display name, etc).

GET /config
mooni-api-key: mooni_xxx
{
  "clientId": "a1b2c3d4e5f6a7b8c9d0e1f2",
  "name": "Display name"
}

Schema may change — do not depend on it in production logic; use the Web Component instead.

GET /history/sessions

Returns past sessions for a given user.

GET /history/sessions?userId=user@example.com
mooni-api-key: mooni_xxx
Query parameterRequiredDescription
userIdUser ID whose sessions to fetch.

Response: { items: [...] } — list of sessions.

Persistence Behavior

  • Sessions and messages are recorded in admin only when sessionId is provided.
  • A user record is created in admin only when userId is present.
  • A recording failure never affects the chat response.