Skip to main content
POST
/
api
/
public
/
tasks
Create a new task
curl --request POST \
  --url https://api.vambe.me/api/public/tasks \
  --header 'Content-Type: application/json' \
  --data '{
  "title": "<string>",
  "description": "<string>",
  "dueDate": "<string>",
  "dueTime": "<string>",
  "timezone": "<string>",
  "responsibleIds": [
    "<string>"
  ],
  "aiContactId": "<string>",
  "aiCustomerId": "<string>",
  "priority": "0"
}'
{}

Overview

Create a new task and assign it to one or more team members. Tasks can be associated with contacts or customers, include due dates with timezone support, and have customizable priorities and statuses. Use this endpoint to programmatically create tasks from your application, integrate with external systems, or automate task creation based on specific triggers.

Use Cases

  • Automated Task Creation: Create tasks automatically when certain events occur (e.g., new lead, customer inquiry)
  • CRM Integration: Sync tasks from external CRM systems to Vambe
  • Follow-up Management: Automatically create follow-up tasks after customer interactions
  • Workflow Automation: Create tasks as part of automated workflows
  • API Integrations: Allow external applications to create tasks in Vambe
  • Mobile Apps: Enable task creation from mobile applications

Authentication

This endpoint requires authentication using an API key. Include your API key in the request header:
x-api-key: your_api_key_here

Request Body

FieldTypeRequiredDescription
titlestringYesTask title (minimum 1 character)
descriptionstring | nullNoDetailed description of the task
dueDatestring | nullNoDue date (ISO 8601 format: YYYY-MM-DD or full datetime)
dueTimestring | nullNoDue time (HH:MM format, e.g., β€œ14:30”)
timezonestring | nullNoTimezone for due date (e.g., β€œAmerica/Santiago”)
responsibleIdsstring[]YesArray of user IDs to assign as responsible
aiContactIdstring | nullNoAssociated contact ID
aiCustomerIdstring | nullNoAssociated customer ID
prioritystringYesTask priority: β€œ0” (low), β€œ1” (medium), or β€œ2” (high)

Priority Values

  • "0" - Low priority task
  • "1" - Medium priority task
  • "2" - High priority task
Note: The task will automatically be assigned the initial status configuration from your organization. You don’t need to provide a status ID when creating tasks via the public API.

Response Structure

Returns the created task object:

Task Object

FieldTypeDescription
idstring (UUID)Unique identifier for the task
titlestringTask title
descriptionstringDetailed description of the task
due_timezonestring | nullTimezone for the due date (e.g., β€œAmerica/Santiago”)
due_atstring | nullDue date and time (ISO 8601 format)
is_all_daybooleanWhether the task is an all-day task
created_atstringTask creation date (ISO 8601 format)
ai_contact_idstring | nullAssociated contact ID if applicable
ai_customer_idstring | nullAssociated customer ID if applicable
task_status_config_idstring (UUID)ID of the status configuration
prioritynumberTask priority: 0 (low), 1 (medium), or 2 (high)
creator_idstring (UUID)ID of the user who created the task
task_responsiblesarrayArray of responsible user objects
status_configobject | nullCustom status configuration object

Example Request

curl -X POST 'https://api.vambe.ai/api/public/tasks' \
  -H 'x-api-key: your_api_key_here' \
  -H 'Content-Type: application/json' \
  -d '{
    "title": "Follow up with customer",
    "description": "Call customer regarding their inquiry about pricing",
    "dueDate": "2025-10-25T14:00:00.000Z",
    "dueTime": "14:00",
    "timezone": "America/Santiago",
    "responsibleIds": ["228d7a0d-9072-4ca8-939b-959b75cc606a"],
    "aiContactId": "contact-uuid-123",
    "aiCustomerId": null,
    "priority": "2"
  }'

Example Response

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "title": "Follow up with customer",
  "description": "Call customer regarding their inquiry about pricing",
  "due_timezone": "America/Santiago",
  "due_at": "2025-10-25T14:00:00.000Z",
  "is_all_day": false,
  "created_at": "2025-10-23T10:30:00.000Z",
  "ai_contact_id": "contact-uuid-123",
  "ai_customer_id": null,
  "task_status_config_id": "status-uuid-789",
  "priority": 2,
  "creator_id": "user-uuid-456",
  "task_responsibles": [
    {
      "responsible_id": "228d7a0d-9072-4ca8-939b-959b75cc606a"
    }
  ],
  "status_config": {
    "id": "status-uuid-789",
    "name": "Pendiente",
    "color": "#60a5fa",
    "type": "initial",
    "order": 1
  }
}

