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

# Preview Email Campaign Audience

> Inspect canonical email targeting and reachable recipients.

Select the campaign's project explicitly and use `resources.read`. This preview provides reach evidence without launching the campaign. Review the campaign's readiness and use its project-aware dashboard handoff for production scheduling or launch.


## OpenAPI

````yaml api-reference/openapi.json GET /campaigns/{id}/audience-preview
openapi: 3.0.1
info:
  title: Sendrealm API
  description: >-
    API for email, push, audience resources, domains, campaign drafts,
    templates, events, topics, and automations
  license:
    name: MIT
  version: 0.2.0
servers:
  - url: https://api.sendrealm.com
security:
  - bearerAuth: []
paths:
  /campaigns/{id}/audience-preview:
    get:
      summary: Preview canonical email targeting and exact reachable recipients.
      parameters:
        - name: X-Sendrealm-Project-Id
          in: header
          required: false
          schema:
            type: string
            format: uuid
          description: >-
            Explicit project context. Required for personal-key project resource
            calls; integration keys retain their configured default. MCP clients
            supply project_id in each tool call instead.
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                  data:
                    $ref: '#/components/schemas/McpAudiencePreview'
                  metadata:
                    $ref: '#/components/schemas/PaginationMetadata'
                required:
                  - data
                additionalProperties:
                  $ref: '#/components/schemas/JsonValue'
        '400':
          description: Invalid input with field-level issues.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Invalid, expired or revoked credential.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Scope, grant or current role does not permit this operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    McpAudiencePreview:
      type: object
      properties:
        status:
          type: string
          enum:
            - ready
        exact:
          type: boolean
          enum:
            - true
        calculated_at:
          type: string
          format: date-time
        targeting:
          $ref: '#/components/schemas/McpTargetingDefinition'
        effective_targeting:
          $ref: '#/components/schemas/McpTargetingDefinition'
        matched_contacts:
          type: integer
        matched_devices:
          type: integer
        reachable_email_contacts:
          type: integer
        reachable_push_contacts:
          type: integer
        reachable_push_devices:
          type: integer
        by_platform:
          type: array
          items:
            type: object
            properties:
              platform:
                type: string
              devices:
                type: integer
            required:
              - platform
              - devices
            additionalProperties: false
      required:
        - status
        - exact
        - calculated_at
        - targeting
        - effective_targeting
        - matched_contacts
        - matched_devices
        - reachable_email_contacts
        - reachable_push_contacts
        - reachable_push_devices
      additionalProperties:
        $ref: '#/components/schemas/JsonValue'
    PaginationMetadata:
      type: object
      required:
        - total
        - items
        - limit
        - after
        - next
        - has_more
      properties:
        total:
          type: integer
        items:
          type: integer
        limit:
          type: integer
        after:
          type: string
          nullable: true
        next:
          type: string
          nullable: true
        has_more:
          type: boolean
    JsonValue:
      oneOf:
        - type: string
          nullable: true
        - type: number
        - type: boolean
        - type: object
          additionalProperties:
            $ref: '#/components/schemas/JsonValue'
        - type: array
          items:
            $ref: '#/components/schemas/JsonValue'
    Error:
      type: object
      required:
        - status
        - error
      properties:
        status:
          type: integer
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details:
              $ref: '#/components/schemas/JsonValue'
            issues:
              type: array
              items:
                $ref: '#/components/schemas/ValidationIssue'
    McpTargetingDefinition:
      type: object
      properties:
        version:
          type: integer
          enum:
            - 1
          description: Targeting contract version.
        base:
          oneOf:
            - type: object
              properties:
                type:
                  type: string
                  description: Explicitly target all eligible contacts.
                  enum:
                    - all_contacts
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  description: Target the selected static audiences.
                  enum:
                    - static_audiences
                audience_ids:
                  type: array
                  items:
                    type: string
                    description: Audience UUID returned by audiences_list.
                    format: uuid
                  description: >-
                    Included audience IDs; empty means an incomplete draft,
                    never all contacts.
                  maxItems: 100
              required:
                - type
                - audience_ids
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  description: Explicitly target subscribed push devices.
                  enum:
                    - all_subscribed_devices
              required:
                - type
              additionalProperties: false
        excluded_audience_ids:
          type: array
          items:
            type: string
            description: Excluded audience UUID.
            format: uuid
          description: Audiences excluded after base selection.
          maxItems: 100
        contact_rules:
          $ref: '#/components/schemas/McpTargetingRule'
        push_rules:
          $ref: '#/components/schemas/McpTargetingRule'
      required:
        - version
        - base
      additionalProperties: false
      description: >-
        Canonical campaign targeting. Obtain audience IDs through
        audiences_list; never infer all-contact intent from an empty selection.
      x-sendrealm-mcp-contract: true
    ValidationIssue:
      type: object
      required:
        - code
        - path
        - message
      properties:
        code:
          type: string
        path:
          type: string
          nullable: true
        message:
          type: string
    McpTargetingRule:
      oneOf:
        - type: object
          properties:
            kind:
              type: string
              description: Boolean group.
              enum:
                - group
            operator:
              type: string
              description: Combine children using this operator.
              enum:
                - and
                - or
            children:
              type: array
              items:
                $ref: '#/components/schemas/McpTargetingRule'
              description: Nested rules; maximum five group levels and 200 total nodes.
              minItems: 1
              maxItems: 200
          required:
            - kind
            - operator
            - children
          additionalProperties: false
        - type: object
          properties:
            kind:
              type: string
              description: One predicate.
              enum:
                - rule
            source:
              type: string
              description: Contact sources only in email/contact targeting.
              enum:
                - contact
                - device
                - device_event
                - push_event
            field:
              type: string
              description: Property or event field path.
              minLength: 1
              maxLength: 160
            operator:
              type: string
              description: Comparison; event sources use has_happened/has_not_happened.
              enum:
                - eq
                - neq
                - in
                - not_in
                - exists
                - not_exists
                - gt
                - gte
                - lt
                - lte
                - between
                - within_last
                - has_happened
                - has_not_happened
            value:
              $ref: '#/components/schemas/McpJsonValue'
            window:
              type: object
              properties:
                amount:
                  type: integer
                  minimum: 1
                  maximum: 3650
                  description: Window size.
                unit:
                  type: string
                  description: Window unit.
                  enum:
                    - hours
                    - days
                    - weeks
              required:
                - amount
                - unit
              additionalProperties: false
          required:
            - kind
            - source
            - field
            - operator
          additionalProperties: false
      description: Version-one targeting predicate.
      x-sendrealm-mcp-contract: true
    McpJsonValue:
      oneOf:
        - type: string
          nullable: true
        - type: number
        - type: boolean
        - type: array
          items:
            $ref: '#/components/schemas/McpJsonValue'
        - type: object
          additionalProperties:
            $ref: '#/components/schemas/McpJsonValue'
      description: >-
        JSON application data. Do not include credentials or unnecessary
        personal data.
      x-sendrealm-mcp-contract: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Integration key for backend workloads, or a scoped personal key
        (sr_user_) for account discovery and supported project operations. MCP
        accepts only personal keys.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.