# Delete workflow job

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

Delete a workflow job record. This operation is irreversible.

```text
DELETE https://moi.matrixorigin.cn/newmoi/workflow/v2/workflow-apps/{workflow_id}/executions/{execution_id}
```

## Preparation before calling

First [query job details](get-workflow-job.md) to confirm that the job has reached the final state. Prepare a personal access token and target workspace ID that has access to the target workspace.

## Path parameters

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

```{raw} html
<dl class="mo-api-fields">
  <div class="mo-api-field"><dt><code>workflow_id</code><span class="mo-api-field__type">string</span><span class="mo-api-field__required">Required</span></dt><dd>Workflow ID.</dd></div>
  <div class="mo-api-field"><dt><code>execution_id</code><span class="mo-api-field__type">string</span><span class="mo-api-field__required">Required</span></dt><dd>Job ID.</dd></div>
</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/v2/workflow-apps/$WORKFLOW_ID/executions/$EXECUTION_ID" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

:::
::::

## Successful response

When `code` in the response is `OK` and `data.deleted` is `true`, the server has deleted the job record. Deletion is irreversible.

::::{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.deleted</code><span class="mo-api-field__type">boolean</span></dt><dd>`true` indicates that the job record 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": {
    "deleted": true
  }
}
```

:::
::::

## 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": "ErrNotFound",
  "msg": "资源不存在",
  "data": null
}
```

:::
::::

## Follow-up operations

[View workflow jobs](list-workflow-jobs.md), confirm that the job record no longer appears.
