API 参考
认证POST

开始验证码认证

启动验证码登录流程。调用后通过 /auth/code 提交渠道验证码;若需要二次验证,再调用 /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 路由的标识符。

请求体

该接口无需 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"
  }
}