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

# Delete Definition

Use this API to delete a workflow definition. The default is a soft delete (tombstone): the definition stays on disk, hidden from `get` and `list`, and can no longer be dispatched. Pass `purge: true` to physically remove it and its version snapshots.

After either kind of delete the `definitionId` is free to reuse, and re-creating it starts again at `version: 1`. Definitions with in-flight executions cannot be deleted.

# Endpoint

`POST https://api.velt.dev/v2/workflow/definitions/delete`

# Headers

<ParamField header="x-velt-api-key" type="string" required>
  Your API key.
</ParamField>

<ParamField header="x-velt-auth-token" type="string" required>
  Your [Auth Token](/docs/security/auth-tokens).
</ParamField>

# Body

#### Params

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="definitionId" type="string" required>
      The definition to delete.
    </ParamField>

    <ParamField body="purge" type="boolean">
      Defaults to `false`. When `true`, physically removes the definition document and its version snapshots instead of tombstoning it. The in-flight-execution check applies either way.
    </ParamField>

    <ParamField body="organizationId" type="string">
      Accepted but ignored. The delete resolves by `definitionId` alone, so you do not need this at any scope level.
    </ParamField>

    <ParamField body="documentId" type="string">
      Accepted but ignored. The delete resolves by `definitionId` alone, so you do not need this at any scope level.
    </ParamField>
  </Expandable>
</ParamField>

## **Example Requests**

#### Soft-delete a definition

```JSON theme={null}
{
  "data": {
    "definitionId": "marketing-copy-approval"
  }
}
```

#### Hard-delete a definition

```JSON theme={null}
{
  "data": {
    "definitionId": "marketing-copy-approval",
    "purge": true
  }
}
```

# Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "deleted": true,
    "purged": false,
    "definitionId": "marketing-copy-approval"
  }
}
```

`purged` is `true` only when you passed `purge: true`.

#### Failure Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "FAILED_PRECONDITION"
  }
}
```

**Errors:** `NOT_FOUND` (definition does not exist) / `FAILED_PRECONDITION` (in-flight executions exist).

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "deleted": true,
      "purged": false,
      "definitionId": "marketing-copy-approval"
    }
  }
  ```
</ResponseExample>
