# Create Campaign

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/campaigns:
    post:
      summary: Create Campaign
      deprecated: false
      description: ''
      tags:
        - API Reference/Messaging API/Messages/Campaigns
      parameters:
        - name: dry_run
          in: query
          description: When true, the request doesn't persist record on success
          example: ''
          schema:
            type: boolean
        - name: Content-Type
          in: header
          description: '[Details](doc-341635)'
          required: true
          example: application/json
          schema:
            type: string
            default: application/json
            const: application/json
        - name: X-User-Agent
          in: header
          description: Arbitrary identifier of your client. [Details](doc-341635)
          required: true
          example: '{{X_USER_AGENT}}'
          schema:
            type: string
            default: '{{X_USER_AGENT}}'
        - name: X-Product-Name
          in: header
          description: API Product for API context. [Details](doc-341635)
          required: true
          example: '{{PRODUCT_NAME}}'
          schema:
            type: string
            default: '{{PRODUCT_NAME}}'
        - name: X-Loyalty-Club-Slug
          in: header
          description: LoyaltyClub for API context. [Details](doc-342138)
          required: false
          example: '{{LOYALTY_CLUB_SLUG}}'
          schema:
            type: string
            default: '{{LOYALTY_CLUB_SLUG}}'
        - name: Authorization
          in: header
          description: '[Member](doc-342129) or [User](doc-342130) Authorization.'
          required: false
          example: Bearer {{_OAUTH_TOKEN}}
          schema:
            type: string
            default: Bearer {{_OAUTH_TOKEN}}
        - name: X-Client-Authorization
          in: header
          description: '[Token](doc-342128) Authorization.'
          example: '{{API_TOKEN}}'
          schema:
            type: string
            default: '{{API_TOKEN}}'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                campaign: &ref_0
                  $ref: '#/components/schemas/Campaign'
              x-apidog-orders:
                - campaign
              required:
                - campaign
              x-apidog-ignore-properties: []
            examples: {}
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  campaign:
                    type: object
                    x-apidog-refs:
                      01KBFXWH2GRN4HVX8JKJDZ9R34: *ref_0
                    x-apidog-orders:
                      - 01KBFXWH2GRN4HVX8JKJDZ9R34
                    properties:
                      id: &ref_2
                        $ref: '#/components/schemas/id'
                        description: Primary identifier of the record
                        readOnly: true
                      created_at:
                        type: string
                        description: Time at which the record was created
                        format: date-time
                        readOnly: true
                        examples:
                          - '2022-11-15T16:25:58.099512Z'
                      updated_at:
                        type: string
                        description: Time at which the record was updated for the last time
                        format: date-time
                        readOnly: true
                        examples:
                          - '2022-11-15T16:25:58.099512Z'
                      archived_at:
                        type: string
                        description: Time at which the record was archived
                        format: date-time
                        readOnly: true
                        examples:
                          - '2022-11-15T16:25:58.099512Z'
                        nullable: true
                      name:
                        type: string
                        examples:
                          - Christmas 2025
                      starts_at:
                        anyOf:
                          - &ref_1
                            $ref: '#/components/schemas/date'
                          - type: 'null'
                      ends_at:
                        anyOf:
                          - *ref_1
                          - type: 'null'
                      messages_counts_by_status:
                        type: object
                        properties:
                          draft:
                            type: integer
                            readOnly: true
                            minimum: 0
                          scheduled:
                            type: integer
                            readOnly: true
                            minimum: 0
                          finished:
                            type: integer
                            readOnly: true
                            minimum: 0
                        x-apidog-orders:
                          - draft
                          - scheduled
                          - finished
                        readOnly: true
                        description: Counts of Messages grouped by status type
                        required:
                          - draft
                          - scheduled
                          - finished
                        x-apidog-ignore-properties: []
                      messages_counts_by_channel:
                        type: object
                        properties:
                          sms:
                            type: integer
                            readOnly: true
                            minimum: 0
                          email:
                            type: integer
                            readOnly: true
                            minimum: 0
                          push:
                            type: integer
                            readOnly: true
                            minimum: 0
                        x-apidog-orders:
                          - sms
                          - email
                          - push
                        readOnly: true
                        description: Counts of Messages grouped by status type
                        required:
                          - sms
                          - email
                          - push
                        x-apidog-ignore-properties: []
                    required:
                      - id
                      - created_at
                      - updated_at
                      - archived_at
                      - name
                      - starts_at
                      - ends_at
                      - messages_counts_by_status
                    x-apidog-ignore-properties:
                      - id
                      - created_at
                      - updated_at
                      - archived_at
                      - name
                      - starts_at
                      - ends_at
                      - messages_counts_by_status
                      - messages_counts_by_channel
                x-apidog-orders:
                  - campaign
                required:
                  - campaign
                x-apidog-ignore-properties: []
          headers: {}
          x-apidog-name: Success
        '422':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    examples:
                      - Invalid parameters
                    const: Invalid parameters
                  details:
                    type: object
                    properties: {}
                    x-apidog-orders: []
                    description: 'See: [Params Validation](doc-341637)'
                    additionalProperties: true
                    x-apidog-ignore-properties: []
                required:
                  - error
                  - details
                x-apidog-orders:
                  - error
                  - details
                x-apidog-ignore-properties: []
          headers: {}
          x-apidog-name: Invalid Parameters
      security: []
      x-apidog-folder: API Reference/Messaging API/Messages/Campaigns
      x-apidog-status: released
      x-run-in-apidog: https://app.eu.apidog.com/web/project/346351/apis/api-3938568-run
