https://opencloud.100thy.com
註冊新用戶
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 https://opencloud.100thy.com/api/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"test@example.com","password":"password123"}'
curl https://opencloud.100thy.com/api/dashboard \
-H "Authorization: Bearer {your_token}"
curl -X PUT https://opencloud.100thy.com/api/user/matrix \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{"matrixId":"@user:matrix.example.com"}'
取得目前使用者的所有號碼
Header:Authorization: Bearer {token}
{
"numbers": [
{
"id": "uuid",
"number": "+999123456789",
"alias": "業務專線",
"created_at": 1712000000000
}
]
}
建立新號碼
Header:Authorization: Bearer {token}
{
"alias": "業務專線",
"pin": "1234",
"captchaToken": "uuid"
}
{
"id": "uuid",
"number": "+999123456789",
"alias": "業務專線",
"created_at": 1712000000000
}
限制:每個用戶最多 5 個號碼
更新號碼別名
{"alias": "新別名"}
更改 PIN
{
"currentPin": "1234",
"newPin": "5678"
}
注意:需驗證目前 PIN
刪除號碼。刪除後相關通話記錄也會一併移除。
取得通話記錄列表
Query 參數:
status — answered | missed | blocked | all(預設 all)limit — 每頁數量(預設 50)offset — 分頁偏移(預設 0){
"history": [
{
"id": "uuid",
"number_id": "uuid",
"caller_num": "+886912345678",
"status": "answered",
"duration": 45,
"created_at": 1712000000000,
"number": "+999123456789",
"alias": "業務專線"
}
],
"total": 128,
"limit": 50,
"offset": 0
}
取得驗證題目(簡單數學加法)
{
"a": 3,
"b": 7,
"question": "3 + 7 = ?"
}
驗證答案,正確後取得 token(10 分鐘內有效)
{
"a": 3,
"b": 7,
"answer": 10
}
→ 成功:
{ "token": "uuid" }
→ 失敗:
{ "error": "答案錯誤" }