> ## Documentation Index
> Fetch the complete documentation index at: https://docs.acedata.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# 刪除 AceDataCloud 平台 API 憑證

> Platform 整合指南 - Ace Data Cloud

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

> ℹ️ 本介面屬於 **AceDataCloud 平台管理 API**，統一前綴 `https://platform.acedata.cloud/api/v1/`。

## 介面概覽

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

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

## 驗證說明（如何取得帳戶權杖）

請求標頭：

```http theme={null}
Authorization: Bearer ${PLATFORM_TOKEN}
```

取得方式請見[管理 AceDataCloud 平台帳戶權杖](https://platform.acedata.cloud/documents/platform-token)。

## 路徑參數

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

## 請求範例

### cURL

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

### Python

```python theme={null}
import os
import requests

cred_id = "df3e1b1b-9e72-4c4f-9a83-1e23f7c8b4d6"
resp = requests.delete(
    f"https://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

```javascript theme={null}
const credId = 'df3e1b1b-9e72-4c4f-9a83-1e23f7c8b4d6'
const r = await fetch(`https://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 副本。如果你只是懷疑洩漏且仍想保留監控資料，應使用[輪換 AceDataCloud 平台 API 憑證](https://platform.acedata.cloud/documents/platform-credential-rotate)而不是刪除。
* **刪除不會退還該憑證已消耗的額度**。Application 餘額依消耗即時扣減，刪除憑證不影響餘額帳面。
* 刪除後可透過[API 憑證清單](https://platform.acedata.cloud/documents/platform-credential-list)依 `application_id` 重新確認剩餘憑證。
* **批次清理前先核對呼叫端**：清單目前沒有最後使用時間欄位；應結合部署設定和呼叫紀錄確認憑證不再使用，再逐一刪除。

## 相關介面

* [取得 AceDataCloud 平台 API 憑證清單](https://platform.acedata.cloud/documents/platform-credential-list)
* [輪換 AceDataCloud 平台 API 憑證](https://platform.acedata.cloud/documents/platform-credential-rotate) — 不刪除憑證僅更換 Token
* [建立 AceDataCloud 平台 API 憑證](https://platform.acedata.cloud/documents/platform-credential-create)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.