> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ycloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create an event definition

> Creates a custom event definition.



## OpenAPI

````yaml /openapi/endpoints/ycloud-api-v2.yaml post /event/definitions
openapi: 3.0.0
info:
  description: >-
    The [YCloud](https://ycloud.com) API is organized around
    [REST](https://en.wikipedia.org/wiki/Representational_state_transfer). Our
    API is designed to have predictable, resource-oriented URLs, return
    [JSON](https://www.json.org) responses, and use standard HTTP response codes
    and verbs.
  version: v2
  title: YCloud API
  termsOfService: https://ycloud.com/terms-service
  contact:
    email: service@ycloud.com
servers:
  - url: https://api.ycloud.com/v2
    description: Base URL
security:
  - api_key: []
tags:
  - name: Balance
  - name: Contacts
  - name: Custom Events
  - name: Emails
  - name: SMS
  - name: Unsubscribers
  - name: Verify
  - name: Voices
  - name: Webhook Endpoints
  - name: WhatsApp Business Accounts
  - name: WhatsApp Inbound Messages
  - name: WhatsApp Media
  - name: WhatsApp Messages
  - name: WhatsApp Blocked Users
  - name: WhatsApp Groups
  - name: WhatsApp Calling
  - name: WhatsApp Phone Numbers
  - name: WhatsApp Templates
  - name: WhatsApp Flows
  - name: Meta Business Agent
  - name: WhatsApp Group Messages
externalDocs:
  description: Homepage
  url: https://ycloud.com
paths:
  /event/definitions:
    post:
      tags:
        - Custom Events
      summary: Create an event definition
      description: Creates a custom event definition.
      operationId: custom_events-create-definition
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomEventDefinitionCreateRequest'
        required: true
      responses:
        '200':
          description: Successfully created an event definition.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomEventDefinition'
components:
  schemas:
    CustomEventDefinitionCreateRequest:
      type: object
      description: Contains the properties of the custom event definition to be created.
      required:
        - name
        - label
        - objectType
      properties:
        name:
          type: string
          description: The unique name of the custom event.
          pattern: ^[a-z0-9_]{1,50}
          example: unique_event_name
          maxLength: 50
        label:
          type: string
          description: The label of the custom event.
          example: My event label
        description:
          type: string
          description: The description of the event.
          example: Describes this event
          maxLength: 200
        objectType:
          type: string
          description: |-
            Type of the object that the event will be associated with.
            - `CONTACT`: Indicates that the object is a `contact`.
          enum:
            - CONTACT
          example: CONTACT
        properties:
          type: array
          description: A list of property definitions for the event.
          items:
            $ref: '#/components/schemas/CustomEventDefinitionPropertyCreateRequest'
    CustomEventDefinition:
      type: object
      description: Represents a custom event definition.
      properties:
        name:
          type: string
          description: The name of the custom event definition.
          example: propertyName
        label:
          type: string
          description: The label of the event definition, used for display purposes.
          maxLength: 50
          example: Property Label
        description:
          type: string
          description: The description of the event definition.
          example: Describes this property
        objectType:
          type: string
          description: |-
            Type of the object that the event will be associated with.
            - `CONTACT`: Indicates that the object is a `contact`.
          enum:
            - CONTACT
          example: CONTACT
        createTime:
          type: string
          format: date-time
          description: >-
            The time at which this object is created, formatted in [RFC
            3339](https://datatracker.ietf.org/doc/html/rfc3339). e.g.,
            `2022-06-01T12:00:00.000Z`.
          example: '2024-08-22T00:00:00.000Z'
        properties:
          type: array
          description: The list of property definitions for the event definition.
          items:
            $ref: '#/components/schemas/CustomEventDefinitionProperty'
    CustomEventDefinitionPropertyCreateRequest:
      type: object
      description: >-
        Contains the properties of the custom event property definition to be
        created.
      required:
        - name
        - label
        - type
      properties:
        name:
          type: string
          description: The unique name of the custom property.
          pattern: ^[a-z][a-z0-9_]{1,50}$
          maxLength: 50
          example: unique_property_name
        label:
          type: string
          description: The label of the property.
          maxLength: 50
          example: Property Label
        description:
          type: string
          description: The description of the property.
          example: Describes this property
        type:
          type: string
          description: >-
            Type of the property.

            - `STRING`: Indicates a property that receives plain text strings.

            - `NUMBER`: Indicates a property that receives numeric values with
            up to one decimal.

            - `TIMESTAMP`: Indicates a property that receives epoch millisecond.

            - `URL`: Indicates a property that receives URLs, formatted as
            strings starting with `http://` or `https://`.
          enum:
            - STRING
            - NUMBER
            - TIMESTAMP
            - URL
          example: STRING
    CustomEventDefinitionProperty:
      type: object
      description: Represents a custom property of a custom event definition.
      properties:
        name:
          type: string
          description: The name of the custom property.
          example: propertyName
        label:
          type: string
          description: The label of the property, used for display purposes.
          maxLength: 50
          example: Property Label
        description:
          type: string
          description: The description of the property.
          example: Describes this property
        createTime:
          type: string
          format: date-time
          description: >-
            The time at which this object is created, formatted in [RFC
            3339](https://datatracker.ietf.org/doc/html/rfc3339). e.g.,
            `2022-06-01T12:00:00.000Z`.
          example: '2024-08-22T00:00:00.000Z'
        type:
          type: string
          description: >-
            The data type of the property.

            - `STRING`: Indicates a property that receives plain text strings.

            - `NUMBER`: Indicates a property that receives numeric values with
            up to one decimal.

            - `TIMESTAMP`: Indicates a property that receives epoch millisecond.

            - `URL`: Indicates a property that receives URLs, formatted as
            strings starting with `http://` or `https://`.
          enum:
            - STRING
            - NUMBER
            - TIMESTAMP
            - URL
  securitySchemes:
    api_key:
      type: apiKey
      name: X-API-Key
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.