查詢餘額

    查詢目前 API Key 所屬使用者的餘額狀態。

    GET/api/v1/credits/balance
    欄位
    Base URLhttps://api.gate.ai
    認證Authorization: Bearer <API_KEY>
    格式Gate.AI REST JSON

    請求參數

    名稱位置類型必填說明
    AuthorizationheaderstringAPI Key 鑑權,格式:Bearer <API_KEY>

    返回欄位說明

    名稱類型說明
    codeinteger業務狀態碼。成功固定為 200。
    dataobject餘額資料。
    data.statusinteger餘額狀態:1 可交易,2 餘額不足,4 已欠費。
    data.messagestring狀態描述。
    data.asset_typestring資產歸屬類型:user_asset 個人資產,organization_asset 組織資產。
    data.recharge_balancestring充值餘額。
    data.debt_amountstring欠費金額;無欠費時為空字串或 0 值字串。

    回傳範例

    json
    1{2  "code": 200,3  "data": {4    "status": 1,5    "message": "可以交易",6    "asset_type": "user_asset",7    "recharge_balance": "12.34000000",8    "debt_amount": ""9  }10}

    回傳結果

    狀態碼狀態碼含義說明資料模型
    200OK查詢成功,回傳 code 和 data。CreditsBalanceResponse
    401UnauthorizedAPI Key 缺失、無效、過期、撤銷、禁用或未啟用。ErrorResponse
    403Forbidden目前 API Key 所屬成員無權限查看餘額。ErrorResponse
    429Too Many Requests觸發限流。ErrorResponse
    500Internal Server Error閘道內部錯誤,例如 API Key 查詢異常或回應序列化失敗。ErrorResponse
    502Bad Gateway餘額上游服務不可用、回傳非成功狀態、回應解析失敗或資料為空。ErrorResponse

    錯誤回傳範例

    json
    1{2  "error": {3    "type": "authentication_error",4    "code": "7022002001",5    "message": "invalid api key"6  }7}