Supported products
Supported products
Scope requirements
Scope requirements
Define a custom event
To create a custom event schema (i.e. define a new custom event), make aPOST request to events/v3/event-definitions. In the request body, include definitions for your event schema, including its label, name, CRM object associations, and custom properties.
You can include the following fields in your request body:
The request body below provides a basic example of an event definition, for which two custom properties are created and the default event properties are not included.
Set up a custom matching ID
To automatically link event occurrences to records of a specified object (e.g., automatically link event occurrences with companies), include thecustomMatchingId object in your definition request. In this object, define a primaryObjectRule object with the following fields: the unique object property that you’ve set up beforehand as the targetObjectPropertyName, and one of the properties from your event definition as the eventPropertyName.
For example, the following request body specifies a customMatchingId that matches a company property "unique_object_property" and the event property "string_property".
objectId each time you send an event occurrence, instead using the customMatchingId event property as the matching ID to identify the record. Learn more about sending custom event occurrences linked to records.
Manage properties in event definitions
Event properties are used to store information on individual custom event occurrences. These properties should be used when appropriate for sending event occurrences, but they are not required for an event occurrence to be valid. For each event definition, HubSpot provides a default set of properties, but you can also create custom properties for an event. Below, learn about HubSpot’s default event properties, how to define new properties for existing events, and how to update existing custom event properties.HubSpot’s default event properties
Expand the section below to view the default event properties. These properties are included for each event, unless you’ve set theincludeDefaultProperties field as false when defining your custom event.
The following tables show the valid option values for enumeration event properties. Use the option’s internal name when setting a value for the property via API.
Define new properties
You can create up to 50 custom properties per custom event.- To create custom properties when defining a new custom event, include the
propertyDefinitionsarray in your definition request body. - To create a new property for an existing custom event, make a
POSTrequest toevents/v3/event-definitions/{eventName}/property.
The supported properties types are listed in the table below, with the formatting requirements for defining each type. Learn more about property types and field types.
For example, to define a new enumeration property for an existing custom event, your request body would look like:
Update existing custom properties
To update an existing property on a custom event, make aPATCH request to events/v3/event-definitions/{eventName}/property. The only fields that can be updated on a property are the label, description, and options for enumeration properties.
Delete a property
To delete an existing property on a custom event, make aDELETE request to events/v3/event-definitions/{eventName}/property/{propertyName}.
When a property is deleted, it will no longer be available for use in future event occurrences, but past occurrences will still have the property values.
Update an event’s label or description
To update an existing custom event schema, make aPATCH request to events/v3/event-definitions/{eventName}. You can only update the custom event’s values for label and description.
Delete an event definition
To delete a custom event schema, make aDELETE request to events/v3/event-definitions/{eventName}.
Deleting a custom event will remove it from any other HubSpot tools that are referencing it, such as workflows and reports.
Get existing event definitions
To fetch a single event definition, make aGET request to events/v3/event-definitions/{eventName}.
To search event definitions by specific criteria, make a GET request to events/v3/event-definitions. You can use the following query parameters to refine your search.