> ## 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

**x-velt-api-key** `string` *required*

Your API key.

**x-velt-auth-token** `string` *required*

Your [Auth Token](https://velt.dev/docs/security/auth-tokens.md).

# Body

#### Params

**data** `object` *required*

**properties**

**definitionId** `string` *required*

The definition to delete.

**purge** `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.

**organizationId** `string`

Accepted but ignored. The delete resolves by `definitionId` alone, so you do not need this at any scope level.

**documentId** `string`

Accepted but ignored. The delete resolves by `definitionId` alone, so you do not need this at any scope level.

## **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).

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


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