認證POST
開始驗證碼認證
啟動驗證碼登入流程。Call 完之後請用 /auth/code 提交渠道驗證碼;如果需要兩步驗證,再 call /auth/password。WhatsApp 都係用呢條介面做手機號配對 — 手機號會由帳號入面讀出(建立帳號嗰陣已經透過 provider_data.phone 保存),呢度唔使再重複傳入。
https://api.unifyport.ai/v1/accounts/{account_id}/auth/start請求標頭
X-Api-Keystring必填
工作區 API Key,工作區會由呢個標頭解析得出嚟。
Content-Typestring必填
發送 JSON 請求內容嘅時候請用 application/json。
路徑參數
account_idstring必填
用嚟識別嗰條 authentication 路由嘅 ID。
請求內容
呢個介面唔需要 JSON 請求內容。
回應內容
account_idstring
呢個回應所指嘅渠道帳號。
statusstring
而家認證流程嘅狀態,例如 awaiting_code、awaiting_qr_scan、authorized 或者 cancelled。
auth_fieldsobject[]
講明下一步要乜嘢 — 每一項都帶住一個 type,仲有係咪必填。
auth_payloadobject
客戶端渲染下一步要用嘅材料,例如 qr_code 或者 verify_code。
expires_atstring
RFC3339 時間戳,過咗呢個時間之後而家個 auth_payload 就唔再有效。
回應
200200 OK
請求成功,回應內容嘅例子如上。
400請求錯誤
請求內容、路徑或者參數無效。
401未授權
X-Api-Key 請求標頭缺少或者無效。
409衝突
目前操作同現有嘅渠道帳號或者資源衝突。
500伺服器錯誤
服務遇到咗未預期嘅錯誤。
請求
curl -X POST https://api.unifyport.ai/v1/accounts/{account_id}/auth/start \
-H "X-Api-Key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{}'回應
{
"data": {
"account_id": "acc_example",
"status": "awaiting_code",
"auth_fields": [
{ "type": "code", "required": true }
],
"auth_payload": {
"verify_code": "ABCD-EFGH"
},
"expires_at": "2026-01-01T00:00:00Z"
}
}