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

# 丢弃草稿

> 丢弃草稿；从未发布过的 App 会连同身份一起删除。

## 端点

```
DELETE https://api-datahub.bazhuayu.com/v1/data-apps/{app_id}/workspace
```

认证：需要 API Key，且仅 App 作者（发布者本人）可调用；其他人得到 `404`。

丢弃草稿。如果 App 没有任何 Release，身份随之级联删除（不保留未发布的空壳；名称绑定的历史占用不受影响，那是防抢注语义）。Build 快照保留，由回收机制处理。

没有草稿不会直接短路成 `404`：无草稿且零 Release 的身份（历史孤儿）同样走级联清理，否则孤儿永远删不掉；无草稿但已有 Release 才是 `404`。

## 请求

### 路径参数

<ParamField path="app_id" type="string" required>
  App 引用。
</ParamField>

### 示例请求

```bash theme={null}
curl -X DELETE \
  -H "Authorization: Bearer $BAZHUAYU_API_KEY" \
  "https://api-datahub.bazhuayu.com/v1/data-apps/carol/reviews-query/workspace"
```

## 响应

### 200 成功

```json theme={null}
{
  "data": {
    "deleted": false,
    "app_deleted": false
  }
}
```

响应包在 `data` 字段中，其内容如下。

<ResponseField name="deleted" type="boolean" required>
  是否删除了草稿。
</ResponseField>

<ResponseField name="app_deleted" type="boolean">
  —
</ResponseField>

### 错误

| HTTP | `code` | `category` | 说明 |
| - | - | - | - |
| 401 | `unauthorized` | `forbidden` | 缺少或无效的 API Key。 |
| 404 | `workspace-not-found` | `not_found` | 该 App 没有进行中的草稿。这是主路径上的正常状态，不是故障。 |

错误响应统一为 `{"error": {code, category, message, retryable}}`，见<a href="/docs/zh/datahub/api/reference/introduction#错误" target="_blank" rel="noopener noreferrer">错误</a>。

## 客户端库

Python 与 JavaScript SDK 暂未封装此端点，请直接调用 REST。


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