> ## 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.

# Fetch All Recommendations

> This API retrieves the list of recommendations configured in your workspace, along with the metadata of each recommendation. The results are sorted by the last updated time, with the most recently updated recommendation first.

Use this API to look up the `recommendation_id` of a recommendation, which you need for the [Fetch Recommendation Details](/api/recommendations/fetch-recommendation-details) and [Fetch Recommendation Results](/api/recommendations/fetch-recommendation-results) APIs.

The response does not include a total count of recommendations. You have reached the last page when the `items` array contains fewer recommendations than the `size` you requested, or when it is empty.


#### Rate Limit

You can make 100 requests per minute and 10,000 requests per day.


## OpenAPI

````yaml /api/recommendations/recommendations.yaml get /recommendations
openapi: 3.0.3
info:
  title: MoEngage Recommendation API
  description: >
    This API lets you list the recommendations in your workspace and
    fetch/retrieve the metadata associated with a recommendation using the
    recommendation ID. The metadata can include the recommendation name, model
    type, status, creation and update time, and so on.


    Authentication is via Basic Auth.
  version: '1.0'
servers:
  - url: https://api-{dc}.moengage.com/v1
    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: Recommendations
    description: Operations related to fetching recommendation configurations and results.
paths:
  /recommendations:
    get:
      tags:
        - Recommendations
      summary: Fetch All Recommendations
      description: >
        This API retrieves the list of recommendations configured in your
        workspace, along with the metadata of each recommendation. The results
        are sorted by the last updated time, with the most recently updated
        recommendation first.


        Use this API to look up the `recommendation_id` of a recommendation,
        which you need for the [Fetch Recommendation
        Details](/api/recommendations/fetch-recommendation-details) and [Fetch
        Recommendation
        Results](/api/recommendations/fetch-recommendation-results) APIs.


        The response does not include a total count of recommendations. You have
        reached the last page when the `items` array contains fewer
        recommendations than the `size` you requested, or when it is empty.
      operationId: fetchAllRecommendations
      parameters:
        - $ref: '#/components/parameters/AppKeyHeader'
        - name: size
          in: query
          required: false
          description: >
            This parameter indicates the number of recommendations to return in
            a single page. The maximum value is 100. Pass it along with
            `batch_num` to paginate the results.
          schema:
            type: integer
            minimum: 1
            maximum: 100
          example: 10
        - name: batch_num
          in: query
          required: false
          description: >
            This parameter indicates the page number to return. The first page
            is `1`. Pass it along with `size`. For example, `size=10` and
            `batch_num=2` return the 11th to the 20th recommendations.
          schema:
            type: integer
            minimum: 1
            default: 1
          example: 1
        - name: status
          in: query
          required: false
          description: >
            This parameter filters the results by the recommendation's status.
            The supported values are `Active`, `Processing`, `Archived`, and
            `Failed`. These values are case-sensitive.


            To filter by more than one status, pass the values as a
            comma-separated list. For example, `status=Active,Processing`.


            If you don't provide this parameter, the response excludes archived
            recommendations.
          schema:
            type: string
          examples:
            single_status:
              summary: Single Status
              value: Active
            multiple_statuses:
              summary: Multiple Statuses
              value: Active,Processing
      responses:
        '200':
          description: >-
            Indicates that the request is successful and the list of
            recommendations is fetched.
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    description: >-
                      This array contains the metadata of each recommendation in
                      your workspace.
                    items:
                      $ref: '#/components/schemas/RecommendationMetadata'
        '400':
          description: >-
            Bad request. Possible issues include an unsupported status value or
            an invalid pagination parameter.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_status_value:
                  summary: Invalid Status Value
                  value:
                    code: invalid-status-value
                    message: >-
                      Invalid status value(s) provided: 'INVALID'. Valid status
                      values are: Active, Archived, Failed, Processing
                      (case-sensitive).
                invalid_pagination_param:
                  summary: Invalid Pagination Parameter
                  value:
                    code: invalid-pagination-param
                    message: >-
                      Invalid value 'abc' for parameter 'size'. Please provide a
                      valid integer value.
        '401':
          description: >-
            Unauthenticated. Your request is unauthorized. Verify your
            credentials and try again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: request-unauthenticated
                message: >-
                  Your request is unauthorized. Please verify your credentials
                  and try again.
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          description: >-
            This response is returned when the system runs into an unexpected
            error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: unexpected-error
                message: >-
                  Something went wrong with your request. Please contact the
                  MoEngage team for further assistance.
