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

# Delete Agent

Use this API to delete a custom agent configuration and all its versions.

**Group cleanup:** Before the agent document and its versions subcollection are recursively deleted, the `agentId` is removed from the `agentIds` array of every agent group it belongs to. A cleanup failure aborts the delete and leaves the agent intact, so the call can safely be retried. Groups themselves are never deleted as part of agent deletion, even when they become empty.

# Endpoint

`POST https://api.velt.dev/v2/agents/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](/security/auth-tokens).
</ParamField>

# Body

#### Params

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="agentId" type="string" required>
      Min 1 char. Agent ID to delete.
    </ParamField>
  </Expandable>
</ParamField>

## **Example Requests**

#### Delete a custom agent

```JSON theme={null}
{
  "data": {
    "agentId": "abc123def456"
  }
}
```

# Response

#### Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Agent deleted successfully",
    "data": {
      "agentId": "abc123def456"
    }
  }
}
```

| Field          | Type   | Description                 |
| -------------- | ------ | --------------------------- |
| `data.agentId` | string | The ID of the deleted agent |

#### Failure Response

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

**Errors:** `NOT_FOUND` (agent does not exist).

<ResponseExample>
  ```js theme={null}
  {
    "result": {
      "status": "success",
      "message": "Agent deleted successfully",
      "data": {
        "agentId": "abc123def456"
      }
    }
  }
  ```
</ResponseExample>
