Use the tasks engagement API to log and manage tasks on CRM records.
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).
Field | Description |
---|---|
hs_timestamp | Required. This field marks the task’s due date. You can use either a Unix timestamp in milliseconds or UTC format. |
hs_task_body | The task notes. |
hubspot_owner_id | The owner ID of the user assigned to the task. |
hs_task_subject | The title of the task. |
hs_task_status | The status of the task, either COMPLETED or NOT_STARTED . |
hs_task_priority | The priority of the task. Values include LOW , MEDIUM , or HIGH . |
hs_task_type | The type of task. Values include EMAIL , CALL , or TODO . |
hs_task_reminders | The timestamp for when to send a reminder for the due date of the task. You must use Unix timestamp in milliseconds. |
Field | Description |
---|---|
to | The record you want to associate with the task, specified by its unique id value. |
types | The type of the association between the task and the record. Include the associationCategory and 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. |
GET
request to /crm/v3/objects/tasks/{taskId}
. You can also include the following parameters in the request URL:
Parameter | Description |
---|---|
properties | A comma separated list of the properties to be returned. If a requested property isn’t defined, it won’t be included in the response. If a requested property is defined but a task doesn’t have a value, it will be returned as null . |
associations | A 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. |
GET
request to crm/v3/objects/tasks
. You can include the following parameters in the request URL:
Parameter | Description |
---|---|
limit | The maximum number of results to display per page. |
properties | A comma separated list of the properties to be returned. If a requested property isn’t defined, it won’t be included in the response. If a requested property is defined but a task doesn’t have a value, it will be returned as null . |
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:
PUT
request to /crm/v3/objects/tasks/{taskId}/associations/{toObjectType}/{toObjectId}/{associationTypeId}
. The request URL should contains the following fields:
Field | Description |
---|---|
taskId | The ID of the task. |
toObjectType | The type of object that you want to associate the task with (e.g., contact or company) |
toObjectId | The ID of the record that you want to associate the task with. |
associationTypeId | A 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. |
https://api.hubspot.com/crm/v3/objects/tasks/17687016786/associations/contacts/104901/204
DELETE
request to the same URL as above:
/crm/v3/objects/tasks/{taskId}/associations/{toObjectType}/{toObjectId}/{associationTypeId}
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.
DELETE
request to /crm/v3/objects/tasks/{taskId}
.
Learn more about deleting tasks by checking out the reference documentation.