API 參考

帳號

取得帳號

回傳單一帳號設定。基於安全考量,回應刻意不包含 provider_data 內的渠道機敏憑證。認證狀態 — 包括待掃描的 QR 碼與驗證碼 — 會由 Authentication 系列端點另行提供。

GEThttps://api.unifyport.ai/v1/accounts/{account_id}

呼叫前準備

在伺服器端使用資源所屬工作區的 X-Api-Key,執行範例前替換所有預留位置。

參數從哪裡取得
account_id
從建立或查詢帳號的回應取得 data.id。帳號屬於 X-Api-Key 對應的工作區。 取得帳號

請求參數

請求標頭

X-Api-Key
string必填

工作區 API Key,工作區會由此標頭解析得到。

路徑參數

account_id
string必填

用於該 accounts 路由的識別字。

請求內容

此介面無需 JSON 請求內容。

如何理解結果

依文件解讀回應欄位與 HTTP 狀態。204 成功沒有回應本文,排查時使用 X-Request-Id。下一步請參閱相關操作。

回應 200 OK

{
  "request_id": "<REQUEST_ID>",
  "data": {
    "id": "acc_example",
    "name": "Telegram Production",
    "provider": "telegram",
    "region": "global",
    "status": "active",
    "runtime_status": "running",
    "auth_mode": "qrcode",
    "capabilities": [
      "send_message",
      "receive_message"
    ],
    "metadata": {
      "env": "production"
    },
    "provider_account_ref": "provider-side-identifier",
    "provider_profile": {
      "id": "778899",
      "phone": "8600000000000",
      "username": "production_bot",
      "display_name": "Production Bot",
      "first_name": "Production",
      "last_name": "Bot",
      "avatar_url": "https://example.com/avatar.jpg",
      "bio": "Customer support"
    }
  }
}

回應內容

id
string

唯一的帳號識別字(acc_...)。請用於帳號層級的路由。

name
string

可讀的帳號名稱。

provider
string

管道識別碼。呼叫其他介面時原樣使用 API 回傳的值;此介面的回傳範圍請看下方列舉。

enum: telegram, whatsapp, line, twitter, zalo, tiktok, whatsapp-protocol

region
string

帳號所配置的渠道區域。

status
string

帳號生命週期狀態,例如 active。

runtime_status
string

標準化的執行階段狀態,為 unknown、starting、running、stopping、stopped、reconnecting、disconnected 或 error 其中之一。

enum: unknown, starting, running, stopping, stopped, reconnecting, disconnected, error

auth_mode
string

帳號使用的認證流程:code、qrcode 或 session。

capabilities[]
string[]

帳號已啟用的能力,例如 send_message 與 receive_message。

metadata
object

儲存於帳號、面向自有環境的標籤。

provider_account_ref
string

渠道側的識別字,可附加用於將帳號與自有系統關聯對應。

proxy
object

帳號綁定的對外 proxy 設定,未設定時省略。

provider_profile
object

渠道回報的個人檔案,例如 display_name。帳號認證完成前不會出現。

id
string

渠道側帳號識別字。WhatsApp 回傳 LID;帳號資料同步完成前可能省略。

phone
string

已正規化的帳號電話號碼,不含空格、連字號與開頭加號。

username
string

渠道回報的 username(若有)。

display_name
string

帳號展示名稱;WhatsApp 按 BusinessName 優先、PushName 回退的規則生成。

push_name
string

WhatsApp 目前帳號設定的 PushName;其他渠道未定義此欄位語義。

business_name
string

WhatsApp BusinessName;渠道未回傳時此欄位缺失。

first_name
string

渠道回報的名字(若有)。

last_name
string

渠道回報的姓氏(若有)。

avatar_url
string

渠道回報的帳號頭像 URL(若有)。

bio
string

渠道回報的帳號簡介或狀態文字(若有)。

platform
string

WhatsApp 配對時回報的登入平台識別字。請將它視為不透明字串並相容未知值;其他渠道未定義此欄位語義。此欄位與 device_platform 不同。

回應

200

200 OK

請求成功,回應內容範例如上。

401

未授權

X-Api-Key 請求標頭缺少或無效。

500

伺服器錯誤

服務遇到了未預期的錯誤。

失敗後如何處理

檢查 HTTP 狀態和 error.code/numeric_code,保留 request_id。依原因修正參數、繼續授權或檢查狀態。重試傳送及寫入前確認上次結果,避免重複操作。 錯誤碼參考

invalid_request · 10000 · 400
檢查必填欄位、格式與渠道條件,修正請求後再呼叫。
invalid_api_key · 11001 · 401
檢查 X-Api-Key 與工作區是否有效。