# Delete an agent test folder

Delete an empty folder, or recursively soft-delete its managed tests and descendant folders after explicit confirmation.

## Endpoint

`DELETE /api/v1/workspaces/{workspace_id}/agent-test-folders/{folder_id}`

## Authentication

| Class | Authentication | Minimum role | API key |
| --- | --- | --- | --- |
| dashboard-session-api | Dashboard session cookie; mutations also require X-CX-Request: 1. | member | Not allowed |

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `workspace_id` | path | `string` | Yes | — |
| `folder_id` | path | `string` | Yes | — |
| `recursive` | query | `boolean` | No | — |

## Request body

This operation has no request body.

## Example

```bash
curl --request DELETE 'https://operade.ai/api/v1/workspaces/ws_demo/agent-test-folders/testfld_support?recursive=false' \
  --cookie 'cx_session=YOUR_SESSION_COOKIE' \
  --header 'X-CX-Request: 1'
```

## Responses

| Status | Description | Content |
| --- | --- | --- |
| 4XX | Handled client error | application/json: `ErrorResponse` |
| 200 | Successful Response | application/json: `FolderDeleteResponse` |

### 4XX application/json response schema

| Field path | Type | Reference | Format | Nullable | Required | Enum | Description |
| --- | --- | --- | --- | --- | --- | --- | --- |
| `$` | `object` | ErrorResponse | — | No | Yes | — | — |
| `error` | `object` | ErrorItem | — | No | Yes | — | — |
| `error.code` | `string` | — | — | No | Yes | — | — |
| `error.details` | `object` | — | — | No | No | — | — |
| `error.message` | `string` | — | — | No | Yes | — | — |

### 200 application/json response schema

| Field path | Type | Reference | Format | Nullable | Required | Enum | Description |
| --- | --- | --- | --- | --- | --- | --- | --- |
| `$` | `object` | FolderDeleteResponse | — | No | Yes | — | — |
| `deleted_folders` | `integer` | — | — | No | Yes | — | — |
| `deleted_tests` | `integer` | — | — | No | Yes | — | — |

### Response example

```json
{
  "deleted_tests": 0,
  "deleted_folders": 0
}
```

## Errors

Reviewed common and route-declared errors are summarized here; the list is not exhaustive. Start with the [distributed error index](/docs/reference/api/errors) to find each code's canonical domain page.

| Status | Code | Description |
| --- | --- | --- |
| 401 | `unauthenticated` | Authentication is missing, invalid, or revoked. |
| 403 | `forbidden` | The authenticated caller does not have access to this operation. |
| 404 | `not_found` | The requested workspace resource was not found. |
| 422 | `validation_failed` | The request did not pass field or business validation. |

## Related operations

- [Create an agent test folder](/docs/api-reference/agent-test-folders/create-agent-test-folder) — `POST /api/v1/workspaces/{workspace_id}/agent-test-folders`
- [Get an agent test folder](/docs/api-reference/agent-test-folders/get-agent-test-folder) — `GET /api/v1/workspaces/{workspace_id}/agent-test-folders/{folder_id}`
- [Rename an agent test folder](/docs/api-reference/agent-test-folders/rename-agent-test-folder) — `PATCH /api/v1/workspaces/{workspace_id}/agent-test-folders/{folder_id}`
