http://157.245.205.19:3000
註冊新用戶
Request Body:
{
"email": "user@example.com",
"password": "password123"
}
Response:
{
"token": "eyJhbGciOiJIUzI1NiJ9...",
"user": {
"id": "uuid",
"email": "user@example.com",
"apiKey": "occ_xxxxx..."
}
}
登入
Request Body:
{
"email": "user@example.com",
"password": "password123"
}
Response:
{
"token": "eyJhbGciOiJIUzI1NiJ9...",
"user": { "id": "uuid", "email": "...", "apiKey": "occ_..." }
}
取得目前用戶資料(需 Bearer Token)
Headers:Authorization: Bearer {token}
Response:
{
"id": "uuid",
"email": "user@example.com",
"plan": "free",
"matrixId": "@user:matrix.org",
"createdAt": 1712000000000
}
設定 Matrix ID(需 Bearer Token)
Headers:Authorization: Bearer {token}
Request Body:
{
"matrixId": "@yourname:matrix.example.com"
}
Response:
{
"success": true,
"matrixId": "@yourname:matrix.example.com"
}
重新產生 API Key(需 Bearer Token,舊 Key 立即失效)
Response:
{
"apiKey": "occ_newkey..."
}
取得完整 Dashboard 資料(需 Bearer Token)
Headers:Authorization: Bearer {token}
Response:
{
"email": "user@example.com",
"plan": "free",
"matrixId": "@user:matrix.org",
"apiKey": "occ_xxxx...",
"wsUrl": "ws://157.245.205.19:3000/ws?token=...",
"sessions": [
{
"id": "session-uuid",
"created_at": 1712000000000,
"last_seen": 1712000000000,
"active": 1
}
]
}
連線方式:使用 /api/dashboard 回傳的 wsUrl 直接 WebSocket 連線
發送訊息:
{
"type": "ping"
}
→ 回應:
{
"type": "pong",
"ts": 1712000000000
}
發送通話:
{
"type": "call",
"callId": "call-123",
"to": "+886912345678",
"message": "您好,幫我預約明天門診"
}
→ 回應:
{
"type": "call_ack",
"callId": "call-123",
"status": "queued"
}
curl -X POST http://157.245.205.19:3000/api/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"test@example.com","password":"password123"}'
curl http://157.245.205.19:3000/api/dashboard \
-H "Authorization: Bearer {your_token}"
curl -X PUT http://157.245.205.19:3000/api/user/matrix \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{"matrixId":"@user:matrix.example.com"}'