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

# Create campaign from draft

> Create a Google Ads campaign from a saved draft.

Requirements:
- All background tasks must be completed (ad groups, RSAs)
- Draft must pass validation (use /drafts/{draft_id}/validate first)

On success:
- Campaign is created in Google Ads (PAUSED status)
- Draft is marked as published (is_published=True)
- published_campaign_id is set

Returns 409 Conflict if background tasks are still running.
Returns 400 with validation errors if the draft is incomplete.



## OpenAPI

````yaml https://dev-api.cattix.com/openapi.json post /api/v1/campaigns/drafts/{draft_id}/create
openapi: 3.1.0
info:
  title: CATTIX API
  description: CATTIX Backend API
  version: 0.107.0
servers:
  - url: http://localhost:8000
    description: Local
  - url: https://dev-api.cattix.com
    description: Development
  - url: https://staging-api.cattix.com
    description: Staging
  - url: https://api.cattix.com
    description: Production
security: []
paths:
  /api/v1/campaigns/drafts/{draft_id}/create:
    post:
      tags:
        - Campaigns
      summary: Create campaign from draft
      description: |-
        Create a Google Ads campaign from a saved draft.

        Requirements:
        - All background tasks must be completed (ad groups, RSAs)
        - Draft must pass validation (use /drafts/{draft_id}/validate first)

        On success:
        - Campaign is created in Google Ads (PAUSED status)
        - Draft is marked as published (is_published=True)
        - published_campaign_id is set

        Returns 409 Conflict if background tasks are still running.
        Returns 400 with validation errors if the draft is incomplete.
      operationId: >-
        create_campaign_from_draft_endpoint_api_v1_campaigns_drafts__draft_id__create_post
      parameters:
        - name: draft_id
          in: path
          required: true
          schema:
            type: integer
            title: Draft Id
        - name: token_id
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            description: Optional specific Token ID
            title: Token Id
          description: Optional specific Token ID
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateCampaignResponseSchema'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
components:
  schemas:
    CreateCampaignResponseSchema:
      properties:
        success:
          type: boolean
          title: Success
        campaign:
          anyOf:
            - $ref: '#/components/schemas/CreatedCampaignSchema'
            - type: 'null'
        warnings:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Warnings
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
      type: object
      required:
        - success
      title: CreateCampaignResponseSchema
      description: Response schema for campaign creation.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    CreatedCampaignSchema:
      properties:
        id:
          type: integer
          title: Id
          description: Internal database ID
        google_ads_campaign_id:
          type: string
          title: Google Ads Campaign Id
          description: Google Ads campaign resource ID
        resource_name:
          type: string
          title: Resource Name
          description: Full Google Ads resource name
        name:
          type: string
          title: Name
        status:
          type: string
          enum:
            - ENABLED
            - PAUSED
          title: Status
        created_at:
          type: string
          format: date-time
          title: Created At
        ad_groups:
          items:
            $ref: '#/components/schemas/CreatedAdGroupSchema'
          type: array
          title: Ad Groups
        market_analysis_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Market Analysis Id
      type: object
      required:
        - id
        - google_ads_campaign_id
        - resource_name
        - name
        - status
        - created_at
        - ad_groups
      title: CreatedCampaignSchema
      description: Created campaign response.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    CreatedAdGroupSchema:
      properties:
        id:
          type: integer
          title: Id
        google_ads_ad_group_id:
          type: string
          title: Google Ads Ad Group Id
        name:
          type: string
          title: Name
        keywords_count:
          type: integer
          title: Keywords Count
        ads_count:
          type: integer
          title: Ads Count
      type: object
      required:
        - id
        - google_ads_ad_group_id
        - name
        - keywords_count
        - ads_count
      title: CreatedAdGroupSchema
      description: Created ad group response.
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: api/v1/users/authorization/token

````