HyperSaaS
BackendAI Chat

API Endpoints

REST API for chat sessions, messages, and sharing.

Chat Sessions

All endpoints are scoped to a workspace:

MethodEndpointDescription
GET/api/workspaces/{ws}/chats/List sessions
POST/api/workspaces/{ws}/chats/Create session
GET/api/workspaces/{ws}/chats/{id}/Retrieve session
PUT/api/workspaces/{ws}/chats/{id}/Update session
DELETE/api/workspaces/{ws}/chats/{id}/Delete session
POST/api/workspaces/{ws}/chats/{id}/toggle-public/Toggle public sharing
POST/api/workspaces/{ws}/chats/{id}/share/Share with a user
GET/api/workspaces/{ws}/chats/{id}/shares/List shares
POST/api/workspaces/{ws}/chats/{id}/revoke-share/Revoke a share

Create Session

POST /api/workspaces/{workspace_id}/chats/
{
  "name": "Research Chat",
  "ai_provider": "google",
  "ai_model": "gemini-2.5-pro",
  "system_prompt": "You are a helpful research assistant.",
  "temperature": 0.7,
  "agent_framework": "langgraph"
}

The system checks credit availability before creating the session.

Messages

MethodEndpointDescription
GET/api/workspaces/{ws}/chats/{session}/messages/List messages
POST/api/workspaces/{ws}/chats/{session}/messages/Send message
GET/api/workspaces/{ws}/chats/{session}/messages/{id}/Retrieve message
DELETE/api/workspaces/{ws}/chats/{session}/messages/{id}/Delete message
POST/api/workspaces/{ws}/chats/{session}/messages/regenerate/Regenerate last response
GET/api/workspaces/{ws}/chats/{session}/messages/agent-task-status/{task_id}/Poll async task

Send Message

POST /api/workspaces/{workspace_id}/chats/{session_id}/messages/
{
  "role": "user",
  "content": "What is the capital of France?"
}

Sync response (when AGENT_ASYNC_ENABLED=False):

Returns the saved user message and AI response messages.

Async response (when AGENT_ASYNC_ENABLED=True):

{
  "task_id": "abc123-...",
  "status": "processing"
}

Poll the task status endpoint until completion:

GET /api/workspaces/{ws}/chats/{session}/messages/agent-task-status/abc123-/

Regenerate Response

POST /api/workspaces/{ws}/chats/{session}/messages/regenerate/

Re-invokes the AI handler for the last user message and replaces the assistant response.

Public Shared Sessions

GET /api/chats/shared/{link_uuid}/

Returns a read-only view of a public chat session. No authentication required.

Audio Transcription

POST /api/transcribe-audio/

Multipart form with audio_file, workspace_id, and language. Uses OpenAI Whisper for speech-to-text.

Translation

GET /api/workspaces/{ws}/translate/?text=hello&target=es

Translates text using the configured AI provider.

On this page