Skip to main content
POST
/
events
/
v3
/
event-definitions
Crear definición de evento personalizado
curl --request POST \
  --url https://api.hubapi.com/events/v3/event-definitions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "propertyDefinitions": [
    {
      "name": "<string>",
      "options": [
        {
          "hidden": true,
          "displayOrder": 123,
          "description": "<string>",
          "label": "<string>",
          "value": "<string>"
        }
      ],
      "description": "<string>",
      "label": "<string>",
      "type": "<string>"
    }
  ],
  "name": "<string>",
  "description": "<string>",
  "label": "<string>",
  "primaryObject": "<string>"
}'
{
  "associations": [
    {
      "inverseLabel": "",
      "hidden": false,
      "allowsCustomLabels": false,
      "maxFromObjectIds": 123,
      "inverseAllowsCustomLabels": false,
      "isPrimary": false,
      "hasUserEnforcedMaxToObjectIds": false,
      "hasUserEnforcedMaxFromObjectIds": false,
      "id": 123,
      "toObjectTypeId": "",
      "inverseCardinality": "",
      "maxToObjectIds": 123,
      "hasCascadingDeletes": false,
      "fromObjectType": "",
      "toObjectType": "",
      "label": "",
      "inverseId": 123,
      "cardinality": "",
      "inverseName": "",
      "hasAllAssociatedObjects": false,
      "inverseHasAllAssociatedObjects": false,
      "fromObjectTypeId": "",
      "portalUniqueIdentifier": "",
      "isInversePrimary": false,
      "name": "",
      "category": ""
    }
  ],
  "objectTypeId": "<string>",
  "createdUserId": 123,
  "trackingType": "VISITED_URL",
  "description": "<string>",
  "primaryObjectId": "<string>",
  "comboEventRules": {
    "operationType": "AND",
    "composingRules": [
      {
        "lookbackWindowDays": 123,
        "eventTypeId": "<string>",
        "propertyFilters": [
          {
            "frameworkFilterId": 123,
            "property": "<string>",
            "filterType": "PROPERTY",
            "operation": {
              "includeObjectsWithNoValueSet": true,
              "defaultValue": "<string>",
              "propertyType": "bool",
              "operationType": "<string>",
              "value": true,
              "operatorName": "<string>",
              "operator": "IS_EQUAL_TO"
            }
          }
        ],
        "count": 123
      }
    ],
    "ruleBranches": [
      {}
    ]
  },
  "fullyQualifiedName": "<string>",
  "primaryObject": "<string>",
  "labels": {
    "plural": "<string>",
    "singular": "<string>"
  },
  "archived": true,
  "createdAt": "2023-11-07T05:31:56Z",
  "name": "<string>",
  "id": "<string>",
  "properties": [
    {
      "hidden": false,
      "displayOrder": 123,
      "description": "",
      "showCurrencySymbol": false,
      "type": "",
      "hubspotDefined": false,
      "createdAt": "2023-11-07T05:31:56Z",
      "archived": false,
      "options": "",
      "hasUniqueValue": false,
      "calculated": false,
      "externalOptions": false,
      "updatedAt": "2023-11-07T05:31:56Z",
      "createdUserId": "",
      "modificationMetadata": {
        "readOnlyOptions": true,
        "readOnlyValue": true,
        "readOnlyDefinition": true,
        "archivable": true
      },
      "sensitiveDataCategories": "",
      "label": "",
      "formField": false,
      "dataSensitivity": "",
      "archivedAt": "2023-11-07T05:31:56Z",
      "groupName": "",
      "referencedObjectType": "",
      "name": "",
      "calculationFormula": "",
      "fieldType": "",
      "updatedUserId": "<string>"
    }
  ]
}

Productos compatibles

Se requiere uno de los siguientes productos o productos de ediciones superiores.
Marketing HubMarketing Hub -Enterprise
Sales HubSales Hub -Enterprise
Service HubService Hub -Enterprise
Content HubContent Hub -Enterprise
Esta API requiere uno de los siguientes ámbitos:
behavioral_events.event_definitions.read_write

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Body

application/json
propertyDefinitions
object[]
required

Lista de propiedades personalizadas en el evento

label
string
required

Etiqueta del evento legible para humanos. Se utiliza en la UI de HubSpot

name
string

Nombre interno del evento, que debe usarse al referenciar el evento desde la API de definición de eventos. Si no se especifica un nombre, se generará uno con base en la etiqueta. El valor "nombre" también se utilizará para generar automáticamente un "nombreTotalmenteCalificado" para la definición del evento, que se utilizará cuando se envían las finalizaciones de evento correspondientes a este evento.

description
string

Una descripción del evento que se mostrará como texto de ayuda en HubSpot.

primaryObject
string

El tipo de objeto al que se asociará este evento. Puede ser uno de los siguientes: CONTACTO, EMPRESA, NEGOCIO, TICKET. Si no se especifica un primaryObject, por opción predeterminada, asociaremos el evento a los objetos CONTACTO.

Response

successful operation

associations
object[]
required
objectTypeId
string
required
fullyQualifiedName
string
required
labels
object
required
archived
boolean
required
name
string
required
id
string
required
properties
object[]
required
createdUserId
integer
trackingType
enum<string>
Available options:
VISITED_URL,
CLICKED_ELEMENT,
CUSTOM_SCRIPT,
MANUAL,
IMPORT,
PROPERTY_CHANGE,
COMBO_EVENT,
WEBHOOK
description
string
primaryObjectId
string
comboEventRules
object
primaryObject
string
createdAt
string<date-time>
I