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

# Update campaign

> Updates a campaign. On an unlaunched draft, a new `senderConfig` passes the same checks as create and plans are checked at launch. Once the campaign has launched, including a scheduled launch that has not started, a new `senderConfig` passes the launch checks and can answer `402 campaigns_not_entitled` or `400 invalid_parameter`. `recipientListId` points the campaign at another audience while it is still an unlaunched draft and replaces its existing recipients; after launch it answers `409`. A sender edit to a draft that launches while the edit is being saved also answers `409`. A changed `scheduledAt` after launch answers `409`; use reschedule to move a scheduled start. A non-null `scheduledAt` must be integer Unix milliseconds from zero through the JavaScript Date maximum. `sendWindow` changes only while the campaign is a draft or paused; a running campaign answers `409`, so pause it first. An edit to a paused campaign also answers `409` while sends are in progress; retry after they settle. A stalled send that has not reached the provider can be recovered on a later edit attempt. If delivery may have started, the edit waits for a definite result rather than sending the recipient again. A new window applies to the remaining recipients when the campaign resumes.

Requires `campaigns:manage`. Project tokens only access resources in their own project.



## OpenAPI

````yaml api-reference/features/campaigns.json PATCH /platform/campaigns/{campaignId}
openapi: 3.0.3
info:
  title: Campaigns API methods
  version: 1.0.0
  description: Task-focused campaigns methods across supported Polymorfa connection types.
servers: []
security: []
paths:
  /platform/campaigns/{campaignId}:
    patch:
      tags:
        - Campaigns
      summary: Update campaign
      description: >-
        Updates a campaign. On an unlaunched draft, a new `senderConfig` passes
        the same checks as create and plans are checked at launch. Once the
        campaign has launched, including a scheduled launch that has not
        started, a new `senderConfig` passes the launch checks and can answer
        `402 campaigns_not_entitled` or `400 invalid_parameter`.
        `recipientListId` points the campaign at another audience while it is
        still an unlaunched draft and replaces its existing recipients; after
        launch it answers `409`. A sender edit to a draft that launches while
        the edit is being saved also answers `409`. A changed `scheduledAt`
        after launch answers `409`; use reschedule to move a scheduled start. A
        non-null `scheduledAt` must be integer Unix milliseconds from zero
        through the JavaScript Date maximum. `sendWindow` changes only while the
        campaign is a draft or paused; a running campaign answers `409`, so
        pause it first. An edit to a paused campaign also answers `409` while
        sends are in progress; retry after they settle. A stalled send that has
        not reached the provider can be recovered on a later edit attempt. If
        delivery may have started, the edit waits for a definite result rather
        than sending the recipient again. A new window applies to the remaining
        recipients when the campaign resumes.


        Requires `campaigns:manage`. Project tokens only access resources in
        their own project.
      operationId: managementUpdateCampaign
      parameters:
        - name: campaignId
          in: path
          required: true
          schema:
            type: string
          description: Identifier for the campaign.
        - name: projectId
          in: query
          required: false
          description: >-
            Project the campaign belongs to. Required with a team API key; a
            project token is bound to its own project and omits it.
          schema:
            type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/management__UpdatePlatformCampaignRequest'
      responses:
        '200':
          description: Success
          headers:
            X-Request-Id:
              schema:
                type: string
              description: Stable request correlation identifier.
            Polymorfa-Version:
              schema:
                type: string
              description: API version applied to this response.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  data:
                    allOf:
                      - $ref: '#/components/schemas/management__PlatformCampaign'
                    description: Structured data carried by this object.
                required:
                  - data
        '400':
          $ref: '#/components/responses/management__BadRequest'
        '401':
          $ref: '#/components/responses/management__Unauthorized'
        '402':
          $ref: '#/components/responses/management__PaymentRequired'
        '403':
          $ref: '#/components/responses/management__Forbidden'
        '404':
          $ref: '#/components/responses/management__NotFound'
        '409':
          $ref: '#/components/responses/management__Conflict'
        '503':
          $ref: '#/components/responses/management__CampaignEligibilityUnavailable'
      security:
        - management__ApiKeyAuth: []
      servers:
        - url: https://api.polymorfa.com
