API 參考
認證POST

開始驗證碼認證

啟動驗證碼登入流程。Call 完之後請用 /auth/code 提交渠道驗證碼;如果需要兩步驗證,再 call /auth/password。WhatsApp 都係用呢條介面做手機號配對 — 手機號會由帳號入面讀出(建立帳號嗰陣已經透過 provider_data.phone 保存),呢度唔使再重複傳入。

https://api.unifyport.ai/v1/accounts/{account_id}/auth/start

請求標頭

X-Api-Key
string必填

工作區 API Key,工作區會由呢個標頭解析得出嚟。

Content-Type
string必填

發送 JSON 請求內容嘅時候請用 application/json。

路徑參數

account_id
string必填

用嚟識別嗰條 authentication 路由嘅 ID。

請求內容

呢個介面唔需要 JSON 請求內容。

回應內容

account_id
string

呢個回應所指嘅渠道帳號。

status
string

而家認證流程嘅狀態,例如 awaiting_code、awaiting_qr_scan、authorized 或者 cancelled。

auth_fields
object[]

講明下一步要乜嘢 — 每一項都帶住一個 type,仲有係咪必填。

auth_payload
object

客戶端渲染下一步要用嘅材料,例如 qr_code 或者 verify_code。

expires_at
string

RFC3339 時間戳,過咗呢個時間之後而家個 auth_payload 就唔再有效。

回應

200
200 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"
  }
}