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

# Create Business Event

> This API allows you to create business events in MoEngage. You can use these events to trigger campaigns whenever they occur.

**Rate Limit:** The rate limits are at the workspace level. You can create a maximum of 50 business events for each workspace.


# Overview

In MoEngage, you can set up event-triggered campaigns to notify users about new episodes, flight delays, or price reductions on items they have viewed, wished for, or added to their carts.

# FAQs

<AccordionGroup>
  <Accordion title="What are the different data types supported in the creation of a business event?">
    The different data types supported are integer, float, string, date, and array.
  </Accordion>

  <Accordion title="Can I create two business events with the same name and different attributes?">
    No, business event names should be unique. You cannot create two business events with the same name.
  </Accordion>

  <Accordion title="How can I see the list of all the created business events in MoEngage?">
    You can see all business events created in MoEngage using the Search API.
  </Accordion>
</AccordionGroup>


## OpenAPI

````yaml /api/business-events/business-events.yaml post /business_event
openapi: 3.0.3
info:
  title: MoEngage Business Events API
  description: >
    API for creating, triggering, and searching business events in MoEngage.


    You can use these events to trigger campaigns whenever they occur. For
    example, you can create business events for various situations, such as when
    new episodes of an OTT series become available, when there is a flight
    delay, or when there is a price drop on an item in a cart.


    **Postman Collections**

    We have made it easy for you to test the APIs. [View in
    Postman](https://www.postman.com/moengage-dev/workspace/api-docs/collection/3182294-38587f83-f039-46f3-b86e-10af2c918053).
  version: '1.0'
servers:
  - url: https://api-0{X}.moengage.com/v1.0
    description: MoEngage API Server
    variables:
      X:
        default: '1'
        description: >-
          Your MoEngage Data Center (DC) number. Refer to MoEngage docs for your
          correct DC.
security:
  - basicAuth: []
tags:
  - name: Business Events
    description: Manage and trigger business events.
paths:
  /business_event:
    post:
      tags:
        - Business Events
      summary: Create Business Event
      description: >
        This API allows you to create business events in MoEngage. You can use
        these events to trigger campaigns whenever they occur.


        **Rate Limit:** The rate limits are at the workspace level. You can
        create a maximum of 50 business events for each workspace.
      operationId: createBusinessEvent
      parameters:
        - in: header
          name: Content-Type
          schema:
            type: string
            default: application/json
          required: true
          description: Set the Content-Type header to application/json.
      requestBody:
        description: Business event definition.
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - event_name
                - event_attributes
                - created_by
              properties:
                event_name:
                  type: string
                  description: This field contains the name of the business event.
                  example: NameOfOTTSeries
                event_attributes:
                  type: array
                  description: >-
                    This field contains the event attributes of the business
                    event being created.
                  items:
                    type: object
                    required:
                      - attribute_name
                      - attribute_data_type
                    properties:
                      attribute_name:
                        type: string
                        description: The name of the attribute.
                        example: season
                      attribute_data_type:
                        type: string
                        description: The data type of the attribute.
                        enum:
                          - string
                          - int
                          - float
                          - array
                          - date
                        example: string
                created_by:
                  type: string
                  format: email
                  description: The email address of the creator of the business event.
                  example: john.doe@example.com
            example:
              event_name: NameOfOTTSeries
              event_attributes:
                - attribute_name: season
                  attribute_data_type: string
                - attribute_name: episodes
                  attribute_data_type: int
                - attribute_name: cast
                  attribute_data_type: array
                - attribute_name: released_on
                  attribute_data_type: date
                - attribute_name: budget
                  attribute_data_type: float
              created_by: john.doe@example.com
      responses:
        '200':
          description: >-
            This response is returned when the request is processed
            successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: The business event has been created
                  event_id:
                    type: string
                    description: Unique identifier for the created business event.
                    example: 64a40cff5547a6b2c5b14404
        '400':
          description: >-
            This response is returned when the required parameters are missing
            from the request or when the provided parameters are invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                additionalFields:
                  summary: Additional Fields Present
                  value:
                    error:
                      code: 400 Bad Request
                      message: >-
                        Additional fields are not allowed document schema for
                        class BusinessEventCreateRequest:event_attribute
                      details:
                        - code: InvalidValue
                          target: event_attribute
                          message: >-
                            Additional fields are not allowed document schema
                            for class BusinessEventCreateRequest:event_attribute
                      request_id: 64a54b4b633fda13b668125d
                missingField:
                  summary: Missing Mandatory Field
                  value:
                    error:
                      code: 400 Bad Request
                      message: Bad request
                      details:
                        - code: MissingValue
                          target: created_by
                          message: >-
                            created_by - Field is required but value is None :
                            None
                      request_id: 64a54b0f633fda13b6681259
                invalidDataType:
                  summary: Incorrect Data Type
                  value:
                    error:
                      code: 400 Bad Request
                      message: Bad request
                      details:
                        - code: MissingValue
                          target:
                            - brand
                          message: >-
                            ['brand'] - Wrong Attribute data type is passed :
                            'String'
                      request_id: 64a54b6c633fda13b668125e
        '401':
          description: >-
            This response is returned when the authorization parameters are
            missing or incorrect in the HTTP Auth Header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                missingHeader:
                  summary: Missing Auth Header
                  value:
                    error:
                      code: 401 Authentication error
                      message: Authentication required
                      details:
                        - code: InvalidValue
                          target: Authorization
                          message:
                            code: MissingValue
                            target: Authorization
                            message: >-
                              APP_ID and APP_SECRET_KEY is missing in
                              Authorization Header.
                      request_id: 64a54b9d633fda13b6681261
                invalidAppId:
                  summary: Invalid App ID
                  value:
                    error:
                      code: 401 Authentication error
                      message: Authentication required
                      details:
                        - code: InvalidValue
                          target: APP_ID
                          message:
                            - code: InvalidValue
                              target: APP_ID
                              message: Invalid APP_ID is provided.
                      request_id: 64a54bfa633fda13b6681262
                invalidSecretKey:
                  summary: Invalid Secret Key
                  value:
                    error:
                      code: 401 Authentication error
                      message: Authentication required
                      details:
                        - code: InvalidValue
                          target: APP_SECRET_KEY
                          message:
                            - code: InvalidValue
                              target: APP_SECRET_KEY
                              message: Invalid APP_SECRET_KEY is provided.
                      request_id: 64a54c25633fda13b6681318
        '429':
          description: >-
            This response is returned when the number of requests has exceeded
            the rate limit.
          content:
            application/json:
              schema:
                type: object
              example:
                status: error
                data:
                  code: 429
                  title: rate limiter exception
                  description: Exceeded rate limit for this app
        '500':
          description: >-
            This response is returned when the system runs into an unexpected
            error.
          content:
            application/json:
              schema:
                type: object
              example:
                title: Internal Server Error
                message: >-
                  An unexpected error was encountered while processing this
                  request. Please contact MoEngage Team
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: This field contains the error code.
              example: 400 Bad Request
            message:
              type: string
              description: This field contains the error message.
              example: Bad request
            details:
              type: array
              description: >-
                This array contains the specifics and describes the error in
                detail.
              items:
                type: object
                properties:
                  code:
                    type: string
                    example: InvalidValue
                  target:
                    oneOf:
                      - type: string
                      - type: array
                        items:
                          type: string
                    example: event_name
                  message:
                    oneOf:
                      - type: string
                      - type: object
                      - type: array
                    example: Business event does not exist
            request_id:
              type: string
              description: This field contains the request ID of the failed request.
              example: 64a54cf9633fda13b668132f
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: >
        The Basic authentication header contains your Base64-encoded key. This
        authentication parameter, used for access control, must be passed with
        the request. 


        Format: `Authorization: Basic Base64_ENCODED_WORKSPACEID_APIKEY==`

````