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

# Generate campaign message template

> Proxies to the existing message-template generator and injects campaign context.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/platforms/{platform}/campaigns/{campaignId}/message-template/generate
openapi: 3.1.0
info:
  title: Optareach Public API
  version: 1.0.0
  description: >-
    Platform-first API surface for accounts, prospects, campaigns, inbox,
    tracked searches, AI rooms, jobs, workspaces, analytics, billing, profile,
    and knowledge bases.
servers:
  - url: /
    description: Current environment
security: []
tags:
  - name: Meta
    description: API metadata and discovery
  - name: Platforms
    description: Platform registry and capabilities
  - name: Accounts
    description: Connected sender accounts
  - name: Prospects
    description: Prospect lists and leads
  - name: Campaigns
    description: Campaign lifecycle and performance
  - name: Inbox
    description: Conversations and messages
  - name: TrackedSearches
    description: Mentions and tracked search streams
  - name: AI
    description: AI chat rooms and enrichment
  - name: Jobs
    description: Background jobs
  - name: Workspaces
    description: Workspace management
  - name: KnowledgeBases
    description: Knowledge base management
  - name: Analytics
    description: Global dashboard metrics
  - name: Billing
    description: Subscriptions and credits
  - name: Profile
    description: Current user profile
  - name: Tags
    description: Conversation tags
  - name: Notifications
    description: Notification feed
paths:
  /api/v1/platforms/{platform}/campaigns/{campaignId}/message-template/generate:
    post:
      tags:
        - Campaigns
      summary: Generate campaign message template
      description: >-
        Proxies to the existing message-template generator and injects campaign
        context.
      parameters:
        - $ref: '#/components/parameters/platform'
        - $ref: '#/components/parameters/campaignId'
      requestBody:
        description: Template generation payload
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CampaignTemplateRequest'
            example:
              objective: Book a discovery call
              tone: concise
              contextNotes: Mention recent hiring momentum and founder-led GTM.
      responses:
        '200':
          description: Generated template
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/MessageTemplate'
                required:
                  - data
              example:
                data:
                  body: >-
                    Hi {{firstName}}, noticed {{company}} is hiring. Worth
                    trading notes on outbound efficiency?
                  variables:
                    - firstName
                    - company
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    platform:
      name: platform
      in: path
      required: true
      schema:
        type: string
    campaignId:
      name: campaignId
      in: path
      required: true
      schema:
        type: string
  schemas:
    CampaignTemplateRequest:
      type: object
      properties:
        objective:
          type: string
        tone:
          type: string
        contextNotes:
          type: string
    MessageTemplate:
      type: object
      properties:
        body:
          type: string
        variables:
          type: array
          items:
            type: string
      required:
        - body
        - variables
  responses:
    NotFound:
      description: Not found
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                properties:
                  code:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - code
                  - message
            required:
              - error
          example:
            error:
              code: not_found
              message: Requested resource was not found.

````