# Delete workflow template

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

Delete a workflow template. Deleting a custom template only affects the current workspace; deleting a built-in template requires administrator privileges. This operation is irreversible.

```text
DELETE https://moi.matrixorigin.cn/newmoi/workflow-templates/{id}
```

## Preparation before calling

First [query workflow template details](get-workflow-template.md) to confirm the template to be deleted. Prepare a personal access token and target workspace ID that has access to the target workspace. Deleting built-in templates also requires administrator rights.


## Request parameters

::::{div} mo-api-split
:::{div} mo-api-split-main

```{raw} html
<dl class="mo-api-fields">

</dl>
```

:::
:::{div} mo-api-split-aside

```{raw} html
<p class="mo-api-example-label">Request example</p>
```

```bash
curl -X DELETE "https://moi.matrixorigin.cn/newmoi/workflow-templates/$TEMPLATE_ID" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

:::
::::

## Successful response

The template was removed when `code` was `OK` and `data.message` was `deleted` in the response. Deletion is irreversible.


The response fields are as follows.

::::{div} mo-api-split
:::{div} mo-api-split-main

```{raw} html
<dl class="mo-api-fields">
  <div class="mo-api-field"><dt><code>code</code><span class="mo-api-field__type">string</span></dt><dd>OK when successful.</dd></div>
  <div class="mo-api-field"><dt><code>msg</code><span class="mo-api-field__type">string</span></dt><dd>OK when successful.</dd></div>
  <div class="mo-api-field"><dt><code>data.message</code><span class="mo-api-field__type">string</span></dt><dd>Fixed to deleted, indicating that the template has been deleted.</dd></div>
</dl>
```

:::
:::{div} mo-api-split-aside

```{raw} html
<p class="mo-api-example-label">Successful response example</p>
```

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "message": "deleted"
  }
}
```

:::
::::

## Error response

::::{div} mo-api-split
:::{div} mo-api-split-main

```{raw} html
<dl class="mo-api-fields">
  <div class="mo-api-field"><dt><code>code</code><span class="mo-api-field__type">string</span></dt><dd>Error code.</dd></div>
  <div class="mo-api-field"><dt><code>msg</code><span class="mo-api-field__type">string</span></dt><dd>Readable error message.</dd></div>
  <div class="mo-api-field"><dt><code>data</code><span class="mo-api-field__type">null</span></dt><dd>`null` in an error response.</dd></div>
</dl>
```

:::
:::{div} mo-api-split-aside

```{raw} html
<p class="mo-api-example-label">Error response example</p>
```

```json
{
  "code": "ErrSeedTemplateManaged",
  "msg": "系统管理的模板不允许修改",
  "data": null
}
```

:::
::::

## Follow-up operations

[Query workflow template list](list-workflow-templates.md) confirms that the template has been removed.