components:
  parameters:
    AppKeyHeader:
      name: MOE-APPKEY
      in: header
      required: true
      description: >
        This is the Workspace ID of your MoEngage account that must be passed
        with the request. You can find it in the MoEngage dashboard at
        **Settings** > **Account** > **APIs** > **Workspace ID (earlier app
        id)**.
      schema:
        type: string
  schemas:
    RecommendationMetadata:
      type: object
      properties:
        id:
          type: string
          description: It is the unique recommendation ID.
        db_name:
          type: string
          description: This is your workspace name.
        recommendation_type:
          type: string
          description: >
            It represents the type of recommendations from which the results
            will be fetched.

            The supported values are: `user_action`, `item_attribute`,
            `catalog_alert`, `similar_item`, `frequently_viewed_together`,
            `frequently_bought_together`, `trending_item`,
            `user_personalization`.
        name:
          type: string
          description: >-
            This field represents the name of the recommendation for which you
            want to fetch the details.
        description:
          type: string
          nullable: true
          description: >-
            This field describes the recommendation given at the time of its
            creation.
        catalog:
          type: string
          description: >-
            This is the unique identifier of the catalog assigned to the
            requested recommendation.
        status:
          type: string
          enum:
            - Active
            - Processing
            - Archived
            - Failed
          description: >
            This field shows the current status of the recommendation. A
            recommendation is always in one of these four states.
        created_time:
          type: string
          format: date-time
          description: This field shows the timestamp when a recommendation was created.
        updated_time:
          type: string
          format: date-time
          description: >-
            This field shows the timestamp when a recommendation setting was
            last modified.
        recom_execution_id:
          type: string
          description: >-
            This field references the recommendation execution record that
            tracks the last run.
        next_run_time:
          type: string
          format: date-time
          description: >-
            This field shows the scheduled time of the next recommendation
            execution.
          nullable: true
        all_user_actions:
          type: boolean
          description: >
            This key shows whether all user actions are considered when MoEngage
            finds the most recently interacted item. When it is `true`, MoEngage
            takes the most recently interacted ID from any user action setup.
            MoEngage then finds items related to that ID, based on the
            recommendation type.


            **Note**: This key is available with the `similar_item`,
            `frequently_viewed_together`, and `frequently_bought_together`
            recommendation types.
          nullable: true
        include_filters:
          $ref: '#/components/schemas/IncludeExcludeFilters'
          nullable: true
        exclude_filters:
          $ref: '#/components/schemas/IncludeExcludeFilters'
          nullable: true
        custom_settings:
          $ref: '#/components/schemas/CustomSettings'
          nullable: true
          description: >-
            This key defines the customization applied to the recommendation
            results as per the recommendation setup. Currently, you can apply
            the user action and item attribute filters over recommendations.
        sort:
          $ref: '#/components/schemas/SortCriteria'
          nullable: true
          description: >
            This key defines the sorting logic based on which recommendation
            results will be ordered. This object's value provides the
            attributes' details and sorting order.


            **Note**: This key is available with the `user_action` and
            `item_attribute` recommendation types.
        trend:
          $ref: '#/components/schemas/TrendSettings'
          nullable: true
          description: >
            This key defines the user action that identifies trending items for
            `trending_item` recommendations, and the period over which the trend
            is calculated.


            **Note**: This key is available with the `trending_item`
            recommendation type.
        catalog_watch_setting:
          $ref: '#/components/schemas/CatalogWatchSetting'
          nullable: true
        trigger_event:
          type: boolean
          default: false
          description: >
            When this field is `true`, MoEngage triggers a business event for
            catalog alert recommendations. The event is named
            `Catalog_Alerts_{recommendation_name}`. Use this event to trigger
            campaigns or flows when the catalog alert conditions are met.


            **Note**: This key applies only when `recommendation_type` is
            `catalog_alert`.
        business_event:
          type: string
          nullable: true
          default: null
          description: >-
            This field shows the identifier of the business event that triggers
            this recommendation.
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: >-
            Each error code is unique and serves as a shorthand representation
            for the type of error.
        message:
          type: string
          description: >-
            With the error code, a detailed message is also provided in the
            response describing the specifics of the request failure and the
            nature of the error.
    IncludeExcludeFilters:
      type: object
      properties:
        filters:
          type: array
          items:
            $ref: '#/components/schemas/Filter'
        filter_operator:
          type: string
          enum:
            - and
            - or
    CustomSettings:
      type: object
      properties:
        item_filters:
          type: object
          properties:
            user_actions:
              type: object
              description: >-
                This key holds the user action filters that refine the
                recommendation results by including or excluding items based on
                user behavior.
      description: Defines custom filters applied to recommendations.
    SortCriteria:
      type: object
      properties:
        data_type:
          type: string
          example: double
        param_type:
          type: string
          example: product_attribute
        param:
          type: string
          example: price
        direction:
          type: string
          enum:
            - '1'
            - '-1'
          description: 1 for ascending, -1 for descending
    TrendSettings:
      type: object
      description: >-
        Defines the user action that identifies trending items and the period
        over which the trend is calculated.
      properties:
        type:
          type: string
          description: >-
            The user action used to determine trending items. It specifies the
            behavior metric that items are ranked by.
          example: most_purchased_items
        in_the_last:
          type: string
          description: >-
            The lookback window for calculating the trend. Only user actions
            within this period are considered.
          example: 7_days
      example:
        type: most_purchased_items
        in_the_last: 7_days
    CatalogWatchSetting:
      type: object
      description: >
        This object holds the configuration for catalog watch and catalog alert
        recommendations. It defines the product attribute being watched and the
        condition that triggers the alert.
      properties:
        catalog_attribute:
          type: string
          description: The product attribute being watched, such as `price` or `quantity`.
        operator:
          type: string
          description: The comparison operator applied to the attribute.
        value:
          type: number
          description: The primary threshold value that the attribute is compared against.
        value1:
          type: number
          description: >-
            The secondary threshold value. This field is used only with range
            operators, such as BETWEEN.
        type:
          type: string
          description: Whether the threshold value is an absolute number or a percentage.
        compare_to:
          type: string
          description: The baseline that the current attribute value is compared against.
      example:
        catalog_attribute: price
        operator: LESS_THAN
        value: 500
        type: absolute
        compare_to: previous_value
    Filter:
      type: object
      properties:
        executed:
          type: boolean
        filter_type:
          type: string
          example: product_filter
        operator_fe:
          type: string
          example: exists
        name:
          type: string
          example: product_id
        data_type:
          type: string
          example: string
        operator:
          type: string
          example: exists
        value:
          type: string
          nullable: true
        negate:
          type: boolean
        case_sensitive:
          type: boolean
        hasError:
          type: boolean
  responses:
    TooManyRequests:
      description: Too Many Requests. There won't be any response body for this request.
      headers:
        x-ratelimit-limit:
          schema:
            type: integer
          description: >-
            The maximum number of requests that the consumer is permitted to
            make in a given time window.
        x-ratelimit-remaining:
          schema:
            type: integer
          description: The number of requests remaining in the current rate limit window.
        x-ratelimit-reset:
          schema:
            type: integer
          description: >-
            The time at which the current rate limit window resets in UTC epoch
            seconds.
  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).

````