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

# Personalized Preview

> This API shows a preview of personalized content for a specific user before sending a Push, Email, or SMS campaign. This API retrieves personalized message content with all user/event attributes resolved. Use this API to validate your personalization logic and see exactly how content will appear to specific users before launching campaigns. 


#### Personalization Support

* User attributes
* Event attributes
* Custom templates
* Content blocks
* Content APIs
* Product sets

#### Rate Limit

The rate limit is 10,000 requests per minute.


## OpenAPI

````yaml /api/campaigns/campaigns.yaml post /personalization/preview
openapi: 3.0.3
info:
  title: MoEngage Campaigns API
  version: '2025-11-20'
  description: >
    The MoEngage Campaigns API allows you to create and manage Push and Email
    campaigns programmatically.


    **Supported Channels:**

    - Push (Android, iOS, Web)

    - Email


    **Supported Delivery Types:**

    - ONE_TIME

    - PERIODIC

    - EVENT_TRIGGERED

    - BUSINESS_EVENT_TRIGGERED

    - DEVICE_TRIGGERED (Push only)

    - LOCATION_TRIGGERED (Push only)

    - BROADCAST_LIVE_ACTIVITY (Push iOS only)

     | Rate Limit Name | Rate Limit |
     | :--- | :--- |
     | Create campaign per second | The total number of create campaign operations per second per client allowed is 5. |
     | Create campaign per minute | The total number of create campaign operations per minute per client allowed is 25. |
     | Create campaign per hour | The total number of create campaign operations per hour per client allowed is 100. |

     You can create 5 campaigns per minute, 25 campaigns per hour, and 100 campaigns per day.

     <Note>
       * Breaching the limits will reject the request.
        * Per hour and per day limits will consider the calculation based on the last hour and last 24 hrs respectively.
     </Note>

    For more details, visit [MoEngage Developer
    Documentation](https://developers.moengage.com).
  contact:
    name: MoEngage Developer Team
    email: support@moengage.com
    url: https://developers.moengage.com
servers:
  - url: https://api-{dc}.moengage.com/core-services/v1
    description: MoEngage Campaigns 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: []
paths:
  /personalization/preview:
    post:
      tags:
        - Test Campaigns
      summary: Personalized Preview
      description: >
        This API shows a preview of personalized content for a specific user
        before sending a Push, Email, or SMS campaign. This API retrieves
        personalized message content with all user/event attributes resolved.
        Use this API to validate your personalization logic and see exactly how
        content will appear to specific users before launching campaigns. 
      operationId: personalized_preview
      parameters:
        - $ref: '#/components/parameters/MOE-APPKEY'
        - name: data-compression
          in: header
          required: false
          description: |
            Whether to pass the payload in compressed format.

            Set to `true` to send compressed payload.
          schema:
            type: boolean
          example: false
      requestBody:
        description: Provide personalization preview request with content and user details.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PersonalizedPreviewRequest'
            examples:
              user_attribute_preview:
                summary: Preview with User Attributes
                value:
                  request_id: preview_req_12345
                  personalization_details:
                    channel: EMAIL
                    user_attributes:
                      Gender: Female
                      First Name: Jane
                  personalization_content:
                    payload:
                      email_html: >-
                        <!DOCTYPE html><html><body><p>Hi {{UserAttribute['First
                        Name']}}, your gender is
                        {{UserAttribute['Gender']}}</p></body></html>
                  user_details:
                    identifier: ID
                    identifier_value: USER_001
              event_attribute_preview:
                summary: Preview with Event Attributes
                value:
                  request_id: preview_req_event
                  personalization_details:
                    event_name: App_Opened
                    channel: EMAIL
                    user_attributes:
                      First Name: John
                    event_attributes:
                      App_Version: 1.0.2
                  personalization_content:
                    payload:
                      message: >-
                        Hi {{UserAttribute['First Name']}}, you're using version
                        {{EventAttribute['App_Version']}}
                  user_details:
                    identifier: ID
                    identifier_value: JOHN012
              custom_template_preview:
                summary: Preview with Custom Template
                value:
                  request_id: preview_req_template
                  personalization_details:
                    channel: PUSH
                    user_attributes:
                      First Name: John
                    event_attributes:
                      App Version: '34232'
                  personalization_content:
                    custom_template_data:
                      template_id: 5b7d04c6-8ddc-4957-80d9-c67266079609
                      version: '1'
                  user_details:
                    identifier: ID
                    identifier_value: JOHN012
              content_block_preview:
                summary: Preview with Content Block
                value:
                  request_id: preview_req_cb
                  personalization_details:
                    channel: SMS
                    user_attributes:
                      First Name: John Doe
                  personalization_content:
                    payload:
                      content_block: '{{ContentBlock[''simple_text_cb'']}}'
                  user_details:
                    identifier: ID
                    identifier_value: JOHN012
              product_set_preview:
                summary: Preview with Product Set
                value:
                  request_id: preview_req_products
                  personalization_details:
                    channel: SMS
                  personalization_content:
                    payload:
                      product_set: >-
                        {% if ProductSet.test_prod%}{% for product in
                        ProductSet.test_prod%}{{product.title}} {% endfor %}{%
                        else %}MOE_NOT_SEND{% endif %}
                  user_details:
                    identifier: ID
                    identifier_value: JOHN012
      responses:
        '200':
          description: Successfully retrieved personalized content preview
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PersonalizedPreviewResponse'
              examples:
                user_attribute_result:
                  summary: Personalized User Attributes
                  value:
                    personalized_content:
                      payload:
                        email_html: >-
                          <!DOCTYPE html><html><body><p>Hi Jane, your gender is
                          Female</p></body></html>
                event_attribute_result:
                  summary: Personalized Event Attributes
                  value:
                    personalized_content:
                      payload:
                        message: Hi John, you're using version 1.0.2
                custom_template_result:
                  summary: Custom Template Result
                  value:
                    personalized_content:
                      payload:
                        data:
                          - meta_info:
                              platform:
                                - ANDROID
                              template_id: '12356733'
                              template_name: test_template
                              channel: PUSH
                product_set_result:
                  summary: Product Set Result
                  value:
                    personalized_content:
                      payload:
                        product_set: >-
                          Brown Banana Chocolate Wine Honey Onion Mango Cookies
                          Bread Toffee
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    MOE-APPKEY:
      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
      example: YOUR_WORKSPACE_ID
  schemas:
    PersonalizedPreviewRequest:
      type: object
      required:
        - request_id
        - personalization_content
        - personalization_details
      properties:
        request_id:
          type: string
          description: A unique identifier for this personalization preview request.
          example: preview_req_12345
        personalization_content:
          type: object
          description: >
            The content to personalize.


            **Note:** Either `payload` or `custom_template_data` must be
            provided.
          properties:
            payload:
              type: object
              additionalProperties: true
              description: >
                Flexible key-value pairs containing content to personalize.


                Can include any name and number of keys with HTML, text, or
                Jinja templates.
              example:
                email_html: >-
                  <!DOCTYPE html><html><body><p>Hi {{UserAttribute['First
                  Name']}}</p></body></html>
            custom_template_data:
              type: object
              description: |
                Custom template information.

                **Required fields when using custom templates:**
                - template_id
                - version
              properties:
                template_id:
                  type: string
                  description: The ID of the custom template.
                  example: 5b7d04c6-8ddc-4957-80d9-c67266079609
                version:
                  type: string
                  description: The version of the custom template.
                  example: '1'
        user_details:
          type: object
          description: >
            Information about the user to preview for.


            **Note:** If using user_details, both `identifier` and
            `identifier_value` are mandatory.
          properties:
            identifier:
              type: string
              description: |
                The type of unique identifier used to specify the user.

                Can be ID, email, phone number, etc.
              example: ID
            identifier_value:
              type: string
              description: The corresponding value of the selected identifier.
              example: USER_12345
        personalization_details:
          type: object
          description: |
            **Important**:
              - When you pass personalization_details, MoEngage uses those values to personalize content instead of actual user profile data.
              - Attributes must exist in the MoEngage dashboard.
              - If an attribute does not exist and default value is not “MOE_NOT_SEND”, it will appear empty.
              - Event attributes can be used when the same event is used for the campaign.
              - You can use event attributes to personalize content APIs when the same event is used for the campaign.
          required:
            - channel
          properties:
            channel:
              type: string
              enum:
                - EMAIL
                - PUSH
                - SMS
              description: The channel for which to preview personalized content.
            event_name:
              type: string
              description: |
                The event name for personalization.

                **Required** if event attributes are present in the payload.
              example: App_Opened
            user_attributes:
              type: object
              additionalProperties: true
              description: |
                Key-value pairs representing specific user characteristics.

                Can contain any name and number of keys.
              example:
                First Name: John
                Last Name: Doe
                Gender: Male
            event_attributes:
              type: object
              additionalProperties: true
              description: |
                Key-value pairs describing properties of a particular event.

                Can contain any name and number of keys.
              example:
                App_Version: 1.0.2
                Campaign Name: Summer Sale
    PersonalizedPreviewResponse:
      type: object
      description: Response containing the personalized content.
      properties:
        personalized_content:
          type: object
          description: The personalized content with all attributes resolved.
          properties:
            payload:
              type: object
              additionalProperties: true
              description: >
                The personalized content with all user/event attributes and
                personalization elements resolved.


                Structure mirrors the input payload with personalized values
                filled in.
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: The error code (e.g., "400 Bad Request").
            message:
              type: string
              description: Description of why the request failed.
            target:
              type: string
              description: The target of the error.
            details:
              type: array
              items:
                type: object
                properties:
                  target:
                    type: string
                  message:
                    type: string
            request_id:
              type: string
              description: The request ID associated with this error.
  responses:
    BadRequest:
      description: Bad Request - Missing or invalid parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: 400 Bad Request
              message: request_id key is mandatory field
              target: request_id
              details:
                - target: request_id
                  message: request_id key is mandatory field
              request_id: '11'
    Unauthorized:
      description: Authentication Failure - Invalid or missing authentication credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            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: ''
    RateLimitExceeded:
      description: Rate Limit Breach - Too many requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: 429 conflict
              message: rate_limit
              target: ''
              details:
                - target: rate_limit
                  message: Rate limiting breached
              request_id: 3UXNNGsqV
    InternalServerError:
      description: Internal Server Error - Unexpected system error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: 500 Internal Server Error
              message: Something went wrong. Please contact Moengage team
              target: string
              details:
                - message: 'Expecting value: line 1 column 1 (char 0)'
                  target: ''
  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).

````