Scope requirements
Scope requirements
Create a task
To create a task, make aPOST 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).
Properties
In the properties object, you can include the following fields:Associations
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:
Learn more about batch creating tasks by checking out the reference documentation.
Retrieve tasks
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 aGET request to /crm/v3/objects/tasks/{taskId}. You can also include the following parameters in the request URL:
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:
Update tasks
You can update tasks individually or in batches. To update an individual task by its task ID, make aPATCH 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:
Associate existing tasks with records
To associate an existing task with records (e.g., contacts, deals, etc.), make aPUT request to /crm/v3/objects/tasks/{taskId}/associations/{toObjectType}/{toObjectId}/{associationTypeId}. The request URL should contain the following fields:
For example, your request URL might look similar to the following:
https://api.hubspot.com/crm/v3/objects/tasks/17687016786/associations/contacts/104901/204
Remove an association
To remove an association between a task and a record, make aDELETE request to the same URL as above:
/crm/v3/objects/tasks/{taskId}/associations/{toObjectType}/{toObjectId}/{associationTypeId}
Pin a task on a record
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 can only pin one activity per record. To pin a task, include the task’sid 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 tasks
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 aDELETE request to /crm/v3/objects/tasks/{taskId}.
Learn more about deleting tasks by checking out the reference documentation.