Create a Task

Lets you create a new task. There are 2 ways to use this API –

  • You can create a task and associate it with a lead by passing the “RelatedEntity” parameter as “1” and then passing the “LeadId” as the value for the “RelatedEntityId” parameter.
  • You can create a task without associating it with a lead. In this case, pass the “RelatedEntity” parameter as “0” and don’t pass any value for the “RelatedEntityId” parameter.

You can either provide the “OwnerId” or “OwnerEmailAddress” in the JSON body. The “TaskType” is the type of task you want to create. To retrieve the list of task types, use the Get list of Task Types API.

API URL

POST
https://{host}/v2/Task.svc/Create?accessKey=AccessKey&secretKey=SecretKey
Copy URL

Request

JSON Body/Payload

Content-Type: application/json

{
    "Name": "My Task TODO",
    "Description": "Describing the task",
    "RelatedEntity": 0,
    "RelatedEntityId": "",
    "DueDate": "2020-11-11 10:12:45",
    "Reminder": 20,
    "NotifyBy": "1100",
    "OwnerEmailAddress":"userlead@yopmail.com",
    "TaskType": {"Name":"Phone Call"}
}

JSON Properties

Parameter Description
Name

Name of the task.

Description

Description of the task.

RelatedEntity

Set this to “0” if you’re not passing any value to the “RelatedEntityId” (which is “LeadId” or “ProspectId”) ;

Pass the value as “1” if you’re passing the “RelatedEntityId”.

RelatedEntityId

“LeadId” you want to associate the task with. It will be considered only if “RelatedEntity” = “1”.

DueDate

Due date of task in “yyyy-mm-dd hh:mm:ss” format.

Reminder

Lets you set a reminder in minutes. An email notification will be sent to the task owner before the due time based on this setting.

NotifyBy

Set the value as 1100 if you want the task owner to be notified by email.

Set the value as 1000 if you don’t want any notifications.

OwnerId

Id of the user you’re assigning the task to.

OwnerEmailAddress

Email address of the user you’re assigning the task to (when “OwnerId” is not known).

Response

200 OK

Content-Type: application/json

{
   "Status":"Success",
   "Message":{
              "Id":"xxxxxxxx-Task-Idxx-xxxx-xxxxxxxxxxxx"
             }
}

HTTP Response Code

Code Description
200 OK

This is the status code for successful API call.

401 Unauthorized

The API call was made with invalid access credentials. Check your AccessKey and SecretKey.

400 Bad Request

The message body on the request is not as per API specification. Make sure that content type is set to “application/json” and the JSON body has correct attribute names and structure.

404 Not Found

The API could not be found. Please check the API signature.

429 Too Many Requests

API calls exceeded the limit of 25 in 5 second(s)

500 Internal Server Error

The API called failed. There could be many reasons for it. Check the exception message to get more details.