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

# Create campaign

> Creates a draft campaign on any plan. `senderConfig.sessionIds` may name numbers that are not yet on a plan that includes Campaigns; launch checks the selection. It is refused with `403 bansafe_org_suspended` while the team is suspended, `400 invalid_parameter` when `senderConfig.sessionIds` is malformed, and `400 campaign_throughput_capped` when a per-number cap is above its safety ceiling.

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



## OpenAPI

````yaml api-reference/features/campaigns.json POST /platform/campaigns
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:
    post:
      tags:
        - Campaigns
      summary: Create campaign
      description: >-
        Creates a draft campaign on any plan. `senderConfig.sessionIds` may name
        numbers that are not yet on a plan that includes Campaigns; launch
        checks the selection. It is refused with `403 bansafe_org_suspended`
        while the team is suspended, `400 invalid_parameter` when
        `senderConfig.sessionIds` is malformed, and `400
        campaign_throughput_capped` when a per-number cap is above its safety
        ceiling.


        Requires `campaigns:manage`. Project tokens only access resources in
        their own project.
      operationId: managementCreatePlatformCampaign
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/management__CreatePlatformCampaignRequest'
      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'
        '403':
          $ref: '#/components/responses/management__Forbidden'
        '404':
          $ref: '#/components/responses/management__NotFound'
      security:
        - management__ApiKeyAuth: []
      servers:
        - url: https://api.polymorfa.com
components:
  schemas:
    management__CreatePlatformCampaignRequest:
      type: object
      additionalProperties: false
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 200
          description: |-
            Campaign name, trimmed before validation. Must not be blank.

            <!-- 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` |
        templateId:
          type: string
          format: uuid
          description: |-
            Identifier of the message template.

            <!-- polymorfa-input-table -->
            **Value constraints**
            | Constraint | Accepted input |
            | --- | --- |
            | Format | `uuid` |
        recipientListId:
          type: string
          format: uuid
          description: >-
            Audience in the same team whose members are copied when the campaign
            launches.


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

            **Value constraints**

            | Constraint | Accepted input |

            | --- | --- |

            | Format | `uuid` |
        senderConfig:
          type: object
          additionalProperties: true
          description: >-
            Structured sender config values for this management create platform
            campaign request.
        scheduledAt:
          type: number
          description: Scheduled start time in Unix milliseconds.
        sendWindow:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/management__CampaignSendWindowRequest'
          description: >-
            Specifies send window for this management create platform campaign
            request.


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

            **Accepted alternatives**

            | Alternative | Accepted input |

            | --- | --- |

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

            | Alternative 2 | `null` |
        recipients:
          type: array
          minItems: 0
          maxItems: 1000
          description: |-
            At most 1,000 recipients per request.

            <!-- polymorfa-input-table -->
            **Value constraints**
            | Constraint | Accepted input |
            | --- | --- |
            | Array size | `0` through `1000` items |
          items:
            $ref: '#/components/schemas/management__RecipientInput'
        recipientCount:
          type: number
          description: >-
            Ignored when inline recipients are provided; their stored count is
            authoritative.
        composerBlueprint:
          description: >-
            Specifies composer blueprint for this management create platform
            campaign request.
        messagesArray:
          description: >-
            Specifies messages array for this management create platform
            campaign request.
        audienceRef:
          description: >-
            Specifies audience ref for this management create platform campaign
            request.
        complianceConfig:
          description: >-
            Specifies compliance config for this management create platform
            campaign request.
        variants:
          description: >-
            Specifies variants for this management create platform campaign
            request.
        variantStrategy:
          description: >-
            Specifies variant strategy for this management create platform
            campaign request.
      required:
        - name
    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__RecipientInput:
      type: object
      additionalProperties: false
      properties:
        phone:
          type: string
          minLength: 1
          maxLength: 64
          description: >-
            Number in international format, for example `+14155550100`. Spaces,
            dots, hyphens and parentheses are ignored; a leading `00` is read as
            `+`; digits without `+` are read as including the country code.


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

            **Value constraints**

            | Constraint | Accepted input |

            | --- | --- |

            | String length | `1` through `64` characters |
        variables:
          type: object
          maxProperties: 50
          additionalProperties:
            oneOf:
              - type: string
                maxLength: 1024
              - type: number
              - type: boolean
          description: >-
            Template variables. Names use letters, digits, `_`, `.` or `-` (at
            most 64 characters). Values are stored as strings.


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

            **Value constraints**

            | Constraint | Accepted input |

            | --- | --- |

            | Object size | At most `50` properties |
      required:
        - phone
    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__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'
  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.