Common Use Cases

1. Create a Simple Task

const createSimpleTask = async (title, description, responsibleId) => {
  const response = await fetch('https://api.vambe.ai/api/public/tasks', {
    method: 'POST',
    headers: {
      'x-api-key': 'your_api_key_here',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      title,
      description,
      dueDate: null,
      dueTime: null,
      timezone: null,
      responsibleIds: [responsibleId],
      aiContactId: null,
      aiCustomerId: null,
      priority: '1', // Medium priority
    }),
  });

  return await response.json();
};

// Example usage
const task = await createSimpleTask(
  'Review proposal',
  'Review and approve the client proposal',
  'agent-uuid-123',
);

2. Create Task with Due Date

const createTaskWithDeadline = async (
  title,
  description,
  dueDate,
  dueTime,
  timezone,
  responsibleId,
) => {
  const response = await fetch('https://api.vambe.ai/api/public/tasks', {
    method: 'POST',
    headers: {
      'x-api-key': 'your_api_key_here',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      title,
      description,
      dueDate,
      dueTime,
      timezone,
      responsibleIds: [responsibleId],
      aiContactId: null,
      aiCustomerId: null,
      priority: '2', // High priority
    }),
  });

  return await response.json();
};

// Example usage - Create task due tomorrow at 2 PM
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);

const urgentTask = await createTaskWithDeadline(
  'Client presentation',
  'Prepare and deliver quarterly presentation',
  tomorrow.toISOString(),
  '14:00',
  'America/Santiago',
  'agent-uuid-123',
);

3. Create Task Associated with Contact

const createContactTask = async (
  contactId,
  title,
  description,
  responsibleId,
) => {
  const response = await fetch('https://api.vambe.ai/api/public/tasks', {
    method: 'POST',
    headers: {
      'x-api-key': 'your_api_key_here',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      title,
      description,
      dueDate: null,
      dueTime: null,
      timezone: null,
      responsibleIds: [responsibleId],
      aiContactId: contactId,
      aiCustomerId: null,
      priority: '1', // Medium priority
    }),
  });

  return await response.json();
};

// Example usage
const contactTask = await createContactTask(
  'contact-uuid-456',
  'Follow up on inquiry',
  'Customer asked about premium features',
  'agent-uuid-123',
);

4. Create Task with Multiple Assignees

const createTeamTask = async (title, description, responsibleIds, priority) => {
  const response = await fetch('https://api.vambe.ai/api/public/tasks', {
    method: 'POST',
    headers: {
      'x-api-key': 'your_api_key_here',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      title,
      description,
      dueDate: null,
      dueTime: null,
      timezone: null,
      responsibleIds,
      aiContactId: null,
      aiCustomerId: null,
      priority,
    }),
  });

  return await response.json();
};

// Example usage - Assign to multiple team members
const teamTask = await createTeamTask(
  'Quarterly planning',
  'Prepare Q4 strategic plan',
  ['agent-uuid-1', 'agent-uuid-2', 'agent-uuid-3'],
  '2', // High priority
);

5. Create All-Day Task

const createAllDayTask = async (title, description, dueDate, responsibleId) => {
  const response = await fetch('https://api.vambe.ai/api/public/tasks', {
    method: 'POST',
    headers: {
      'x-api-key': 'your_api_key_here',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      title,
      description,
      dueDate,
      dueTime: null, // No time = all-day task
      timezone: null,
      responsibleIds: [responsibleId],
      aiContactId: null,
      aiCustomerId: null,
      priority: '1', // Medium priority
    }),
  });

  return await response.json();
};

// Example usage
const allDayTask = await createAllDayTask(
  'Team workshop',
  'Annual team building workshop',
  '2025-11-15T00:00:00.000Z',
  'agent-uuid-123',
);

6. Automated Task Creation from Webhook

