There's a new version of the HubSpot API

As of November 30, 2022, HubSpot API keys are no longer a supported authentication method for accessing HubSpot APIs. Instead, you should use a private app access token or OAuth to authenticate API calls. Learn more about this change and how to migrate an API key integration to use a private app instead.

Create a new calendar task

Last updated May 22, 2023

POST /calendar/v1/events/task

Please note: all calendar API endpoints are being sunset and are no longer supported. These APIs will no longer function, and data from the marketing calendar will no longer be available via API. These APIs will be removed on August 31, 2023.

Method Details

HTTP Methods:

POST

Content Type:

application/json

Response Format:

json

Requires Authentication?

Yes

Rate Limited?

Yes

Headers

User-Agent

Products:

Marketing

Required Scope:

content

Create a new task for Calendar. Creating a task of type BLOG_POST, EMAIL, or LANDING_PAGE will create a draft of the respective content and associate it with the task, returning a contentId in the response.

By default, the createdBy user for the task will be automatically set as the User ID of the authenticated user. It is not possible to specify the createdBy user, only the ownerId of the calendar task. When specifying an owner, use the Owners API to get a list of owner Ids.

Please note:
  • Up to 10,000 tasks may be created over a 24 hour period per HubSpot account.
  • This endpoint is for tasks on the Marketing calendar. For tasks associated with the CRM and CRM objects, please see the Engagements API

Required parameters

Required Parameters How to use Description
OAuth access token or private app access token Authorization: Bearer {token} header Used to authenticate the request. Please see this page for more details about authentication.

Required JSON Fields in the body

Field name Type Description
name string The name of task.
eventDate long When the task is set to be due, in milliseconds since the epoch.
category string The type of task, such as BLOG_POST, EMAIL, LANDING_PAGE, CUSTOM.

Note: if this is set to BLOG_POST, then the contentGroupId field is also required.
state string The completion state of the task; value of TODO or DONE.

Allowed JSON Fields in the body

Field name Type Description
eventType string Type of calendar event; for tasks this is always PUBLISHING_TASK.
campaignGuid string The value of campaign GUID associated with task.
contentGroupId long The ID of the content group (aka blog) that the associated Blog Post will belong to, if any. Only read for BLOG_POST Tasks. See Blog API to get a list of blogs ids.

Note: this field is REQUIRED if the category is set to BLOG_POST.
topicIds list of longs The list of ids of topics associated with the associated Blog Post, if any. Otherwise null. Only read for BLOG_POST Tasks. See Topics API to get a list of topic ids.
templatePath string The template to use for emails and landing pages. only read for EMAIL and LANDING_PAGE categories. This field is OPTIONAL.
description string A description of the task.
ownerId long The HubSpot id of the user that the task is assigned to. See the Owners API to get a list of owner Ids.