Skip to main content
POST
/
api
/
ai
/
personal
/
qanda
Send a message to the AI assistant
curl --request POST \
  --url https://pria.praxislxp.com/api/ai/personal/qanda \
  --header 'Content-Type: application/json' \
  --header 'x-access-token: <api-key>' \
  --data '
{
  "id": 1750660464754,
  "requestArgs": {
    "userISODate": "2025-06-23T06:34:24.754Z",
    "userTimezone": "America/New_York",
    "socketId": "DhXE7OVjCtfUmDFTAAAB",
    "selectedCourse": {
      "course_id": 1750532703472,
      "course_name": "Research Discussion",
      "assistant": {
        "_id": "6856fa89cbafcff8d98680f5"
      }
    },
    "ragOnly": false
  },
  "inputs": [
    "What is machine learning?"
  ],
  "outputs": []
}
'
{
  "success": true,
  "streamingFailed": false,
  "outputs": [
    "Machine learning is a subset of artificial intelligence..."
  ],
  "usage": 1234,
  "credits": 5,
  "query_duration_ms": 2500,
  "model": "gpt-4o"
}

Authorizations

x-access-token
string
header
required

JWT token passed in x-access-token header

Body

application/json

Request payload for AI Q&A conversation

inputs
string[]
required

User messages to send to the AI

Example:
["What is machine learning?"]
id
number

Client-generated request identifier (epoch timestamp)

Example:

1750660464754

requestArgs
object

Context arguments for AI conversation requests

outputs
string[]

Previous AI responses (for context continuity)

Example:
[]

Response

AI response generated successfully

Response from AI Q&A conversation

success
boolean

Whether the request completed successfully

streamingFailed
boolean

True if Socket.IO streaming failed (response still contains full output)

streamingError
string

Error message if streaming failed

outputs
string[]

AI-generated response messages

usage
number

Total tokens consumed (input + output)

credits
number

Credits consumed for this request

creditsUsed
number

User's total credits consumed

totalCredits
number

User's remaining credit balance

query_duration_ms
number

Total processing time in milliseconds

model
string

AI model identifier used for generation

Example:

"gpt-4o"