Skip to content

HubSpot: Create — event Definitions create Event Definition

HubSpot eventDefinitions.createEventDefinition: arguments, response, policy and SDK examples.

← Event definitions operations · Get started

Operation hubspot.event_definitions_create_event_definition

Provider route: POST /events/2026-09/event-definitions. Alter supplies the connection’s credentials and routing.

Install @alter-ai/sdk @alter-ai/hubspot with npm, or alter-sdk-hubspot with pip. Supply your connected customer’s grant ID and the arguments described below.

import { App } from "@alter-ai/sdk";
import { HubSpotIntegration } from "@alter-ai/hubspot";
async function execute(input: Parameters<HubSpotIntegration["eventDefinitions"]["createEventDefinition"]>[0]) {
const app = new App({ apiKey: process.env.ALTER_API_KEY! });
try {
const provider = new HubSpotIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! });
const call = await provider.eventDefinitions.createEventDefinition(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from alter_sdk_hubspot import HubSpotIntegration
async def execute(arguments):
async with App(api_key=os.environ["ALTER_API_KEY"]) as app:
provider = HubSpotIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]})
call = await provider.event_definitions.create_event_definition(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
bodyModelRequired within parentExpand Create — event Definitions create Event Definition — request body — body

Referenced models: Create — event Definitions create Event Definition — request body — body

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand Update event definition — response body

Referenced models: Update event definition — response body

48 more schemas are linked from the tables above, on the schema pages.

Create — event Definitions create Event Definition — request body — body
FieldTypePresenceDescription and constraints
$objectRoot
customMatchingIdModelOptionalExpand Update event definition — response body — custom Matching Id
descriptionstringOptionalA string providing a description of the event type.
includeDefaultPropertiesbooleanRequired within parentA boolean indicating whether default properties should be included.
labelstringRequired within parentA string representing the label of the event type.
namestringOptionalA string representing the name of the event type.
primaryObjectstringOptionalA string indicating the primary object associated with the event type.
propertyDefinitionsarrayRequired within parentAn array of property definitions, each represented by an ExternalBehavioralEventPropertyCreate object.
propertyDefinitions[]ModelEach itemExpand Create Property — request body — body

Referenced models: Create Property — request body — body, Update event definition — response body — custom Matching Id

Update event definition — response body
FieldTypePresenceDescription and constraints
$objectRoot
archivedbooleanRequired within parentA boolean indicating whether the event type is archived.
associationsarrayRequired within parentAn array of association definitions related to the event type.
associations[]ModelEach itemExpand Update event definition — response body — associations item
comboEventRulesModelOptionalExpand Update event definition — response body — combo Event Rules
createdAtstringOptionalA string representing the date and time when the event type was created, in ISO 8601 format.
Format: date-time
createdUserIdJSONOptional
createdUserId (anyOf 1)integerAlternativeAn integer representing the ID of the user who created the event type.
Format: int32
createdUserId (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$
customMatchingIdModelOptionalExpand Update event definition — response body — custom Matching Id
descriptionstringOptionalA string providing a description of the event type.
detailTemplatestringOptionalThe rendering template for the body of the CRM timeline activity card.
fullyQualifiedNamestringRequired within parentA string representing the fully qualified name of the event type.
headerTemplatestringOptionalThe rendering template for the header of the CRM timeline activity card.
idstringRequired within parentA string representing the unique identifier of the event type.
labelsModelRequired within parentExpand Update event definition — response body — labels
namestringRequired within parentA string representing the name of the event type.
objectTypeIdstringRequired within parentA string representing the object type ID associated with the event type.
primaryObjectstringOptionalA string representing the primary object associated with the event type.
primaryObjectIdstringOptionalA string representing the ID of the primary object associated with the event type.
propertiesarrayRequired within parentAn array of property objects associated with the event type.
properties[]ModelEach itemExpand Create Property — response body
trackingTypestringOptionalA string indicating the tracking type of the event. Valid values include 'VISITED_URL', 'CLICKED_ELEMENT', 'CUSTOM_SCRIPT', 'MANUAL', 'IMPORT', 'PROPERTY_CHANGE', 'COMBO_EVENT'.
Known values: APP_EVENT, AUTOCAPTURE_EVENT, CLICKED_ELEMENT, COMBO_EVENT, CUSTOM_SCRIPT, CUSTOM_SIGNAL, IMPORT, MANUAL, POLLING, PROPERTY_CHANGE, VISITED_URL, WEBHOOK
updatedAtstringOptionalA string representing the date and time when the event type was last updated, in ISO 8601 format.
Format: date-time
updatedUserIdJSONOptional
updatedUserId (anyOf 1)integerAlternativeAn integer representing the ID of the user who last updated the event type.
Format: int32
updatedUserId (anyOf 2)stringAlternativePattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$

Referenced models: Update event definition — response body — labels, Update event definition — response body — custom Matching Id, Update event definition — response body — combo Event Rules, Update event definition — response body — associations item, Create Property — response body

Create Property — request body — body
FieldTypePresenceDescription and constraints
$objectRoot
descriptionstringOptionalA string providing additional information about the property.
labelstringRequired within parentA string representing the display name of the property. This field is required.
namestringOptionalA string representing the unique name of the property.
optionsarrayOptionalAn array of OptionInput objects that define the possible values for the property.
options[]ModelEach itemExpand Create Property — request body — body options item
typestringRequired within parentA string indicating the data type of the property. This field is required.

Referenced models: Create Property — request body — body options item

Update event definition — response body — custom Matching Id
FieldTypePresenceDescription and constraints
$objectRoot
primaryObjectRuleModelRequired within parentExpand Update event definition — response body — custom Matching Id primary Object Rule

Referenced models: Update event definition — response body — custom Matching Id primary Object Rule

Update event definition — response body — labels
FieldTypePresenceDescription and constraints
$objectRoot
pluralstringOptionalThe plural form of the label for the event type. This is a string.
singularstringRequired within parentThe singular form of the label for the event type. This is a string and is required.
Update event definition — response body — combo Event Rules
FieldTypePresenceDescription and constraints
$objectRoot
composingRulesarrayRequired within parentAn array of ComboEventRule objects that define the individual rules composing this branch.
composingRules[]ModelEach itemExpand Update event definition — response body — combo Event Rules composing Rules item
operationTypestringRequired within parentThe type of logical operation applied to the rule branches and composing rules. Valid values are 'AND' and 'OR'.
Known values: AND, OR
ruleBranchesarrayRequired within parentAn array of nested ComboEventRuleBranch objects, allowing for hierarchical rule definitions.
ruleBranches[]ModelEach itemExpand Update event definition — response body — combo Event Rules

Referenced models: Update event definition — response body — combo Event Rules composing Rules item, Update event definition — response body — combo Event Rules

Create Property — request body — body options item
FieldTypePresenceDescription and constraints
$objectRoot
descriptionstringOptionalA string providing additional information about the option.
displayOrderintegerRequired within parentAn integer indicating the order in which the option should be displayed relative to other options.
Format: int32
hiddenbooleanRequired within parentA boolean indicating whether the option is hidden from view.
labelstringRequired within parentA string representing the display label for the option.
valuestringRequired within parentA string representing the unique value associated with the option.
Update event definition — response body — custom Matching Id primary Object Rule
FieldTypePresenceDescription and constraints
$objectRoot
eventPropertyNamestringRequired within parentThe name of the property on the event that is used for resolution. It is a string.
targetObjectPropertyNamestringRequired within parentThe name of the property on the target object that is used for resolution. It is a string.
Update event definition — response body — combo Event Rules composing Rules item property Filters item context
FieldTypePresenceDescription and constraints
$objectRoot
objectTypeIdstringRequired within parentA string that uniquely identifies the type of object to which the property filter is applied.

SDK function policy ID: hubspot.event_definitions_create_event_definition. Catalog operation: event_definitions_create_event_definition. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.

Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.

Required provider scopes: ["behavioral_events.event_definitions.read_write"]

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.