APIs & Integrations

Collective_Wisd
Member

Create a Task with API

Hi.
What is the correct way to create a task with API?
Should it be created as an engagement of type TASK like
{
“engagement”: {
“active”: true,
“ownerId”: 1,
“type”: “TASK”,
“timestamp”: 1409172644778
},
“associations”: {
“contactIds”: [2],
“companyIds”: [ ],
“dealIds”: [ ],
“ownerIds”: [ ]
},
“metadata” : {
“status” : “NOT_STARTED | COMPLETED”,
“subject” : “Task subj”
}
}

Moreover, when trying to get the list of tasks or creating an engagement with JSON above I am getting the error {“status”:“error”,“message”:“This hapikey (xxx) does not have proper permissions! (requires all of [content-access])”. How can I grant the missed permissions? Or is this error is due to other reasons?

0 Upvotes
1 Reply 1
Dadams
HubSpot Employee
HubSpot Employee

Create a Task with API

Hi @Collective_Wisdom

Do you know which URL you’re using for this? Engagements tasks would be separate from tasks created with the Calendar API, and the Calendar API would require content-access, so you should be using the endpoint documented here:

Create an Engagement | Engagements API

POST /engagements/v1/engagements - Create an engagement via the HubSpot API.

0 Upvotes