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

# Validate Campaign (V5)

> Runs full publish-time validation (`DRAFT_PUBLISH`) on a saved draft without mutating it. Returns `valid: true` if the campaign would pass, or a list of blocking errors if it would not.

All campaign data is read from the saved draft identified by `campaign_id` in the path. There is no channel-specific payload.


<Info>
  You do not need an idempotency key for this endpoint. The validate endpoint is read-only and safe to retry freely.
</Info>

### Validation Modes

The V5 API applies validation in two modes:

| Mode                   | Triggered by                                                                         | Strictness                                                                           |
| :--------------------- | :----------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------- |
| Lenient                | Draft create (`POST /v5/campaigns`) and component patch (`PATCH /v5/campaigns/{id}`) | Partial — individual components are validated in isolation as they are written       |
| Full (`DRAFT_PUBLISH`) | `POST /v5/campaigns/{id}/validate` and publish                                       | Strict — all components are validated together as a complete, publish-ready campaign |

Use this endpoint to catch `DRAFT_PUBLISH` failures before triggering a publish.

### Validation Failures

All validation failures are blocking. There is no warning or non-blocking tier. A campaign that fails validation returns `valid: false` with a list of field-level errors. Each error identifies the `field` path and the `issue`.

### Channel-Specific Rules

The following rules are enforced at `DRAFT_PUBLISH` for each channel:

**Push**

* `campaign_content` must be present and include content for all platforms listed in `basic_details.platforms`.
* `template_type` must be valid for the target platform (Android, iOS, Web).
* Platform-specific required fields (for example, `title` and `message` for Android basic templates) must be non-empty.

**Email**

* `connector.connector_type` and `connector.connector_name` must be present and match a connector configured in your workspace.
* `basic_details.from_address` must be set and match a verified sender in the configured connector.
* `basic_details.subscription_category` must be present for `PROMOTIONAL` content type.
* `campaign_content` must include at least one variation with a non-empty `subject` and `html_content`.

### Delivery-Type-Specific Rules

The following rules are enforced at `DRAFT_PUBLISH` based on `campaign_delivery_type`:

| Delivery Type              | Additional Requirements                                                                                                                                                                               |
| :------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ONE_TIME`, `PERIODIC`     | `scheduling_details` must be present.                                                                                                                                                                 |
| `AT_FIXED_TIME` scheduling | `scheduling_details.timezone` must be present.                                                                                                                                                        |
| `PERIODIC`                 | `scheduling_details.periodic_details` must be present with a valid `sending_frequency`.                                                                                                               |
| `EVENT_TRIGGERED`          | `trigger_condition` must be present with at least one `included_filters` entry.                                                                                                                       |
| `DEVICE_TRIGGERED`         | `trigger_condition` must be present. Trigger delay fields (`trigger_delay_type`, `trigger_delay_value`, `trigger_delay_granularity`) must **not** be set — they are only valid for `EVENT_TRIGGERED`. |
| `BUSINESS_EVENT_TRIGGERED` | `basic_details.business_event` must be present.                                                                                                                                                       |
| `LOCATION_TRIGGERED`       | `basic_details.geofences` must contain at least one valid geofence entry.                                                                                                                             |

#### Rate Limits

| Rate Limit Name              | Rate Limit                                                                           |
| :--------------------------- | :----------------------------------------------------------------------------------- |
| Validate campaign per second | The total number of validate campaign requests per second per client allowed is 10.  |
| Validate campaign per minute | The total number of validate campaign requests per minute per client allowed is 100. |
| Validate campaign per hour   | The total number of validate campaign requests per hour per client allowed is 6000.  |


## OpenAPI

````yaml /api/campaigns/campaign-draft.yaml post /v5/campaigns/{campaign_id}/validate
openapi: 3.0.3
info:
  title: MoEngage Campaigns API
  version: '2025-11-20'
  description: >
    The Campaigns V5 API manages the draft campaign lifecycle — draft creation,
    incremental updates, validation, test sends, and post-publish management.


    **Note:** Campaign publishing is not yet supported in V5. To publish
    campaigns, use the V1 API (`PATCH
    /core-services/v1/campaigns/{campaign_id}`) in the interim.


    **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)


    **Campaign lifecycle:**


    1. **Create** - Start a draft with only the required fields (`channel`,
    `campaign_delivery_type`, `created_by`). Add content, audience, and
    scheduling incrementally across subsequent update calls.

    2. **Update** - Patch individual components as you refine the setup. Each
    submitted component is validated in full before the draft is updated.

    3. **Validate** - Check whether a draft would pass publish-time validation
    without committing any changes.

    4. **Test** - Send a test message to specific users from either a saved
    draft or inline content before going live.

    5. **Manage** - Pause, resume, or stop a live campaign. Search your
    workspace and retrieve lightweight metadata across all campaigns.


    **Campaign versioning** is optional per workspace:

    - When enabled, publishing an update to a live campaign creates a new
    document with an incremented `version_number`.

    - `campaign_id` is the stable identifier across all versions; each version
    has its own raw `id` (ObjectId).


    **Authentication header:** Pass your Workspace ID in the `MOE-APPKEY`
    request header, the same as in V1.
  contact:
    name: MoEngage Developer Team
    email: support@moengage.com
    url: https://developers.moengage.com
servers:
  - url: https://api-{dc}.moengage.com/
    description: MoEngage Campaigns API Server
    variables:
      dc:
        default: '01'
        description: >-
          Data center (DC) segment in the hostname. Replace `OX` with your
          workspace DC (01–06 or 101). See [Data
          centers](/api/introduction#data-centers).
security:
  - BasicAuth: []
paths:
  /v5/campaigns/{campaign_id}/validate:
    post:
      tags:
        - Create Campaigns
      summary: Validate Campaign (V5)
      description: >
        Runs full publish-time validation (`DRAFT_PUBLISH`) on a saved draft
        without mutating it. Returns `valid: true` if the campaign would pass,
        or a list of blocking errors if it would not.


        All campaign data is read from the saved draft identified by
        `campaign_id` in the path. There is no channel-specific payload.
      operationId: validate_draft_campaign_v5
      parameters:
        - $ref: '#/components/parameters/MOE-APPKEY'
        - $ref: '#/components/parameters/X-MOE-Request-Id'
        - name: campaign_id
          in: path
          required: true
          description: >
            Raw 24-char ObjectId of the campaign to validate. Use the `id` value
            returned in the Create Campaign response.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                request_id:
                  type: string
                  description: >-
                    Optional string (UUID v4 recommended) used to identify this
                    validation call. Unlike other POST endpoints, this field is
                    not required and does not enforce deduplication - the
                    validate endpoint is read-only and safe to retry freely.
                  example: '{{request_id}}'
            examples:
              validate:
                summary: Validate a draft campaign
                value:
                  request_id: '{{request_id}}'
      responses:
        '200':
          description: >-
            Validation result - always returned regardless of whether the
            campaign passes or fails validation.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/V5SuccessEnvelope'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/V5ValidateResponse'
              examples:
                valid:
                  summary: Campaign passes validation
                  value:
                    response_id: abc-501
                    type: campaign
                    data:
                      valid: true
                invalid:
                  summary: Campaign fails validation
                  value:
                    response_id: abc-501
                    type: campaign
                    data:
                      valid: false
                      errors:
                        - field: >-
                            campaign_content.content.push.android.basic_details.title
                          issue: title is required
                        - field: scheduling_details
                          issue: scheduling_details is required for publish
        '400':
          $ref: '#/components/responses/V5ValidationError'
        '401':
          $ref: '#/components/responses/V5Unauthorized'
        '500':
          $ref: '#/components/responses/V5InternalError'
components:
  parameters:
    MOE-APPKEY:
      name: MOE-APPKEY
      in: header
      required: true
      description: >
        Your MoEngage Workspace ID (App ID). Find it in the dashboard at
        **Settings** > **Account** > **APIs** > **Workspace ID**.
      schema:
        type: string
      example: '{{workspace_id}}'
    X-MOE-Request-Id:
      name: X-MOE-Request-Id
      in: header
      required: true
      description: >
        Correlates with `response_id`. Supply this header or `request_id` in the
        body; if both are set, they must match.
      schema:
        type: string
  schemas:
    V5SuccessEnvelope:
      type: object
      properties:
        response_id:
          type: string
        type:
          type: string
          example: campaign
        data:
          type: object
    V5ValidateResponse:
      type: object
      description: >
        - When `valid` is `true`, only `valid` is returned.

        - When `valid` is `false`, `errors` lists one or more field-level issues
        found during publish-time validation (`DRAFT_PUBLISH`).
      properties:
        valid:
          type: boolean
          description: >-
            `true` if the campaign passes all publish-time validation checks.
            `false` if one or more checks fail.
          example: false
        errors:
          type: array
          description: >
            Present only when `valid` is `false`. Each item describes a single
            validation failure. Multiple errors can be returned, and more than
            one error can reference the same field.
          items:
            type: object
            properties:
              field:
                type: string
                description: >
                  Dot-separated JSON path to the field that failed validation,
                  relative to the campaign document root (for example,
                  `campaign_content.content.push.android.basic_details.title` or
                  `scheduling_details`).
                example: campaign_content.content.push.android.basic_details.title
              issue:
                type: string
                description: >-
                  Human-readable description of the validation failure for this
                  field. The value is free-form and may vary by channel,
                  delivery type, and component.
                example: title is required
    V5ErrorEnvelope:
      type: object
      properties:
        response_id:
          type: string
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - VALIDATION_FAILED
                - UNPROCESSABLE_ENTITY
                - BAD_REQUEST
                - RATE_LIMITED
                - UNAUTHORIZED
                - INTERNAL_ERROR
                - FORBIDDEN
            message:
              type: string
            target:
              type: string
            details:
              type: array
              items:
                type: object
                properties:
                  target:
                    type: string
                  message:
                    type: string
            request_id:
              type: string
              description: >
                The `request_id` from the originating request. Use this to
                correlate a failed response back to the specific call that
                triggered it, particularly useful in high-volume or retry
                scenarios.


                In V1, `request_id` appeared inside the `error` object. V5
                preserves this field in the same location.
  responses:
    V5ValidationError:
      description: Request failed schema or component validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/V5ErrorEnvelope'
          example:
            response_id: abc-101
            error:
              code: VALIDATION_FAILED
              message: One or more fields failed validation.
              request_id: req-push-001
              details:
                - target: campaign_delivery_type
                  message: campaign_delivery_type value is required.
    V5Unauthorized:
      description: Authentication failure.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/V5ErrorEnvelope'
          example:
            response_id: abc-101
            error:
              code: UNAUTHORIZED
              message: Invalid or missing credentials.
              details: []
    V5InternalError:
      description: Unhandled server-side failure.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/V5ErrorEnvelope'
          example:
            response_id: abc-101
            error:
              code: INTERNAL_ERROR
              message: Internal server error.
              details: []
  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**: On your MoEngage workspace, navigate to **Settings** →
        **Account** → **API keys** and click **Create new key**. The tab lists
        every API surface (Data, Segmentation, Push, Email, Campaigns,
        Templates, and more) and exposes per-resource actions. For Campaigns,
        ensure the **View**, **Create & Manage**, and **Create, Manage &
        Publish** checkboxes are selected.


        For more information on authentication and getting your credentials,
        refer to [Getting your
        credentials](/api/introduction#getting-your-credentials).


        Send the value in the `Authorization` header as `Basic` followed by
        Base64-encoding of `appkey:apisecret` (workspace ID and API key).

````