components:
  schemas:
    management__UpdatePlatformCampaignRequest:
      type: object
      additionalProperties: true
      description: Fields to change. Omitted fields keep their stored value.
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 200
          description: |-
            Human-readable name for this resource.

            <!-- polymorfa-input-table -->
            **Value constraints**
            | Constraint | Accepted input |
            | --- | --- |
            | String length | `1` through `200` characters |
        projectId:
          type: string
          format: uuid
          description: >-
            Required when using a team API key. Project tokens derive the
            project from the credential.


            <!-- polymorfa-input-table -->

            **Value constraints**

            | Constraint | Accepted input |

            | --- | --- |

            | Format | `uuid` |
        recipientListId:
          type: string
          format: uuid
          nullable: true
          description: |-
            Audience to send to. Only while the campaign is an unlaunched draft.

            <!-- polymorfa-input-table -->
            **Accepted alternatives**
            | Alternative | Accepted input |
            | --- | --- |
            | Alternative 1 | Type: `string`; Format: `uuid` |
            | Alternative 2 | `null` |

            **Value constraints**
            | Constraint | Accepted input |
            | --- | --- |
            | Format | `uuid` |
        senderConfig:
          type: object
          additionalProperties: true
          description: >-
            Structured sender config values for this management update platform
            campaign request.
        scheduledAt:
          type: integer
          minimum: 0
          maximum: 8640000000000000
          nullable: true
          description: >-
            Scheduled start time in Unix milliseconds. Only while the campaign
            is an unlaunched draft.


            <!-- polymorfa-input-table -->

            **Accepted alternatives**

            | Alternative | Accepted input |

            | --- | --- |

            | Alternative 1 | Type: `integer`; Numeric value: `0` through
            `8640000000000000` (inclusive) |

            | Alternative 2 | `null` |


            **Value constraints**

            | Constraint | Accepted input |

            | --- | --- |

            | Numeric value | `0` through `8640000000000000` (inclusive) |
        sendWindow:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/management__CampaignSendWindowRequest'
          description: >-
            When the campaign may send. `null` removes the window. Only while
            the campaign is a draft or paused.


            <!-- polymorfa-input-table -->

            **Accepted alternatives**

            | Alternative | Accepted input |

            | --- | --- |

            | Alternative 1 | Type: `object`; Required fields: `days`, `hours` |

            | Alternative 2 | `null` |
    management__PlatformCampaign:
      type: object
      additionalProperties: true
      description: >-
        A campaign returned by Platform list, get, create and update.
        `sendWindow` is null when sending is unrestricted by local hours.
      properties:
        id:
          type: string
          format: uuid
          description: |-
            Identifier for this resource.

            <!-- polymorfa-input-table -->
            **Value constraints**
            | Constraint | Accepted input |
            | --- | --- |
            | Format | `uuid` |
        name:
          type: string
          description: Human-readable name for this resource.
        status:
          type: string
          description: Current status of this resource or operation.
        templateId:
          type: string
          format: uuid
          nullable: true
          description: |-
            Identifier of the message template.

            <!-- polymorfa-input-table -->
            **Accepted alternatives**
            | Alternative | Accepted input |
            | --- | --- |
            | Alternative 1 | Type: `string`; Format: `uuid` |
            | Alternative 2 | `null` |

            **Value constraints**
            | Constraint | Accepted input |
            | --- | --- |
            | Format | `uuid` |
        recipientListId:
          type: string
          format: uuid
          nullable: true
          description: |-
            Identifier for the recipient list.

            <!-- polymorfa-input-table -->
            **Accepted alternatives**
            | Alternative | Accepted input |
            | --- | --- |
            | Alternative 1 | Type: `string`; Format: `uuid` |
            | Alternative 2 | `null` |

            **Value constraints**
            | Constraint | Accepted input |
            | --- | --- |
            | Format | `uuid` |
        recipientCount:
          type: integer
          minimum: 0
          description: |-
            Number of recipients.

            <!-- polymorfa-input-table -->
            **Value constraints**
            | Constraint | Accepted input |
            | --- | --- |
            | Numeric value | `0` or greater |
        sentCount:
          type: integer
          minimum: 0
          description: |-
            Number of sents.

            <!-- polymorfa-input-table -->
            **Value constraints**
            | Constraint | Accepted input |
            | --- | --- |
            | Numeric value | `0` or greater |
        deliveredCount:
          type: integer
          minimum: 0
          description: |-
            Number of delivereds.

            <!-- polymorfa-input-table -->
            **Value constraints**
            | Constraint | Accepted input |
            | --- | --- |
            | Numeric value | `0` or greater |
        readCount:
          type: integer
          minimum: 0
          description: |-
            Number of reads.

            <!-- polymorfa-input-table -->
            **Value constraints**
            | Constraint | Accepted input |
            | --- | --- |
            | Numeric value | `0` or greater |
        failedCount:
          type: integer
          minimum: 0
          description: |-
            Number of faileds.

            <!-- polymorfa-input-table -->
            **Value constraints**
            | Constraint | Accepted input |
            | --- | --- |
            | Numeric value | `0` or greater |
        skippedCount:
          type: integer
          minimum: 0
          description: |-
            Number of skippeds.

            <!-- polymorfa-input-table -->
            **Value constraints**
            | Constraint | Accepted input |
            | --- | --- |
            | Numeric value | `0` or greater |
        scheduledAt:
          type: integer
          nullable: true
          description: |-
            Scheduled start in Unix milliseconds.

            <!-- polymorfa-input-table -->
            **Accepted alternatives**
            | Alternative | Accepted input |
            | --- | --- |
            | Alternative 1 | Type: `integer` |
            | Alternative 2 | `null` |
        launchedAt:
          type: integer
          nullable: true
          description: |-
            Launch time in Unix milliseconds.

            <!-- polymorfa-input-table -->
            **Accepted alternatives**
            | Alternative | Accepted input |
            | --- | --- |
            | Alternative 1 | Type: `integer` |
            | Alternative 2 | `null` |
        completedAt:
          type: integer
          nullable: true
          description: |-
            Completion time in Unix milliseconds.

            <!-- polymorfa-input-table -->
            **Accepted alternatives**
            | Alternative | Accepted input |
            | --- | --- |
            | Alternative 1 | Type: `integer` |
            | Alternative 2 | `null` |
        createdAt:
          type: integer
          description: Creation time in Unix milliseconds.
        updatedAt:
          type: integer
          description: Last update in Unix milliseconds.
        sendWindow:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/management__CampaignSendWindow'
          description: >-
            Specifies send window for this management platform campaign.


            <!-- polymorfa-input-table -->

            **Accepted alternatives**

            | Alternative | Accepted input |

            | --- | --- |

            | Alternative 1 | Type: `object`; Required fields: `timeZone`,
            `days`, `hours`, `recipientTimeZone`, `timeZoneVariable` |

            | Alternative 2 | `null` |
        composerBlueprint:
          description: Specifies composer blueprint for this management platform campaign.
        messages:
          description: Specifies messages for this management platform campaign.
        audienceRef:
          description: Specifies audience ref for this management platform campaign.
        senderConfig:
          description: Specifies sender config for this management platform campaign.
        complianceConfig:
          description: Specifies compliance config for this management platform campaign.
        variants:
          description: Specifies variants for this management platform campaign.
        variantStrategy:
          description: Specifies variant strategy for this management platform campaign.
      required:
        - id
        - name
        - status
        - templateId
        - recipientListId
        - recipientCount
        - sentCount
        - deliveredCount
        - readCount
        - failedCount
        - skippedCount
        - scheduledAt
        - launchedAt
        - completedAt
        - createdAt
        - updatedAt
        - sendWindow
    management__CampaignSendWindowRequest:
      type: object
      additionalProperties: false
      description: >-
        When the campaign may send. Recipients outside the window stay `queued`
        and are sent when it next opens.
      properties:
        timeZone:
          type: string
          minLength: 1
          maxLength: 64
          description: >-
            IANA time zone the window is written in, such as
            `America/Sao_Paulo`. When omitted, the team's time zone is stored,
            or `UTC` when the team has none.


            <!-- polymorfa-input-table -->

            **Value constraints**

            | Constraint | Accepted input |

            | --- | --- |

            | String length | `1` through `64` characters |
          example: America/Sao_Paulo
        days:
          type: array
          minItems: 1
          maxItems: 7
          uniqueItems: true
          items:
            type: string
            enum:
              - monday
              - tuesday
              - wednesday
              - thursday
              - friday
              - saturday
              - sunday
          description: |-
            Weekdays the campaign may send on, in the window's time zone.

            <!-- polymorfa-input-table -->
            **Allowed item values**
            | Item value | Meaning |
            | --- | --- |
            | `monday` | Monday. |
            | `tuesday` | Tuesday. |
            | `wednesday` | Wednesday. |
            | `thursday` | Thursday. |
            | `friday` | Friday. |
            | `saturday` | Saturday. |
            | `sunday` | Sunday. |

            **Value constraints**
            | Constraint | Accepted input |
            | --- | --- |
            | Array size | `1` through `7` items |
            | Duplicates | Not accepted; every array item must be unique |
        hours:
          type: array
          minItems: 1
          maxItems: 4
          items:
            $ref: '#/components/schemas/management__CampaignSendWindowRange'
          description: >-
            Local time ranges the campaign may send in on those days. Ranges
            must not overlap. A range cannot cross midnight; use two ranges
            instead.


            <!-- polymorfa-input-table -->

            **Value constraints**

            | Constraint | Accepted input |

            | --- | --- |

            | Array size | `1` through `4` items |
        recipientTimeZone:
          type: boolean
          default: false
          description: >-
            Evaluate the window in each recipient's own time zone. The zone
            comes from the recipient variable named by `timeZoneVariable` when
            it holds a valid IANA zone, otherwise from the phone number's
            country when that country uses one UTC offset, otherwise `timeZone`.
        timeZoneVariable:
          type: string
          pattern: ^[A-Za-z0-9_][A-Za-z0-9_.-]{0,63}$
          default: timeZone
          description: >-
            Recipient variable holding the recipient's IANA time zone, used when
            `recipientTimeZone` is true. Launch rejects more than 5,000 distinct
            nonempty values with `400 invalid_parameter`.


            <!-- polymorfa-input-table -->

            **Value constraints**

            | Constraint | Accepted input |

            | --- | --- |

            | Pattern | `^[A-Za-z0-9_][A-Za-z0-9_.-]{0,63}$` |
      required:
        - days
        - hours
    management__CampaignSendWindow:
      type: object
      additionalProperties: false
      description: >-
        When the campaign may send. Recipients outside the window stay `queued`
        and are sent when it next opens.
      properties:
        timeZone:
          type: string
          description: IANA time zone the window is written in.
        days:
          type: array
          items:
            type: string
            enum:
              - monday
              - tuesday
              - wednesday
              - thursday
              - friday
              - saturday
              - sunday
          description: |-
            Days associated with this management campaign send window.

            <!-- polymorfa-input-table -->
            **Allowed item values**
            | Item value | Meaning |
            | --- | --- |
            | `monday` | Monday. |
            | `tuesday` | Tuesday. |
            | `wednesday` | Wednesday. |
            | `thursday` | Thursday. |
            | `friday` | Friday. |
            | `saturday` | Saturday. |
            | `sunday` | Sunday. |
        hours:
          type: array
          items:
            $ref: '#/components/schemas/management__CampaignSendWindowRange'
          description: Hours associated with this management campaign send window.
        recipientTimeZone:
          type: boolean
          description: Whether recipient time zone.
        timeZoneVariable:
          type: string
          description: >-
            Specifies time zone variable for this management campaign send
            window.
      required:
        - timeZone
        - days
        - hours
        - recipientTimeZone
        - timeZoneVariable
    management__ErrorEnvelope:
      type: object
      required:
        - error
        - data
        - docs
      properties:
        error:
          type: object
          required:
            - type
            - code
            - message
            - param
            - request_id
          properties:
            type:
              type: string
              enum:
                - invalid_request_error
                - authentication_error
                - permission_error
                - conflict_error
                - rate_limit_error
                - api_error
                - upstream_error
              description: |-
                Type discriminator for this object.

                <!-- polymorfa-input-table -->
                **Allowed values**
                | Value | Meaning |
                | --- | --- |
                | `invalid_request_error` | Invalid request error. |
                | `authentication_error` | Authentication error. |
                | `permission_error` | Permission error. |
                | `conflict_error` | Conflict error. |
                | `rate_limit_error` | Rate limit error. |
                | `api_error` | Api error. |
                | `upstream_error` | Upstream error. |
            code:
              type: string
              description: Stable failure code. Use this value for programmatic handling.
            message:
              type: string
              description: Safe explanation of the failure.
            param:
              type: string
              nullable: true
              description: |-
                Invalid request field, or null when no field applies.

                <!-- polymorfa-input-table -->
                **Accepted alternatives**
                | Alternative | Accepted input |
                | --- | --- |
                | Alternative 1 | Type: `string` |
                | Alternative 2 | `null` |
            request_id:
              type: string
              description: >-
                Matches the X-Request-Id response header. Include it when you
                contact support.
            request_log_url:
              type: string
              format: uri
              description: >-
                Console page that shows this request. Returned only to
                organization and project credentials whose request was logged.


                <!-- polymorfa-input-table -->

                **Value constraints**

                | Constraint | Accepted input |

                | --- | --- |

                | Format | `uri` |
          description: Error details returned when the operation fails.
        data:
          type: string
          nullable: true
          enum:
            - null
          description: |-
            Always null for a failed request.

            <!-- polymorfa-input-table -->
            **Allowed values**
            | Value | Meaning |
            | --- | --- |
            | `null` | Null. |

            **Accepted alternatives**
            | Alternative | Accepted input |
            | --- | --- |
            | Alternative 1 | Type: `string` |
            | Alternative 2 | `null` |
        docs:
          type: string
          format: uri
          description: |-
            Documentation link to this failure code.

            <!-- polymorfa-input-table -->
            **Value constraints**
            | Constraint | Accepted input |
            | --- | --- |
            | Format | `uri` |
    management__CampaignSendWindowRange:
      type: object
      additionalProperties: false
      properties:
        start:
          type: string
          pattern: ^([01][0-9]|2[0-3]):[0-5][0-9]$
          description: |-
            Local start time, `HH:MM` in 24-hour time, inclusive.

            <!-- polymorfa-input-table -->
            **Value constraints**
            | Constraint | Accepted input |
            | --- | --- |
            | Pattern | `^([01][0-9]\|2[0-3]):[0-5][0-9]$` |
          example: '09:00'
        end:
          type: string
          pattern: ^(([01][0-9]|2[0-3]):[0-5][0-9]|24:00)$
          description: >-
            Local end time, `HH:MM` in 24-hour time or `24:00`, exclusive. Must
            be later than `start`.


            <!-- polymorfa-input-table -->

            **Value constraints**

            | Constraint | Accepted input |

            | --- | --- |

            | Pattern | `^(([01][0-9]\|2[0-3]):[0-5][0-9]\|24:00)$` |
          example: '18:00'
      required:
        - start
        - end
  responses:
    management__BadRequest:
      description: A path, query, or request-body value did not pass validation.
      headers:
        X-Request-Id:
          schema:
            type: string
          description: Stable request correlation identifier.
        Polymorfa-Version:
          schema:
            type: string
          description: API version applied to this response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/management__ErrorEnvelope'
    management__Unauthorized:
      description: Missing/invalid credential for this audience.
      headers:
        X-Request-Id:
          schema:
            type: string
          description: Stable request correlation identifier.
        Polymorfa-Version:
          schema:
            type: string
          description: API version applied to this response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/management__ErrorEnvelope'
    management__PaymentRequired:
      description: The number's plan does not include this capability.
      headers:
        X-Request-Id:
          schema:
            type: string
          description: Stable request correlation identifier.
        Polymorfa-Version:
          schema:
            type: string
          description: API version applied to this response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/management__ErrorEnvelope'
    management__Forbidden:
      description: Authenticated but lacks the required scope/role/audience.
      headers:
        X-Request-Id:
          schema:
            type: string
          description: Stable request correlation identifier.
        Polymorfa-Version:
          schema:
            type: string
          description: API version applied to this response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/management__ErrorEnvelope'
    management__NotFound:
      description: >-
        The requested resource was not found inside the authenticated team or
        project scope.
      headers:
        X-Request-Id:
          schema:
            type: string
          description: Stable request correlation identifier.
        Polymorfa-Version:
          schema:
            type: string
          description: API version applied to this response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/management__ErrorEnvelope'
    management__Conflict:
      description: The request conflicts with the resource's current state.
      headers:
        X-Request-Id:
          schema:
            type: string
          description: Stable request correlation identifier.
        Polymorfa-Version:
          schema:
            type: string
          description: API version applied to this response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/management__ErrorEnvelope'
    management__CampaignEligibilityUnavailable:
      description: >-
        `service_unavailable`: the selected numbers' plans could not be checked.
        Nothing was launched or saved; retry the request.
      headers:
        X-Request-Id:
          schema:
            type: string
          description: Stable request correlation identifier.
        Polymorfa-Version:
          schema:
            type: string
          description: API version applied to this response.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/management__ErrorEnvelope'
  securitySchemes:
    management__ApiKeyAuth:
      type: http
      scheme: bearer
      description: >-
        Send your team API key or project token as `Authorization: Bearer
        <token>`. The credential must have the required permissions. Project
        tokens can access only their own project.

````

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