---
title: "Test Campaign"
method: POST
path: "/campaigns/test"
tags: ["Test Campaigns"]
---

# Test Campaign

`POST /campaigns/test`

## Request

- Base URL: `https://api-01.moengage.com/core-services/v1`
- URL: `https://api-01.moengage.com/core-services/v1/campaigns/test`
- Auth: HTTP basic
- TypeScript: <https://skmtc.dev/moengage/apis/moengage-campaigns-api/docs/campaigns/test/post.ts> (a function with typed inputs; its response is checked against the schema)

This API sends a test Push or Email campaign to specific users or identifiers before launching it to your entire audience. You can only test campaigns created via the API, not campaigns created through the MoEngage dashboard.

## Headers

- `MOE-APPKEY` string, required
- `MOE-PROJECT-CODE` string

## Request body

- union
  - PushCampaignTestRequest
    - `request_id` string, required: A unique identifier for this test request.
    - `channel` 'PUSH', required: The communication channel (automatically set to PUSH for this tab).
    - `basic_details` PushBasicDetails, required: Contains the basic information about the Push campaign.
      - `name` string, required: The name of the campaign.
      - `business_event` string: The business event to be mapped to the campaign. **Required** for BUSINESS_EVENT_TRIGGERED campaigns.
      - `tags` string[]: Tags that provide context about the campaign's nature or theme.
      - `team` string: The name of the team collaborating on this campaign. For more information, refer to [Teams in MoEngage](/user-guide/settings/account/team-management/teams-in-moengage).
      - `platforms` string[], required: The platforms to target for this Push campaign.
      - `broadcast_live_activity_id` string: The broadcast live activity ID for iOS Live Activities. **Required** when platform is iOS and delivery_type is BROADCAST_LIVE_ACTIVITY.
      - `geofences` Geofences: Geofence location details for location-triggered campaigns. **Required** for LOCATION_TRIGGERED campaigns.
        - `name` string, required: The unique name of the geofence location being targeted.
        - `latitude` string, required: The latitude coordinate for the center of the geofence area.
        - `longitude` string, required: The longitude coordinate for the center of the geofence area.
        - `radius` string, required: The radius in meters from the center point that defines the boundary of the geofence.
        - `dwell_time_value` string: The numeric value for the time to wait before sending the message after the trigger condition is met. **Required** when triggered_at is set to "dwell".
        - `dwell_time_granularity` 'MINUTES' | 'HOURS' | 'DAYS': The time unit for the dwell_time_value. **Required** when triggered_at is set to "dwell".
        - `response_time_value` string, required: The numeric value for the time to wait before sending the message after the trigger condition is met.
        - `response_time_granularity` 'MINUTES' | 'HOURS' | 'DAYS', required: The time unit for the response_time_value.
        - `triggered_at` 'ENTRY' | 'EXIT' | 'dwell', required: The user action that triggers the campaign (when user enters/exits the geofence).
      - `send_to_triggered_platform_only` boolean: Whether to send the campaign only to the platform that triggered the event. Applicable for event-triggered campaigns.
      - `platform_specific_details` PlatformSpecificDetails, required: Platform-specific configuration details.
        - `android` object
          - `push_amp_plus_enabled` boolean: Whether Push Amp+ feature is enabled for this campaign.
        - `ios` object: **Note:** You must pass one of these keys as true for iOS.
          - `send_to_all_eligible_device` boolean: Whether to send the campaign to all eligible devices.
          - `exclude_provisional_push_devices` boolean: Whether to exclude provisional push devices.
          - `send_to_only_provisional_push_enabled_devices` boolean: Whether to send only to provisional push-enabled devices.
    - `campaign_content` PushCampaignContent, required: Contains the content and variations for the Push campaign.
      - `locales` string[]: List of locales for multi-language campaigns. You can send campaigns in multiple languages using locales.
      - `variation_details` VariationDetails: Configuration for A/B testing variations.
        - `distribution_type` 'SHERPA' | 'MANUAL', required: The distribution type for variations.
        - `no_of_variations` integer, required: The number of variations for the campaign.
        - `manual_distribution_percentage` object: Manual percentage distribution for each variation. **Required** when distribution_type is MANUAL.
        - `sherpa_campaign_duration` integer: The Sherpa campaign duration. **Required** when distribution_type is SHERPA.
        - `sherpa_distribution_metric` 'OPEN RATE' | 'CLICK RATE' | 'BOTH': The Sherpa distribution metric. **Required** when distribution_type is SHERPA.
      - `content` object, required: The actual Push campaign content.
        - `push` PushContent, required: Push notification content for Android, iOS, and Web platforms.
          - `android` AndroidPushContent: Android push notification content.
            - `template_type` 'BASIC' | 'STYLIZED_BASIC' | 'SIMPLE_IMAGE_CAROUSEL' | 'IMAGE_BANNER_WITH_TEXT' | 'TIMER' | 'TIMER_WITH_PROGRESS_BAR' | 'Custom', required: The type of Android push template. **Note:** If you are passing a template ID, set template_type to "Custom".
            - `custom_template_id` string: The ID of the custom template. **Required** when template_type is "Custom".
            - `custom_template_version` integer: The version of the custom template.
            - `basic_details` AndroidBasicDetails: Basic details for the Android push notification. Fields vary by template_type. All templates support common fields like title, message, default_click_action.
              - …
            - `timer` AndroidTimer: Timer configuration for Timer and Timer with Progress Bar templates. **Required for:** TIMER and TIMER_WITH_PROGRESS_BAR templates
              - …
            - `buttons` AndroidButton[]: Action buttons for the notification.
              - …
            - `advanced` AndroidAdvanced: Advanced configuration options for Android push notifications.
              - …
            - `template_backup` AndroidTemplateBackup: Fallback notification content for when the template cannot be rendered. **Required for:** Stylized Basic, Simple Image Carousel, Image Banner with Text, Timer, and Timer with Progress Bar templates
              - …
          - `ios` IOSPushContent: iOS push notification content.
            - `template_type` 'BASIC' | 'STYLIZED_BASIC' | 'SIMPLE_IMAGE_CAROUSEL' | 'Custom', required: The type of iOS push template.
            - `custom_template_id` string: The ID of the custom template. **Required** when template_type is "Custom".
            - `custom_template_version` integer: The version of the custom template.
            - `basic_details` IOSBasicDetails: Basic details for the iOS push notification.
              - …
            - `buttons` IOSButton[]: Action buttons for the notification.
              - …
            - `advanced` IOSAdvanced: Advanced configuration options for iOS push notifications.
              - …
            - `template_backup` IOSTemplateBackup: Fallback notification content for when the template cannot be rendered. **Required for:** Stylized Basic and Simple Image Carousel templates
              - …
          - `web` WebPushContent: Web push notification content.
            - `template_type` 'BASIC', required: The template type for web push (currently only BASIC is supported).
            - `basic_details` WebBasicDetails, required: Basic details for the Web push notification.
              - …
            - `buttons` WebButton[]: Action buttons for the notification.
              - …
            - `advanced` WebAdvanced: Advanced configuration options for Web push notifications.
              - …
    - `personalization_details` PersonalizationDetails: Override values for personalizing campaign content during testing. **Important**: - When you pass personalization details in the personalization_details object of this API, MoEngage uses those details to personalize the user attributes or event attributes present in the content instead of the attributes present in the user profile. - You can use this API only for 10 users at a time. - The same personalization details are used across all users. For example, you pass the first name as Dave in personalization details, you have used the first name in the content, and there are 10 users. In this case, all 10 users will get the same first name (Dave).
      - `user_attributes` object: Key-value pairs for user attribute personalization. The same values are used for all test recipients.
      - `event_attributes` object: Key-value pairs for event attribute personalization. If you pass only a subset of attributes, remaining values are picked from the user profile.
    - `test_campaign_meta` PushTestCampaignMeta, required: Metadata for specifying test recipients for Push campaigns.
      - `identifier` 'USER_ATTRIBUTE_UNIQUE_ID' | 'USER_ATTRIBUTE_USER_EMAIL' | 'USER_ATTRIBUTE_USER_MOBILE' | 'MOE_GAID' | 'ADVERTISING_IDENTIFIER' | 'PUSH_ID' | 'CUSTOM_SEGMENT', required: The type of identifier used to target test users. - **USER_ATTRIBUTE_UNIQUE_ID**: Permanent internal user ID (e.g., USER_1138) - **USER_ATTRIBUTE_USER_EMAIL**: User's email address (e.g., john.doe@example.com) - **USER_ATTRIBUTE_USER_MOBILE**: User's mobile number (e.g., +14155550101) - **MOE_GAID**: Google Advertising ID from Android device - **ADVERTISING_IDENTIFIER**: Resettable advertising ID (GAID on Android, IDFA on iOS) - **PUSH_ID**: Unique device token for push notifications - **CUSTOM_SEGMENT**: User-defined segment for targeting
      - `identifier_values` string[], required: Array of identifier values to send the test campaign to.
      - `locale_name` string: The locale name to use for the test campaign (when using multi-locale campaigns).
      - `variation` string: The variation name to use for the test campaign (when using A/B testing).
  - EmailCampaignTestRequest
    - `request_id` string, required: A unique identifier for this test request.
    - `channel` 'EMAIL', required: The communication channel (automatically set to EMAIL for this tab).
    - `basic_details` EmailBasicDetails, required: Contains the basic information about the Email campaign.
      - `name` string, required: The name of the campaign.
      - `business_event` string: The business event to be mapped to the campaign. **Required** for BUSINESS_EVENT_TRIGGERED campaigns.
      - `content_type` 'PROMOTIONAL' | 'TRANSACTIONAL', required: The type of content in the campaign.
      - `subscription_category` string: The subscription category for promotional email campaigns. This targets only users who have opted-in to receive communication about this category. **Required** for PROMOTIONAL email campaigns.
      - `tags` string[]: Tags that provide context about the campaign's nature or theme.
      - `team` string: The name of the team collaborating on this campaign. For more information, refer to [Teams in MoEngage](/user-guide/settings/account/team-management/teams-in-moengage).
      - `user_attribute_identifier` string, required: The user attribute that stores the email address. Standard identifier is `MOE_EMAIL_ID`.
      - `send_only_double_opt_in_users` boolean: Whether to send the campaign only to users who have completed double opt-in. When `false` or omitted, the campaign sends to all eligible users. Ensure the Double Opt-In feature is enabled for your workspace.
      - `deduplication_attribute` string: The user attribute used for brand deduplication. Pass `""` (empty string) or omit the field to treat the campaign as single-brand. For multi-brand deduplication, pass the backend attribute name that stores the brand identifier (for example, `u_em`). Always use the backend attribute name (for example, `u_em`), not the display label (for example, `Email (Standard)`). Ensure the Brand Deduplication feature is enabled for your workspace.
    - `connector` Connector, required: Email connector configuration for sending email campaigns.
      - `connector_type` string, required: The type of connector service (e.g., SENDGRID, AWS SES, etc.).
      - `connector_name` string, required: The name of the connector configuration.
    - `campaign_content` EmailCampaignContent, required: Contains the content and variations for the Email campaign.
      - `locales` string[]: List of locales for multi-language campaigns. You can send campaigns in multiple languages using locales.
      - `variation_details` VariationDetails: Configuration for A/B testing variations.
        - `distribution_type` 'SHERPA' | 'MANUAL', required: The distribution type for variations.
        - `no_of_variations` integer, required: The number of variations for the campaign.
        - `manual_distribution_percentage` object: Manual percentage distribution for each variation. **Required** when distribution_type is MANUAL.
        - `sherpa_campaign_duration` integer: The Sherpa campaign duration. **Required** when distribution_type is SHERPA.
        - `sherpa_distribution_metric` 'OPEN RATE' | 'CLICK RATE' | 'BOTH': The Sherpa distribution metric. **Required** when distribution_type is SHERPA.
      - `content` object, required: The actual Email campaign content.
        - `email` EmailContent, required: Email campaign content.
          - `subject` string, required: The subject line of the email.
          - `preview_text` string: The preview text shown in email clients.
          - `sender_name` string, required: The name of the sender that appears in the email.
          - `from_address` string, email, required: The sender's email address.
          - `reply_to_address` string, email, required: The reply-to email address.
          - `cc_ids` string[]: Email addresses to CC.
          - `bcc_ids` string[]: Email addresses to BCC.
          - `html_content` string: The HTML content of the email. **Optional** if custom_template_id is provided.
          - `email_editor` 'Froala Editor' | 'Ace Editor': The HTML editor used for the email campaign. - **Required** if you want to create the campaign using the `Ace Editor`. - **Optional** if you want to use the default `Froala Editor`.
          - `custom_template_id` string: The ID of a custom email template. **Optional** if html_content is provided. When this field is provided, the following fields are not required: - subject - preview_text - sender_name
          - `custom_template_version` integer: The version of the custom template.
          - `attachments` object[]: Attachments to include in the email.
            - `file_type` 'URL' | 'PERSONALIZED_ATTACHMENT'
            - `url` string
            - `s3_keys` string[]: S3 object keys backing an attachment stored in S3.
          - `gmail_annotations` GmailAnnotations: Gmail Annotations shown in Gmail's Promotions tab. Two annotation types are supported: `deal_card` and `product_carousel`. These are mutually exclusive — include only one per campaign. **Note:** `gmail_annotations` is only supported when `content_type` is `PROMOTIONAL`. Using it with `TRANSACTIONAL` returns a `400` error.
            - `send_email_if_personalization_fails` boolean, required: Whether to send the email if personalization of any Gmail annotation field fails. **Required** when `gmail_annotations` is present.
            - `sender_logo` string, required: The sender logo shown in the Gmail annotation. Accepts a valid HTTPS URL or a MoEngage personalization token. **Required** when `gmail_annotations` is present.
            - `sender_logo_type` 'image_url' | 'uploaded_image', required: The source type of the sender logo. **Required** when `sender_logo` is provided.
            - `deal_card` GmailAnnotationsDealCard: Deal Card annotation shown in Gmail's Promotions tab. All four fields below are required when `deal_card` is present.
              - …
            - `product_carousel` GmailAnnotationsProductCarousel: Product Carousel annotation shown in Gmail's Promotions tab. Use `MANUAL` to specify products directly in the request, or `PRODUCT_SET` to pull products dynamically from a MoEngage Catalog product set.
              - …
    - `utm_params` UTMParams: UTM parameters for tracking campaign performance.
      - `utm_source` string, required: The source of the traffic (e.g., YouTube, Instagram, Google). **Required** when using UTM parameters.
      - `utm_medium` string, required: The channel type (e.g., Push, SMS, Email). **Required** when using UTM parameters.
      - `utm_campaign` string: The name of the campaign (e.g., Newyear, Bigbillionday).
      - `utm_term` string: Search terms for paid traffic (e.g., Mobile+sale).
      - `utm_content` string: The content element that differentiates links (e.g., banner, video).
      - `utm_custom` string: Custom UTM parameter (maximum of 5 custom parameters).
    - `personalization_details` PersonalizationDetails: Override values for personalizing campaign content during testing. **Important**: - When you pass personalization details in the personalization_details object of this API, MoEngage uses those details to personalize the user attributes or event attributes present in the content instead of the attributes present in the user profile. - You can use this API only for 10 users at a time. - The same personalization details are used across all users. For example, you pass the first name as Dave in personalization details, you have used the first name in the content, and there are 10 users. In this case, all 10 users will get the same first name (Dave).
      - `user_attributes` object: Key-value pairs for user attribute personalization. The same values are used for all test recipients.
      - `event_attributes` object: Key-value pairs for event attribute personalization. If you pass only a subset of attributes, remaining values are picked from the user profile.
    - `test_campaign_meta` EmailTestCampaignMeta, required: Metadata for specifying test recipients for Email campaigns.
      - `identifier` 'EMAIL' | 'ID' | 'CUSTOM_SEGMENT' | 'MOBILE_NUMBER', required: The type of identifier used to target test users. - **EMAIL**: Email address (content will not be personalized with user profile data) - **ID**: User ID from your system - **CUSTOM_SEGMENT**: User-defined segment - **MOBILE_NUMBER**: User's mobile phone number
      - `identifier_values` string[], required: Array of identifier values to send the test campaign to. **Note:** Maximum 10 users at a time.
      - `locale_name` string: The locale name to use for the test campaign (when using multi-locale campaigns).
      - `variation` string: The variation name to use for the test campaign (when using A/B testing).

## Response `200`

Test campaign sent successfully

- TestCampaignSuccessResponse: Response after successfully sending a test campaign.
  - `data` object: Object containing test results for each identifier. Each key is an identifier value with its delivery status.
  - `message` string: A success message.

## Other responses

- `400`: Bad Request - Missing or invalid parameters
- `401`: Authentication Failure - Invalid or missing authentication credentials
- `500`: Internal Server Error - Unexpected system error

---

[API](https://skmtc.dev/moengage/apis/moengage-campaigns-api.md) - [All operations](https://skmtc.dev/moengage/apis/moengage-campaigns-api/llms.txt) - [OpenAPI document](https://skmtc.dev/moengage/apis/moengage-campaigns-api/revisions/7fc8a931584f?raw)
