# Reset test resources for a running task

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

Delete temporary test resources tracked by a still-running task. See [Shared information](objects.md) for objects, variables, and environment boundaries.

```text
POST https://api.moi.matrixorigin.cn/v5/workflow/v2/workflow-test-scratch/reset
```

## Before you call this API

Retain injected service URLs, credentials, Workspace, and short-lived authorization in the current generation task environment. Use complete original authorization header values. Install jq and set the example variables.

## Request body

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Request example

```bash
curl -X POST "${MOI_ENDPOINT%/}/workflow/v2/workflow-test-scratch/reset" \
  -H "X-API-Key: $MOI_API_KEY" \
  -H "X-Workspace-ID: $MOI_WORKSPACE_ID" \
  -H "X-MOI-Runtime-Authorization: $MOI_RUNTIME_AUTHORIZATION" \
  -H 'Content-Type: application/json' \
  --data-binary "$(jq -n  '{}')"
```

:::::
:::::{tab-item} Parameters

When a lease exists, the task must be working before deleting tracked test knowledge bases, volumes, and databases and removing the lease. This path cannot clean an existing lease after the task ends. No lease may return released directly; this does not establish whether resources were ever created. Cleanup failures retain a retryable state. Do not repeatedly call observation to recreate resources while failures remain unresolved. This operation does not delete published workflows.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `task_id` | string | Optional in task mode | Current task ID; required on the ordinary-identity path. |

:::::
::::::
:::::::

## Successful response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "state": "released"
  }
}
```

:::::
:::::{tab-item} Fields

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | OK on success. |
| `msg` | string | Response information. |
| `data` | object | Result of this operation. |
| `data.state` | string | released means this reset left no lease awaiting deletion; it does not mean the entire task ended. |

:::::
::::::
:::::::

## Error responses

Handle HTTP status and business fields. Historical queries and recovery have dedicated error codes; see [Errors and environments](objects.md#错误与环境). Retain identity, source references, and operation identifiers first, then check state before acting. Do not automatically change Workspace, candidate, or confirmation keys.