// Webhook handler that creates tasks automatically
const handleWebhook = async (webhookData) => {
  // When a new high-value lead comes in, create a follow-up task
  if (webhookData.event === 'lead.created' && webhookData.lead.value > 10000) {
    const dueDate = new Date();
    dueDate.setHours(dueDate.getHours() + 2); // Due in 2 hours

    const response = await fetch('https://api.vambe.ai/api/tasks', {
      method: 'POST',
      headers: {
        'x-api-key': 'your_api_key_here',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        title: `Follow up: High-value lead - ${webhookData.lead.name}`,
        description: `New lead worth $${webhookData.lead.value}. Contact within 2 hours.`,
        dueDate: dueDate.toISOString(),
        dueTime: dueDate.toTimeString().slice(0, 5),
        timezone: 'America/Santiago',
        responsibleIds: [webhookData.lead.assignedAgent],
        aiContactId: webhookData.lead.contactId,
        aiCustomerId: null,
        priority: '2', // High priority
      }),
    });

    return await response.json();
  }
};

Validation Rules

Title

  • Required: Yes
  • Minimum length: 1 character
  • Type: String

Status Configuration

  • Required: No
  • Note: Tasks are automatically assigned the initial status configuration from your organization. You don’t need to provide a status ID when creating tasks via the public API.

Responsible IDs

  • Required: Yes
  • Type: Array of strings (UUIDs)
  • Note: Must be valid user IDs from your organization
  • Minimum: At least one user ID required

Priority

  • Required: Yes
  • Type: String
  • Allowed values: β€œ0” (low), β€œ1” (medium), β€œ2” (high)
  • Note: The value is sent as a string but stored as an integer (0, 1, or 2)

Due Date

  • Required: No
  • Type: String (ISO 8601 format) or null
  • Examples: β€œ2025-10-25”, β€œ2025-10-25T14:00:00.000Z”

Timezone

  • Required: No
  • Type: String or null
  • Format: IANA timezone (e.g., β€œAmerica/Santiago”, β€œEurope/London”)
  • Note: Required if dueTime is specified

Error Responses

Status CodeDescription
400Bad Request - Invalid request body or validation failed
401Unauthorized - Invalid or missing API key
404Not Found - Invalid statusId or responsibleIds
500Internal Server Error - Something went wrong

Common Validation Errors

{
  "statusCode": 400,
  "message": "Validation failed",
  "errors": [
    {
      "field": "title",
      "message": "Title must be at least 1 character"
    },
    {
      "field": "priority",
      "message": "Priority must be one of: low, medium, high"
    }
  ]
}

Best Practices

  1. Status Configuration: Tasks are automatically assigned the initial status configuration - no need to specify it
  2. Responsible Users: Validate that all responsibleIds are valid and active users
  3. Timezone Handling: Always specify timezone when using due dates with specific times
  4. Description Length: Keep descriptions concise but informative (500-1000 characters recommended)
  5. Priority Assignment: Use priority strategically - β€œ0” (low), β€œ1” (medium), β€œ2” (high)
  6. All-Day Tasks: For all-day tasks, omit dueTime or set it to null
  7. Contact Association: Link tasks to contacts when possible for better context and tracking

Performance Tips

  • Batch Creation: If creating multiple tasks, consider implementing retry logic
  • Validation: Validate data on the client side before making API calls
  • Error Handling: Implement proper error handling for failed task creation
  • Async Processing: For bulk task creation, consider queuing and processing asynchronously

Notes

  • Automatic Timestamps: created_at is automatically set to the current time
  • Default Status: New tasks are automatically assigned the initial status configuration from your organization
  • Creator Tracking: The creator_id is automatically set based on the authenticated user
  • Organization Scoped: Tasks are automatically associated with your organization
  • Interactive Notes: Tasks associated with contacts will automatically create interactive notes
  • Priority Format: Priority is sent as a string (β€œ0”, β€œ1”, β€œ2”) but returned as an integer (0, 1, 2) in the response

Body

application/json
title
string
required
Minimum length: 1
description
string | null
required
dueDate
string | null
required
dueTime
string | null
required
timezone
string | null
required
responsibleIds
string[]
required
aiContactId
string | null
required
aiCustomerId
string | null
required
priority
enum<string>
required
Available options:
0,
1,
2

Response

Task created successfully

The response is of type object.