components:
  schemas:
    Campaign:
      type: object
      properties:
        id: *ref_2
        created_at: &ref_4
          type: string
          description: Time at which the record was created
          format: date-time
          readOnly: true
          examples:
            - '2022-11-15T16:25:58.099512Z'
        updated_at: &ref_5
          type: string
          description: Time at which the record was updated for the last time
          format: date-time
          readOnly: true
          examples:
            - '2022-11-15T16:25:58.099512Z'
        archived_at: &ref_3
          type: string
          description: Time at which the record was archived
          format: date-time
          readOnly: true
          examples:
            - '2022-11-15T16:25:58.099512Z'
          nullable: true
        name:
          type: string
          examples:
            - Christmas 2025
        lifecycle_status:
          type: string
          enum:
            - finished
            - ongoing
            - upcoming
          x-apidog-enum:
            - value: finished
              name: ''
              description: ''
            - value: ongoing
              name: ''
              description: ''
            - value: upcoming
              name: ''
              description: ''
        starts_at:
          anyOf:
            - *ref_1
            - type: 'null'
        ends_at:
          anyOf:
            - *ref_1
            - type: 'null'
        messages_counts_by_status:
          type: object
          properties:
            draft:
              type: integer
              readOnly: true
              minimum: 0
            scheduled:
              type: integer
              readOnly: true
              minimum: 0
            finished:
              type: integer
              readOnly: true
              minimum: 0
          x-apidog-orders:
            - draft
            - scheduled
            - finished
          readOnly: true
          description: Counts of Messages grouped by status type
          required:
            - draft
            - scheduled
            - finished
          x-apidog-ignore-properties: []
        messages_counts_by_channel:
          type: object
          properties:
            sms:
              type: integer
              readOnly: true
              minimum: 0
            email:
              type: integer
              readOnly: true
              minimum: 0
            push:
              type: integer
              readOnly: true
              minimum: 0
          x-apidog-orders:
            - sms
            - email
            - push
          readOnly: true
          description: Counts of Messages grouped by status type
          required:
            - sms
            - email
            - push
          x-apidog-ignore-properties: []
      x-apidog-orders:
        - 01K5C8FKDXADNHBW5G1WRKSK6H
        - 01K5RWAG6434HNABZ80D2WWG4R
        - name
        - lifecycle_status
        - starts_at
        - ends_at
        - messages_counts_by_status
        - messages_counts_by_channel
      x-apidog-refs:
        01K5C8FKDXADNHBW5G1WRKSK6H:
          $ref: '#/components/schemas/Base%20record%20attributes'
        01K5RWAG6434HNABZ80D2WWG4R:
          $ref: '#/components/schemas/archived_at'
      required:
        - id
        - created_at
        - updated_at
        - archived_at
        - name
        - lifecycle_status
        - starts_at
        - ends_at
        - messages_counts_by_status
      x-apidog-ignore-properties:
        - id
        - created_at
        - updated_at
        - archived_at
      x-apidog-folder: ''
    date:
      type: string
      format: date
      examples:
        - '2023-01-15'
      x-apidog-folder: ''
    id:
      type: integer
      description: Primary identifier of the record
      format: uint64
      readOnly: true
      examples:
        - 1
      x-apidog-folder: ''
    archived_at:
      type: object
      properties:
        archived_at: *ref_3
      x-apidog-orders:
        - archived_at
      required:
        - archived_at
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    Base record attributes:
      type: object
      properties:
        id: *ref_2
        created_at: *ref_4
        updated_at: *ref_5
      x-apidog-orders:
        - id
        - created_at
        - updated_at
      required:
        - id
        - created_at
        - updated_at
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
  securitySchemes: {}
servers:
  - url: https://api.mpc.dev.placewise.com
    description: Staging
security: []

```