Welcome to the Praxis AI API reference documentation. This section provides detailed information about the Praxis AI API endpoints, request formats, and response structures to help you integrate Praxis AI’s capabilities directly into your applications.
This page provides a quick, actionable path to authenticate, call REST endpoints, and capture streaming events from the middleware.
All API requests require an authorization token issued after successful authentication. See the Authentication API for how to sign in and use the token in requests.
You can connect to Praxis AI middleware to receive streaming events while REST requests are in-flight. The server emits stream chunks to your socket; you must include the current socket ID in Q&A requests to link streams to your session.
These are typical events payload received from the stream
Copy
{ "prompt": " I'm doing great, thank you for asking! 😊 I'm here, energized, and ready to help you with whatever you need today.Since we last spoke just a minute ago when you checked if I was here, I'm curious—what's on your mind? Are you: - Looking to learn something new? - Working on a project or assignment? - Curious about a specific topic? - Just wanting to chat? I'm all ears and ready to assist! What would you like to explore", "delta": " What would you like to explore", "type": "STREAM"}
prompt: Contains the full response from the beginning of the interaction.delta Contains only the last text segment reportedtype: “STREAM” for messages streamed by the LLM
Note that the final response may differ from the prompt returned while streaming.
When the QANDA request response includes "streamingFailed": true, it indicates that the middleware has lost the backend Socket ID mapping (user email to client socket ID), preventing it from communicating response chunks back to the client. This typically occurs when multiple browser windows or tabs are open for the same user email, causing them to compete for the same backend session and overwriting each other’s socket registrations. To resolve this issue, you can re-establish the socket connection to re-register the most current client handle and restore proper communication between the middleware and the active client session.
Copy
if (response?.streamingFailed){ // reconnecting if (state.socket.connected){ await state.socket.disconnect() } await state.socket.connect()}
To abort a request while executing, emit a cancel_request event:
Copy
state.socket.emit('cancel_request', user);
The cancel_request message signals the controller API to interrupt the ongoing communication and attempt a graceful termination of the conversation. While the controller works to terminate resources cleanly, there may be a slight delay before the process completes. You will only be charged for any partial response generated up to the point of cancellation.
The endpoint returns text/event-stream; charset=utf-8 content type with SSE-formatted JSON chunks. Each line is prefixed with data: followed by a JSON object and two newlines.
data: {"type":"connected","message":"Stream connected"}data: {"type":"stream","prompt":"The capital","delta":"The capital"}data: {"type":"stream","prompt":"The capital of France","delta":" of France"}data: {"type":"stream","prompt":"The capital of France is Paris.","delta":" is Paris."}data: {"type":"tool_call","call_id":"tooluse_abc123","name":"search_uploads","arguments":null,"displayInfo":{"icon":"search","label":"Searching documents"}}data: {"type":"tool_result","call_id":"tooluse_abc123","name":"search_uploads","arguments":{"query":"France capital"},"response":"...","responseLength":512,"responseDurationMs":150,"success":true}data: {"type":"complete","success":true,"usage":1234,"outputs":["The capital of France is Paris."],"model":"us.anthropic.claude-sonnet-4-5-20250929-v1:0","cached":0,"completion":42}data: {"type":"done"}
The prompt field is cumulative (full response up to this point). The delta field contains only the new characters since the last event. Use delta for incremental UI rendering and prompt for the current full text.
To cancel an in-flight HTTP stream request, you can abort the fetch request:
Copy
const controller = new AbortController();// Start the request with abort signalconst response = await fetch('https://pria.praxislxp.com/api/ai/personal-stream/qanda-stream', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-access-token': token }, body: JSON.stringify({ inputs: ['Your prompt here'], requestArgs: { assistantId: '...' } }), signal: controller.signal // Pass the abort signal});// Later, to cancel:controller.abort();
The HTTP SSE endpoint is stateless - each request is independent. This makes it ideal for serverless functions, CLI tools, and microservices where maintaining WebSocket connections is impractical.
While the API provides direct access to all capabilities, the TypeScript/JavaScript SDK simplifies most tasks.
API Benefits
• Direct access to all Praxis features
• Language-agnostic integration
• Fine-grained request/response control
• Ideal for custom platforms or gateways, mobile applications
SDK Benefits
• Higher-level abstractions
• Seamless SSO authentication
• UI Ready to use
• Supports LMS Such as Canvas, Moodle, D2L, LTI
For most use cases, we recommend using our SDKs, while the API remains available for mobile applications, low-level or platform-neutral integrations.