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

# Delete Todo Workflow

> Step-by-step guide to deleting a todo using request body in DotPortion’s visual workflow builder.

# Delete Todo Workflow

This guide shows how to build a **Delete Todo API** using DotPortion’s **visual workflow builder**, where the todo is deleted **based on its ID provided in the request body**.

This workflow:

* Uses **request body only**
* Does **not** use path params
* Does **not** use query params

***

## What We’re Building

**Endpoint:**

```http theme={null}
DELETE /todo
```

**Purpose:**\
Delete an existing todo item by providing its ID in the request body.

***

## Request Body Shape

```
{
  "id": "todo_id_here"
}
```

***

## Before You Start

Make sure you have:

* Created the **Todo Project**
* Defined the **Todo Schema**
* Inserted at least one todo
* Built the **Create Todo** workflow
* Selected a database (Platform DB or MongoDB)

***

## Step 1: Create a New Workflow

1. Open your project
2. Click **New Workflow**
3. Name it: `delete-todo`

> 🖼️ **Workflow Creation (UI Reference)**

***

## Step 2: Configure API Start Node

Select the **API Start Node** and configure:

* **Method:** `DELETE`
* **Path:** `/todo`

This endpoint expects the todo ID in the request body.

> 🖼️ **API Start Node Configuration**

***

## Step 3: Add Parameter Node (Body)

Add a **Parameter Node** to extract the todo ID from the request body.

Configure:

| Field | Source | Type   | Required |
| :---- | :----- | :----- | :------- |
| id    | Body   | String | Yes      |

This ensures the request always contains a todo ID.

> 🖼️ **Parameter Node Configuration**

***

## Step 4: Add Database Node

Add a **Database Node** to delete the todo from the database.

Configure:

* **Database:** Platform DB or MongoDB
* **Collection:** `todos`
* **Operation:** `deleteOne`
* **Filter:**

```
{
  "_id": "{{body.id}}"
}
```

This removes the matching todo document.

> 🖼️ **Database Delete Configuration**

***

## Step 5: Add Response Node

Add a **Response Node** to confirm deletion.

Configure:

* **Status Code:** `200`
* **Response Body:**

```
{
  "success": true
}
```

> 🖼️ **Response Node Configuration**

***

## Step 6: Connect the Nodes

Connect the nodes in this order:

```
API Start → Parameter (Body) → Database → Response
```

> 🖼️ **Final Workflow Graph**

***

## Step 7: Deploy the Workflow

Click **Deploy** to make the API live.

Once deployed, the delete endpoint is available immediately.

***

## Testing the Workflow

Send a request body like:

```
{
  "id": "65a91f3e12ab34cd5678ef90"
}
```

Use the **Realtime Executor** to:

* Validate body input
* Observe the delete operation
* Confirm successful execution

> 🖼️ **Realtime Executor View**
