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

# Task

> Creates a new task, optionally linked to a lead.

# Create a Task

Creates a new task. Optionally link it to a lead or assign it to a specific user.

## Request

`POST /v1/tasks`

### Body Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `title` | string | Yes | Task title |
| `description` | string | No | Task description |
| `notes` | string | No | Additional notes |
| `lead_id` | uuid | No | Link task to a lead |
| `user_id` | uuid | No | Assign task to a specific user |
| `due_date` | string | No | Due date (YYYY-MM-DD) |
| `due_time` | string | No | Due time (HH:MM) |
| `priority` | string | No | Priority: `low`, `medium`, or `high` (default: `medium`) |

## Example

```bash cURL theme={null}
curl -X POST \
  "https://kdjmltmhxvvmiuehafgl.supabase.co/functions/v1/api-gateway/v1/tasks" \
  -H "Authorization: Bearer rchd_live_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Follow up with John Doe",
    "lead_id": "a1b2c3d4-...",
    "due_date": "2026-03-25",
    "priority": "high"
  }'
```

```javascript JavaScript theme={null}
const response = await fetch(
  "https://kdjmltmhxvvmiuehafgl.supabase.co/functions/v1/api-gateway/v1/tasks",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer rchd_live_xxxxxxxxxxxx",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      title: "Follow up with John Doe",
      lead_id: "a1b2c3d4-...",
      due_date: "2026-03-25",
      priority: "high"
    })
  }
);
const data = await response.json();
```

```python Python theme={null}
import requests

response = requests.post(
    "https://kdjmltmhxvvmiuehafgl.supabase.co/functions/v1/api-gateway/v1/tasks",
    headers={
        "Authorization": "Bearer rchd_live_xxxxxxxxxxxx",
        "Content-Type": "application/json"
    },
    json={
        "title": "Follow up with John Doe",
        "lead_id": "a1b2c3d4-...",
        "due_date": "2026-03-25",
        "priority": "high"
    }
)
data = response.json()
```

## Response

**201 Created**

```json theme={null}
{
  "data": {
    "id": "task-uuid-1",
    "title": "Follow up with John Doe",
    "lead_id": "a1b2c3d4-...",
    "status": "pending",
    "priority": "high",
    "due_date": "2026-03-25",
    "created_at": "2026-03-21T10:00:00.000Z"
  }
}
```

**400 Bad Request**

```json theme={null}
{
  "error": {
    "code": "bad_request",
    "message": "title is required"
  }
}
```


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