刪除零壹AI 平台 API 憑證

永久刪除一枚 API 憑證。刪除後立即無法恢復,所有正在使用該 Token 的業務介面會馬上收到 401。

ℹ️ 本介面屬於 零壹AI 平台管理 API,統一前綴 https://01ai.platform.acedata.cloud/api/v1/。

介面概覽

項 內容
方法 DELETE
URL https://01ai.platform.acedata.cloud/api/v1/credentials/{credential_id}
驗證 ✅ 需要帳戶權杖

/credentials/{id} 與 /credentials/{id}/ 目前都可用;範例統一使用無結尾斜線形式。

驗證說明(如何取得帳戶權杖)

請求標頭:

Authorization: Bearer ${PLATFORM_TOKEN}

取得方式請見管理零壹AI 平台帳戶權杖。

路徑參數

參數 類型 必填 說明
credential_id UUID ✅ 要刪除的憑證 ID

請求範例

cURL

curl -X DELETE 'https://01ai.platform.acedata.cloud/api/v1/credentials/df3e1b1b-9e72-4c4f-9a83-1e23f7c8b4d6' \
  -H "authorization: Bearer ${PLATFORM_TOKEN}"

Python

import os
import requests

cred_id = "df3e1b1b-9e72-4c4f-9a83-1e23f7c8b4d6"
resp = requests.delete(
    f"https://01ai.platform.acedata.cloud/api/v1/credentials/{cred_id}",
    headers={"authorization": f"Bearer {os.environ['PLATFORM_TOKEN']}"},
    timeout=10,
)
assert resp.status_code == 204, resp.text
print("✅ 已删除")

Node.js

const credId = 'df3e1b1b-9e72-4c4f-9a83-1e23f7c8b4d6'
const r = await fetch(`https://01ai.platform.acedata.cloud/api/v1/credentials/${credId}`, {
  method: 'DELETE',
  headers: { authorization: `Bearer ${process.env.PLATFORM_TOKEN}` },
})
console.log('status:', r.status) // 204

回應

  • 成功:HTTP 204 No Content,無回應主體。
  • 失敗:回傳錯誤 JSON,請見下表。

錯誤處理

HTTP code 含義
401 not_authenticated 缺少帳戶權杖
403 permission_denied 該憑證不屬於你
404 not_found 憑證不存在或已被刪除

實用提示

  • 刪除不可逆——平台不保留 Token 副本。如果你只是懷疑洩漏且仍想保留監控資料,應使用輪換零壹AI 平台 API 憑證而不是刪除。
  • 刪除不會退還該憑證已消耗的額度。Application 餘額依消耗即時扣減,刪除憑證不影響餘額帳面。
  • 刪除後可透過API 憑證清單依 application_id 重新確認剩餘憑證。
  • 批次清理前先核對呼叫端:清單目前沒有最後使用時間欄位;應結合部署設定和呼叫紀錄確認憑證不再使用,再逐一刪除。

相關介面