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

# Search Business Events

> This API searches for business events by specifying their event IDs.

#### Rate Limit

The rate limit is 100 RPM.


## OpenAPI

````yaml /api/business-events/business-events.yaml post /business_event/search
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-{dc}.moengage.com/v1.0
    description: MoEngage API Server
    variables:
      dc:
        default: '01'
        description: >-
          The ‘dc’ in the API Endpoint URL refers to the MoEngage Data Center
          (DC). MoEngage hosts each customer in a different DC. You can find
          your DC number and replace the value of ‘dc’ in the URL by referring
          to the DC and API endpoint mapping
          [here](/api/introduction#data-centers). Your MoEngage Data Center (DC)
          can be 01, 02, 03, 04, 05, 06, or 101.
security:
  - basicAuth: []
tags:
  - name: Business Events
    description: Manage and trigger business events.
paths:
  /business_event/search:
    post:
      tags:
        - Business Events
      summary: Search Business Events
      description: This API searches for business events by specifying their event IDs.
      operationId: searchBusinessEvents
      requestBody:
        description: >-
          Search criteria. At least one of event_ids or event_names should be
          provided.
        content:
          application/json:
            schema:
              type: object
              properties:
                event_ids:
                  type: array
                  items:
                    type: string
                  description: >
                    This field contains the list of event ids associated with
                    the business events that need to be fetched.


                    **Structure:** "event_ids": 
                    ["event_id1","event_id2","event_id3"]


                    *event_id*: The event id is the unique identifier for a
                    business event and is generated by MoEngage at the time of
                    business event creation. You must store and use this value
                    while looking up a business event using the search API.
                  example:
                    - 6447b078712cd8c650074840
                event_names:
                  type: array
                  items:
                    type: string
                  description: >
                    This field contains the list of event names associated with
                    the business events that need to be fetched.


                    **Structure:** "event_names": 
                    ["event_name1","event_name2","event_name3"]


                    *event_name*: The event name is the name associated with the
                    Business Event that is provided during the creation of the
                    event.
                  example:
                    - NewMovies
            example:
              event_ids:
                - 6447b078712cd8c650074840
      responses:
        '200':
          description: >-
            This response is returned when the request is processed
            successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/BusinessEvent'
              example:
                data:
                  - db_name: Sample_App
                    event_id: 647597767459c85d7d6d6dfd
                    event_name: NewMovies
                    event_attributes:
                      - attribute_name: MovieName
                        attribute_data_type: array
                      - attribute_name: rating
                        attribute_data_type: string
                    created_at: '2023-05-29T18:36:52.390000'
                    total_trigger: 0
                    users_in_segment: 0
                    usage_count: 0
                    created_by: john.doe@moengage.com
                    last_received_time: '2023-05-30T06:28:06.498000'
                    _id: 64a54500633fda13b6681163
        '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'
              example:
                error:
                  code: 400 Bad Request
                  message: >-
                    Additional fields are not allowed document schema for class
                    BusinessEventSearchRequest:event_name
                  details:
                    - code: InvalidValue
                      target: event_name
                      message: >-
                        Additional fields are not allowed document schema for
                        class BusinessEventSearchRequest:event_name
                  request_id: 64a54e62633fda13b6681431
        '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'
              example:
                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: 64a54e0e633fda13b6681430
        '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:
    BusinessEvent:
      type: object
      description: A full business event object.
      properties:
        db_name:
          type: string
          description: Name of the database.
          example: Sample_App
        event_id:
          type: string
          description: Unique identifier for the business event.
          example: 647597767459c85d7d6d6dfd
        event_name:
          type: string
          description: Name of the business event.
          example: NewMovies
        event_attributes:
          type: array
          items:
            $ref: '#/components/schemas/EventAttributeDefinition'
        created_at:
          type: string
          format: date-time
          description: Timestamp of when the event was created.
        last_updated:
          type: string
          format: date-time
          description: Timestamp of when the event was last updated.
        total_trigger:
          type: integer
          description: Number of times the event has been triggered.
          example: 0
        total_sent_message:
          type: integer
          description: Number of campaign messages sent for this event.
        users_in_segment:
          type: integer
          description: Number of users in the segment.
          example: 0
        usage_count:
          type: integer
          example: 0
        created_by:
          type: string
          format: email
          description: Email of the event creator.
          example: john.doe@moengage.com
        last_received_time:
          type: string
          format: date-time
          description: Timestamp of when the event was last triggered.
        _id:
          type: string
          description: Internal database ID.
          example: 64a54500633fda13b6681163
    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
    EventAttributeDefinition:
      type: object
      description: Definition of an attribute for a business event.
      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
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: >
        Authentication is done via Basic Auth. This requires a base64-encoded
        string of your credentials in the format 'username:password'.


        - **Username**: Use your MoEngage workspace ID (also known as the App
        ID). You can find it in the MoEngage dashboard at **Settings** >
        **Account** > **APIs** > **Workspace ID (earlier app id)**.

        - **Password**: Use your API Key, which you can find within the
        **Campaign report/Business events/Custom templates/Catalog API/Inform
        Report** tile.


        For more information on authentication and getting your credentials,
        refer
        [here](https://www.moengage.com/docs/api/introduction#getting-your-credentials).

````