Skip to main content

Use the tasks API to create and manage tasks. You can create tasks in HubSpot or via the tasks API.

Below, learn the basic methods of managing tasks through the API. To view all available endpoints and their requirements, check out the reference documentation.

To create a task, make a POST request to /crm/v3/objects/tasks.

In the request body, add task details in a properties object. You can also add an associations object to associate your new task with an existing record (e.g., contacts, companies).

In the properties object, you can include the following fields:

FieldDescription
hs_timestampRequired. This field marks the task's due date. You can use either a Unix timestamp in milliseconds or UTC format.
hs_task_bodyThe task notes.
hubspot_owner_idThe owner ID of the user assigned to the task.
hs_task_subjectThe title of the task.
hs_task_statusThe status of the task, either COMPLETED or NOT_STARTED.
hs_task_priorityThe priority of the task. Values include LOW, MEDIUM, or HIGH.
hs_task_typeThe type of task. Values include EMAIL, CALL, or TODO.
hs_task_remindersThe timestamp for when to send a reminder for the due date of the task. You must use Unix timestamp in milliseconds.

To create and associate a task with existing records, include an associations object in your request. For example, to create a task and associate it with two contacts, your request body might look similar to the following:

In the associations object, you should include the following:

FieldDescription
toThe record you want to associate with the task, specified by its unique id value.
typesThe type of the association between the task and the record. Include the associationCategoryand associationTypeId. Default association type IDs are listed here, or you can retrieve the value for custom association types (i.e. labels) via the associations API.

Learn more about batch creating tasks by checking out the reference documentation.

You can retrieve tasks individually or in bulk. Learn more about batch retrieval by checking out the reference documentation.

To retrieve an individual task by its task ID, make a GET request to /crm/v3/objects/tasks/{taskId}. You can also include the following parameters in the request URL:

ParameterDescription
propertiesA comma separated list of the properties to be returned.
associationsA comma separated list of object types to retrieve associated IDs for. Any specified associations that don't exist will not be returned in the response. Learn more about the associations API.

To request a list of all of tasks, make a GET request to crm/v3/objects/tasks. You can include the following parameters in the request URL:

ParameterDescription
limitThe maximum number of results to display per page.
propertiesA comma separated list of the properties to be returned.

You can update tasks individually or in batches. To update an individual task by its task ID, make a PATCH request to /crm/v3/objects/tasks/{taskId}.

In the request body, include the task properties that you want to update. For example, your request body might look similar to the following:

HubSpot will ignore values for read-only and non-existent properties. To clear a property value, pass an empty string for the property in the request body.

Learn more about batch updating by checking out the reference documentation.

To associate an existing task with records (e.g., contacts, deals, etc.), make a PUT request to /crm/v3/objects/tasks/{taskId}/associations/{toObjectType}/{toObjectId}/{associationTypeId}. The request URL should contains the following fields:

FieldDescription
taskIdThe ID of the task.
toObjectTypeThe type of object that you want to associate the task with (e.g., contact or company)
toObjectIdThe ID of the record that you want to associate the task with.
associationTypeIdA unique identifier to indicate the association type between the task and the other object. The ID can be represented numerically or in snake case (e.g., task_to_contact). You can retrieve the value through the associations API.

For example, your request URL might look similar to the following:

https://api.hubspot.com/crm/v3/objects/tasks/17687016786/associations/contacts/104901/204

To remove an association between a task and a record, make a DELETE request to the same URL as above:

/crm/v3/objects/tasks/{taskId}/associations/{toObjectType}/{toObjectId}/{associationTypeId}

You can pin a task on a record so it remains on the top of the record's timeline. The task must already be associated with the record prior to pinning, and you an only pin one activity per record. To pin a task, include the task's id in the hs_pinned_engagement_id field when creating or updating a record via the object APIs. Learn more about using the companies,contacts, deals, tickets, and custom objects APIs.

You can delete tasks individually or in batches, which will add the task to the recycling bin in HubSpot. You can later restore the task from the record timeline.

To delete an individual task by its task ID, make a DELETE request to /crm/v3/objects/tasks/{taskId}.

Learn more about deleting tasks by checking out the reference documentation.