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

# Update Campaign

> Update metadata, sender, audiences, a published template version, tracking, or editor content. Only draft campaigns are editable; a sender must use a verified project domain.



## OpenAPI

````yaml api-reference/openapi.json PATCH /campaigns/{id}
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: 1.0.0
servers:
  - url: https://api.sendrealm.com
security:
  - bearerAuth: []
paths:
  /campaigns/{id}:
    patch:
      summary: Update campaign draft
      description: >-
        Update metadata, sender, audiences, a published template version,
        tracking, or editor content. Only draft campaigns are editable; a sender
        must use a verified project domain.
      parameters:
        - $ref: '#/components/parameters/Id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              minProperties: 1
              properties:
                name:
                  type: string
                  maxLength: 120
                subject:
                  type: string
                  maxLength: 998
                from:
                  type: object
                  required:
                    - name
                    - address
                  properties:
                    name:
                      type: string
                    address:
                      type: string
                      format: email
                reply_to_address:
                  type: string
                  format: email
                  nullable: true
                audience_ids:
                  type: array
                  items:
                    type: string
                    format: uuid
                template_version_id:
                  type: string
                  format: uuid
                  nullable: true
                tracking:
                  type: object
                include_unsubscribe_link:
                  type: boolean
                unsubscribe_link_type:
                  type: string
                  enum:
                    - included_audiences
                    - all_audiences
                  nullable: true
                content:
                  type: object
                  additionalProperties:
                    $ref: '#/components/schemas/JsonValue'
      responses:
        '200':
          description: Campaign draft updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CampaignResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
components:
  parameters:
    Id:
      name: id
      in: path
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    JsonValue:
      oneOf:
        - type: string
          nullable: true
        - type: number
        - type: boolean
        - type: object
          additionalProperties:
            $ref: '#/components/schemas/JsonValue'
        - type: array
          items:
            $ref: '#/components/schemas/JsonValue'
    CampaignResponse:
      type: object
      required:
        - status
        - data
      properties:
        status:
          type: integer
          description: HTTP response status code
        data:
          $ref: '#/components/schemas/Campaign'
    Campaign:
      type: object
      required:
        - id
        - name
        - status
        - channel
        - targeting
        - from
        - reply_to_address
        - subject
        - domain_id
        - template_version_id
        - audience_ids
        - audiences
        - tracking
        - include_unsubscribe_link
        - unsubscribe_link_type
        - content
        - readiness
        - is_editable
        - analytics
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        status:
          type: string
        channel:
          type: string
          enum:
            - email
        targeting:
          $ref: '#/components/schemas/JsonObject'
        from:
          type: object
          required:
            - name
            - address
          properties:
            name:
              type: string
            address:
              type: string
              format: email
          nullable: true
        reply_to_address:
          type: string
          format: email
          nullable: true
        subject:
          type: string
          nullable: true
        domain_id:
          type: string
          format: uuid
          nullable: true
        template_version_id:
          type: string
          format: uuid
          nullable: true
        audience_ids:
          type: array
          items:
            type: string
            format: uuid
        audiences:
          type: array
          items:
            type: object
            required:
              - id
              - name
              - subscribed_contacts
            properties:
              id:
                type: string
                format: uuid
              name:
                type: string
              subscribed_contacts:
                type: integer
        tracking:
          type: object
          required:
            - click_tracking
            - open_tracking
          properties:
            click_tracking:
              type: boolean
            open_tracking:
              type: boolean
        include_unsubscribe_link:
          type: boolean
        unsubscribe_link_type:
          type: string
          nullable: true
        content:
          type: object
          nullable: true
          allOf:
            - $ref: '#/components/schemas/JsonValue'
        readiness:
          type: object
          required:
            - ready
            - reasons
          properties:
            ready:
              type: boolean
            reasons:
              type: array
              items:
                type: string
        is_editable:
          type: boolean
        analytics:
          type: object
          required:
            - recipients
            - delivered
            - opened
            - clicked
            - bounced
            - complained
            - unsubscribed
          properties:
            recipients:
              type: integer
            delivered:
              type: integer
            opened:
              type: integer
            clicked:
              type: integer
            bounced:
              type: integer
            complained:
              type: integer
            unsubscribed:
              type: integer
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    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'
    JsonObject:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/JsonValue'
    ValidationIssue:
      type: object
      required:
        - code
        - path
        - message
      properties:
        code:
          type: string
        path:
          type: string
          nullable: true
        message:
          type: string
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Conflict:
      description: Resource conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````