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

# Create Lead Task

> Create a task associated with a lead for follow-up management

<Note>
  Create actionable tasks linked to leads. Essential for managing follow-ups, tracking action items, and team collaboration.
</Note>

## Overview

Creates a task associated with a specific lead to track follow-up actions and ensure nothing falls through the cracks.

## Query Parameters

<ParamField query="api_key" type="string" required>
  Your SmartLead API key
</ParamField>

## Request Body

<ParamField body="email_lead_map_id" type="number" required>
  Lead-campaign mapping ID
</ParamField>

<ParamField body="name" type="string" required>
  Task title/name
</ParamField>

<ParamField body="description" type="string">
  Detailed task notes (optional)
</ParamField>

<ParamField body="priority" type="string" default="MEDIUM">
  Task priority: `LOW`, `MEDIUM`, or `HIGH`
</ParamField>

<ParamField body="due_date" type="date">
  Due date in ISO 8601 format (optional)
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://server.smartlead.ai/api/v1/master-inbox/create-task?api_key=YOUR_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "email_lead_map_id": 2433664091,
      "name": "Schedule demo call",
      "description": "Lead interested in enterprise plan",
      "priority": "HIGH",
      "due_date": "2025-01-25T14:00:00Z"
    }'
  ```

  ```python Python theme={null}
  import requests
  from datetime import datetime, timedelta

  API_KEY = "YOUR_API_KEY"

  def create_task(lead_map_id, name, description="", priority="MEDIUM", due_date=None):
      """Create a task for lead follow-up"""
      payload = {
          "email_lead_map_id": lead_map_id,
          "name": name,
          "description": description,
          "priority": priority,
          "due_date": due_date
      }
      
      response = requests.post(
          "https://server.smartlead.ai/api/v1/master-inbox/create-task",
          params={"api_key": API_KEY},
          json=payload
      )
      
      return response.json()

  # Create high-priority task due tomorrow
  tomorrow = (datetime.now() + timedelta(days=1)).replace(hour=14, minute=0).isoformat() + 'Z'

  create_task(
      lead_map_id=2433664091,
      name="Schedule demo call",
      description="Lead expressed interest in enterprise features",
      priority="HIGH",
      due_date=tomorrow
  )
  ```

  ```javascript JavaScript theme={null}
  const API_KEY = 'YOUR_API_KEY';

  async function createTask(leadMapId, name, options = {}) {
    const payload = {
      email_lead_map_id: leadMapId,
      name: name,
      description: options.description || '',
      priority: options.priority || 'MEDIUM',
      due_date: options.dueDate || null
    };
    
    const response = await fetch(
      `https://server.smartlead.ai/api/v1/master-inbox/create-task?api_key=${API_KEY}`,
      {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(payload)
      }
    );
    
    return response.json();
  }

  // Create task
  await createTask(2433664091, 'Follow up on pricing', {
    description: 'Lead requested custom pricing',
    priority: 'HIGH',
    dueDate: '2025-01-25T14:00:00Z'
  });
  ```
</RequestExample>

## Response Example

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "success": true,
    "message": "Task created successfully",
    "data": {
      "task_id": 789,
      "email_lead_map_id": 2433664091,
      "name": "Schedule demo call",
      "priority": "HIGH",
      "due_date": "2025-01-25T14:00:00Z"
    }
  }
  ```
</ResponseExample>

## Related Endpoints

* [Create Note](/api-reference/inbox/create-note)
* [Set Reminder](/api-reference/inbox/set-reminder)
