← chatweb.ai

API Reference

Base URL: https://chatweb.ai — Auth: Bearer token or session cookie

Contents Chat (Streaming) Agents (Management) Auth (Authentication) Memory (Long-term) Schedule (Cron Tasks) Deploy (Site Publishing) A2A (Agent-to-Agent) Google Workspace Billing (Credits & Plans) Files & RAG Teams External API (v1) Webhooks

Chat

POST /chat/stream/{session_id} Auth SSE streaming chat (primary endpoint)
{
  "message": "Analyze competitors and email me a report",
  "session_id": "cw_xxx",
  "image_data": "",           // base64 image (optional)
  "preferred_agents": [],     // preset filter
  "preset_instruction": ""    // preset-specific prompt
}

SSE events: routed token tool plan_created plan_step plan_done cost memories_loaded hitl_required error

POST /chat/loop/{session_id} Auth Agent loop execution ([[CONTINUE]]/[[DONE]])
POST /chat/suggest Generate follow-up question suggestions
GET /history/{session_id} Get conversation history for a session
GET /sessions List all sessions
GET /search/messages Cross-session message search

Agents

GET /agents List all agents (with LLM mappings)
POST /agents/{agent_id}/fork Auth Fork a built-in agent (create custom version)
POST /agents/custom Create a new custom agent
GET /agents/custom List custom agents
PATCH /agents/{agent_id} Update agent prompt and settings
POST /agents/{agent_id}/model Change the LLM model for an agent
DELETE /agents/custom/{id} Delete a custom agent

Auth

GET /auth/me Login status, credit balance, LINE/Telegram links, AI name
GET /auth/google Start Google OAuth (redirect)
POST /auth/register Send Magic Link via email
{ "email": "user@example.com" }
GET /auth/verify?token=xxx Verify Magic Link
POST /auth/logout Logout
GET /link/code Auth Generate LINE/Telegram linking code (valid 10 min)
POST /link/verify Verify linking code and bind account

Memory

GET /memory/list List memories (sorted by importance)
GET /memory/search?q=xxx Keyword search across memories
POST /memory/add Add a memory
{ "content": "User prefers Python" }
DELETE /memory/{memory_id} Delete a memory

Schedule

POST /schedule/tasks Create a scheduled task
{
  "cron": "0 9 * * *",
  "agent_id": "research",
  "message": "Summarize AI news and send it to LINE",
  "enabled": true
}
GET /schedule/tasks List scheduled tasks
DELETE /schedule/tasks/{task_id} Delete a scheduled task

Deploy (Site Publishing)

POST /deploy/site Publish HTML to xxx.chatweb.ai
{
  "html": "<!DOCTYPE html>...full HTML...",
  "subdomain": "my-app",
  "title": "My App"
}

Response: {"url": "https://my-app.chatweb.ai", "ok": true}

GET /deploy/sites List published sites
PUT /deploy/site/{subdomain} Update a published site
DELETE /deploy/site/{subdomain} Delete a published site

A2A Protocol

GET /.well-known/agent-card.json Public A2A agent card (capabilities declaration)
POST /a2a/tasks/send Send an A2A task (delegation from external agent)

Google Workspace

All Google endpoints require completed Google OAuth. If not authenticated, the user is redirected to /auth/google.

GET /auth/google/status Auth Check Google integration status

Google operations are executed via agents (gmail, calendar, drive, sheets, docs, contacts, tasks). Instead of calling direct API endpoints, you instruct agents in chat: "Send an email," "Check my schedule," etc.

Billing

GET /billing/plans List available plans
POST /billing/create-checkout Auth Create a Stripe checkout session
POST /billing/webhook Receive Stripe webhook events
GET /usage/{session_id} Session usage and cost

Files & RAG

POST /upload Upload a file (PDF/Excel/CSV/image)
GET /upload/{file_id} Retrieve an uploaded file
POST /rag/index Index a document for RAG
GET /rag/search?q=xxx RAG vector search
POST /sql/query Execute SQL query (SELECT only)
POST /sql/csv_to_db Import CSV into a SQLite table

Teams

POST /teams Auth Create a team
GET /teams Auth List teams you belong to
POST /teams/{team_id}/invite Invite a team member
POST /teams/{team_id}/broadcast Broadcast a message to all team members

External API (v1)

Call chatweb.ai agents from external applications. Requires API key authentication.

POST /api/v1/chat API Key Chat via external API (SSE streaming)
Headers: X-API-Key: your_api_key
Body: { "message": "...", "session_id": "...", "agent_id": "research" }
GET /api/v1/agents API Key List agents (external API)
POST /api/keys Auth Generate an API key
GET /api/keys Auth List API keys

Webhooks

POST /webhook/{agent_id} Trigger an agent via webhook
POST /webhook/github GitHub webhook receiver
POST /telegram/webhook Telegram Bot webhook
POST /line/webhook LINE Messaging API webhook
POST /slack/events Slack Events API
POST /zapier/trigger Zapier webhook integration

Other

GET /health Public Health check
GET /metrics Prometheus metrics
GET /dashboard Dashboard statistics (JSON)
POST /tts Text-to-speech
POST /transcribe Speech-to-text
POST /vision/analyze Image analysis (Claude Vision)
POST /image/generate AI image generation
POST /send-to-messenger Auth Forward message to LINE/Telegram
POST /share/{session_id} Share a conversation via public link
GET /export/{session_id} Export conversation as Markdown/JSON

Authentication

Web Session

After logging in via Google OAuth or Magic Link, a session cookie is issued. All subsequent requests are authenticated automatically via this cookie.

API Key

/api/v1/* endpoints are authenticated with the X-API-Key header. You can generate API keys from the settings page.

curl -X POST https://chatweb.ai/api/v1/chat \
  -H "X-API-Key: your_key" \
  -H "Content-Type: application/json" \
  -d '{"message": "What is the weather in Tokyo?", "agent_id": "research"}'

Rate Limits

/chat /api /a2a30 requests / 60 seconds (per IP). Exceeding the limit returns 429 Too Many Requests.

SSE Streaming Format

data: {"type": "routed", "agent_id": "research", "confidence": 0.95}
data: {"type": "token", "text": "The weather"}
data: {"type": "token", "text": " in Tokyo"}
data: {"type": "tool", "tool": "web_search", "status": "calling"}
data: {"type": "tool", "tool": "web_search", "status": "done"}
data: {"type": "cost", "cost_usd": 0.001, "input_tokens": 500, "output_tokens": 200}
data: [DONE]