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

# Update a campaign

> Updates a campaign mailing. Only the fields you send are changed. `PUT` is accepted as an equivalent to `PATCH`.

`subject` must stay unique within your account. The unsubscribe footer is reapplied to `html_part` on every save.

**Example curl command:**
```bash
curl -X PATCH \
https://api.paubox.com/v1/marketing/campaign_mailings/123e4567-e89b-12d3-a456-426614174000 \
  -H 'authorization: Token token=YOUR_API_KEY' \
  -H 'content-type: application/json' \
  -d '{
    "campaign_mailing": {
        "subject": "March newsletter (revised)"
    }
  }'
```




## OpenAPI

````yaml openapi2 PATCH /campaign_mailings/{campaign_mailing_id}
openapi: 3.0.3
info:
  title: Paubox Marketing API
  description: >
    Public documentation Paubox Marketing API. 


    All Paubox Marketing customers have access to the Paubox Marketing API to
    automate various tasks.


    ## Authentication

    Use the authorization header in requests with the format: `authorization:
    Token token=<API_KEY>`


    Replace `<API_KEY>` with your API key. Find your API key in the address bar
    from the email builder (note: each API Key is displayed only once upon
    creation).


    ## Base URL

    `https://api.paubox.com/v1/marketing`
  contact:
    name: Paubox Support
    url: https://www.paubox.com
  version: 1.0.0
servers:
  - url: https://api.paubox.com/v1/marketing
    description: Production server
security:
  - TokenAuth: []
tags:
  - name: subscribers
    description: Subscriber management operations
  - name: analytics
    description: Campaign analytics and reporting operations
  - name: campaign_mailings
    description: Campaign mailing management and sending operations
  - name: drip_campaigns
    description: Drip campaign management and automation operations
  - name: subscription_lists
    description: Subscription list management operations
  - name: subscriptions
    description: Subscriber opt-in and opt-out operations
  - name: tracking_links
    description: Tracking link analytics and data operations
paths:
  /campaign_mailings/{campaign_mailing_id}:
    patch:
      tags:
        - campaign_mailings
      summary: Update a campaign mailing
      description: >
        Updates a campaign mailing. Only the fields you send are changed. `PUT`
        is accepted as an equivalent to `PATCH`.


        `subject` must stay unique within your account. The unsubscribe footer
        is reapplied to `html_part` on every save.


        **Example curl command:**

        ```bash

        curl -X PATCH \

        https://api.paubox.com/v1/marketing/campaign_mailings/123e4567-e89b-12d3-a456-426614174000
        \
          -H 'authorization: Token token=YOUR_API_KEY' \
          -H 'content-type: application/json' \
          -d '{
            "campaign_mailing": {
                "subject": "March newsletter (revised)"
            }
          }'
        ```
      operationId: updateCampaignMailing
      parameters:
        - name: campaign_mailing_id
          in: path
          description: UUID of the campaign mailing
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCampaignMailingRequest'
            example:
              campaign_mailing:
                subject: March newsletter (revised)
        required: true
      responses:
        '200':
          description: >-
            The updated campaign mailing's ID. If validation fails the response
            is still `200` but the body contains an `errors` array instead of
            `data`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CampaignMailingWriteResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    UpdateCampaignMailingRequest:
      type: object
      properties:
        campaign_mailing:
          $ref: '#/components/schemas/UpdateCampaignMailingRequest_campaign_mailing'
    CampaignMailingWriteResponse:
      type: object
      description: >-
        Returned with HTTP 200 in both the success and the validation-failure
        case. Check for the presence of `errors`.
      properties:
        data:
          $ref: '#/components/schemas/CampaignMailingWriteResponse_data'
        errors:
          type: array
          description: Validation messages, present only when the write failed
          items:
            type: string
    UpdateCampaignMailingRequest_campaign_mailing:
      type: object
      description: Only the fields supplied are changed.
      properties:
        subject:
          type: string
          description: Subject line. Must remain unique within your account.
        default_subject:
          type: string
          description: Fallback subject used when no subject is set on a send
        from:
          type: string
          description: From address for the mailing
        reply_to:
          type: string
          description: Reply-to address for the mailing
        html_part:
          type: string
          description: HTML body. The unsubscribe footer is reapplied on save.
        text_part:
          type: string
          description: Plain-text body
        form_data:
          type: string
          description: JSON-encoded editor state, for mailings built in an editor
        template_type:
          type: string
          description: >-
            Editor the mailing is authored in, for example `quill`, `bee` or
            `html`
    CampaignMailingWriteResponse_data:
      type: object
      properties:
        id:
          type: string
          description: UUID of the created or updated campaign mailing
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
        code:
          type: string
          description: Error code
        details:
          type: object
          description: Additional error details
  responses:
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    TokenAuth:
      type: apiKey
      description: >-
        Token-based authentication. Use format: "Token token=<API_KEY>" where
        <API_KEY> is your API key
      name: authorization
      in: header

````