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

# Edit Generated Message

> Update a generated campaign message

**CLI:**

```bash theme={null}
puffle campaign generate-message update --id <id> --message-id <message-id>
puffle campaign generate-message update --id <id> --message-id <message-id> --subject <subject> --body-text <body-text>
```

## Overview

Edits one generated email draft inside a campaign. The path identifies the campaign, and the body identifies the generated message with `message_id`.

Send `subject`, `body_text`, or both. When the plaintext body changes, Puffle preserves any previously saved custom HTML suffix instead of rebuilding the entire message from scratch.

## AI agent notes

Use this only after the human approves a concrete edit to a draft generated email. Do not use it to regenerate all messages or to send a message.

If the target message is already pending or sent, surface the validation error instead of retrying with the same payload.


## OpenAPI

````yaml patch /api/campaigns/{id}/generate-messages
openapi: 3.0.3
info:
  title: Puffle API
  version: 1.0.0
  description: >-
    HTTP API for the Puffle GTM platform - Feed and Lead Finder search
    preparation, campaign-backed Outbound execution, Puffle Agent runs, sender
    management, and Unibox reply workflows. Designed for operation by both
    humans and autonomous AI agents. Agents should start at the [Agent
    Playbook](/guides/agent-playbook) which prescribes a workspace-context check
    (`GET /api/context`) and core user journeys with exact call ordering.
  contact:
    name: Puffle Support
    url: https://puffle.ai
servers:
  - url: https://app.puffle.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Campaigns
    description: >-
      Campaign-backed Outbound execution. These endpoints manage draft,
      launching, active, paused, and completed Outbound runs with sequence
      nodes, contacts, and sender accounts.
  - name: Accounts
    description: Signed-in user account, settings, and workspace context endpoints.
  - name: Billing
    description: Billing customer portal and account billing endpoints.
  - name: Senders
    description: >-
      Connected sender accounts, email inboxes, sending domains, DNS
      verification, warmup, and sender capacity.
  - name: Socials
    description: >-
      Read connected LinkedIn and X accounts, review current and archived posts,
      and reconcile publication status. Creating, editing, scheduling,
      publishing, OAuth connection, analytics, and mentions remain
      dashboard-managed workflows and are not part of the public Bearer-token
      API.
paths:
  /api/campaigns/{id}/generate-messages:
    patch:
      tags:
        - Campaigns
      summary: Edit Generated Message
      description: >-
        Edit a single draft generated message while preserving any previously
        saved custom HTML suffix when the plaintext body changes.
      operationId: updateCampaignGeneratedMessage
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            description: Campaign UUID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                message_id:
                  type: string
                  minLength: 1
                subject:
                  type: string
                body_text:
                  type: string
              required:
                - message_id
              additionalProperties: false
      responses:
        '200':
          description: Draft generated message updated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: object
                    properties:
                      id:
                        type: string
                        description: String value with endpoint-specific validation.
                      campaign_id:
                        type: string
                        description: String value with endpoint-specific validation.
                      prospect_id:
                        type: string
                        description: String value with endpoint-specific validation.
                      node_id:
                        type: string
                      subject:
                        type: string
                        nullable: true
                      body_text:
                        type: string
                        nullable: true
                      body_html:
                        type: string
                        nullable: true
                      status:
                        type: string
                        enum:
                          - draft
                          - pending
                          - sending
                          - sent
                      manually_edited:
                        type: boolean
                      created_at:
                        type: string
                        format: date-time
                    required:
                      - id
                      - campaign_id
                      - prospect_id
                      - node_id
                      - subject
                      - body_text
                      - status
                      - manually_edited
                      - created_at
                    additionalProperties: false
                required:
                  - message
                additionalProperties: false
        '400':
          description: Validation failure or campaign cannot be modified.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '401':
          description: Missing or invalid authentication.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '404':
          description: Campaign or draft message was not found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '500':
          description: Generated message update failed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: pk_live_...

````