# DELETE /api/auth/sessions/:id

Canonical URL: https://developers.iagenify.com/zh/api/auth/revoke-session/
Language: zh

`DELETE https://api.iagenify.com/api/auth/sessions/:id`

撤销一个由认证账户拥有的当前会话 。

Status: Bearer 或 API 密钥 · 破坏性操作 · JSON

## HTTP 请求 {#http}

```bash
curl https://api.iagenify.com/api/auth/sessions/SESSION_ID \
  -X DELETE \
  -H "Authorization: Bearer $IAGENIFY_TOKEN"
```

## JavaScript {#javascript}

```javascript
const response = await fetch("https://api.iagenify.com/api/auth/sessions/SESSION_ID", {
  method: "DELETE",
  headers: { Authorization: `Bearer ${process.env.IAGENIFY_TOKEN}` },
});
const result = await response.json();
if (!response.ok) throw new Error(result.error);
```

## Python {#python}

```python
import os, requests

response = requests.request(
    "DELETE",
    "https://api.iagenify.com/api/auth/sessions/SESSION_ID",
    headers={"Authorization": "Bearer " + os.environ["IAGENIFY_TOKEN"]},
    timeout=30,
)
response.raise_for_status()
result = response.json()
```

## 路径路径参数 {#path}

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `id` | string | 必填 | 以列表会话终点返回的会话标识符 。 |

## 成功响应 {#response}

```javascript
{ ok: true }
```

## 错误 {#errors}

| 代码 | 状态 | 含义 |
| --- | --- | --- |
| session_not_found | 404 | 此标识符的会话不属于此账户 。 |
