Skip to main content
POST
/
chatbot
/
chat
Chat
curl --request POST \
  --url https://api.example.com/chatbot/chat \
  --header 'Content-Type: application/json' \
  --data '
{
  "courseID": "<string>",
  "query": "<string>",
  "thread_id": [
    {}
  ]
}
'
{
  "answer": "<string>",
  "sources": [
    {
      "url": "<string>",
      "title": "<string>",
      "type": "<string>",
      "seconds": 123,
      "minutes": 123,
      "number": 123
    }
  ],
  "thread_id": [
    {}
  ]
}
Sends a student question to a course’s AI assistant and returns an answer along with YouTube source citations. This is a public endpoint — no authentication is required.
This endpoint does not require authentication. It is designed to be called directly from embedded chatbot widgets.

Request body

courseID
string
required
The ID of the course whose chatbot should answer the question.
query
string
required
The student’s question.
thread_id
array
Conversation history from a previous response. Pass back the thread_id value returned by the previous call to maintain multi-turn context. Omit on the first message in a new conversation.

Response

200 — Success

answer
string
required
The AI-generated answer to the student’s question.
sources
Citation[]
required
An array of YouTube source citations used to generate the answer.
thread_id
array
required
Updated conversation history. Pass this value back as thread_id in the next request to continue the conversation.

Examples

curl --request POST \
  --url http://localhost:8000/chatbot/chat \
  --header 'Content-Type: application/json' \
  --data '{
    "courseID": "64f1a2b3c4d5e6f7a8b9c0d1",
    "query": "What is the significance of horseshoe crabs?"
  }'
200
{
  "answer": "Horseshoe crabs are ecologically and medically significant. Their blood contains Limulus Amebocyte Lysate (LAL), which is used to test for bacterial endotoxins in medical equipment and vaccines [0].",
  "sources": [
    {
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ&t=183s",
      "title": "Marine Biology: Horseshoe Crabs and Their Role in Medicine",
      "type": "YouTube",
      "seconds": 3,
      "minutes": 3,
      "number": 0
    }
  ],
  "thread_id": []
}

Build docs developers (and LLMs) love