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

# Create a campaign

> Creates the campaign exactly as the app's New campaign form does. Audiences you pass are attached and start generating targeting right away. Nothing is sent to Google Ads.

Scope: `campaigns:write`.

Send an `Idempotency-Key` header to make retries safe.



## OpenAPI

````yaml /api-reference/openapi.json post /campaigns
openapi: 3.1.0
info:
  title: Fandom API
  version: 1.0.0
  description: >-
    Campaigns, targeting, audiences, data stores, brands and Audience
    Exploration. The same operations are available as MCP tools at /mcp.
servers:
  - url: https://fandom-api-preview.vercel.app/api/v1
  - url: https://www.fandom.ai/api/v1
security:
  - bearerAuth: []
tags:
  - name: Workspace
    description: What's in the workspace.
  - name: Campaigns
    description: Campaigns, as the app's Marketing section shows them.
  - name: Targeting
    description: Keywords, segments, topics and websites for each audience on a campaign.
  - name: Google Ads
    description: Connected accounts, performance, and creating campaigns in Google Ads.
  - name: Audiences
    description: Saved audiences you can attach to campaigns.
  - name: Data stores
    description: >-
      YouTube channels and videos, with their comments, that audiences are built
      from.
  - name: Brands
    description: Brands that campaigns belong to.
  - name: Audience Exploration
    description: >-
      Who an audience is on YouTube: the channels they watch and how they group.
      Invite-only for now.
paths:
  /campaigns:
    post:
      tags:
        - Campaigns
      summary: Create a campaign
      description: >-
        Creates the campaign exactly as the app's New campaign form does.
        Audiences you pass are attached and start generating targeting right
        away. Nothing is sent to Google Ads.


        Scope: `campaigns:write`.


        Send an `Idempotency-Key` header to make retries safe.
      operationId: create_campaign
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          description: >-
            Any unique string. Repeating a request with the same key returns the
            first result instead of doing it twice.
          schema:
            type: string
            maxLength: 200
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 160
                campaignType:
                  type: string
                  enum:
                    - SEARCH
                    - DEMAND_GEN
                    - VIDEO
                    - DISPLAY
                  description: Google Ads campaign type.
                objective:
                  type: string
                  maxLength: 4000
                  description: >-
                    What the campaign should achieve and for whom. Drives
                    targeting.
                brandId:
                  type: string
                  pattern: ^[a-f0-9]{24}$
                  description: >-
                    Fills the brand's name, website and description into the
                    campaign.
                audienceIds:
                  type: array
                  items:
                    type: string
                    pattern: ^[a-f0-9]{24}$
                    description: Audience id.
                  maxItems: 25
                googleAdsCustomerId:
                  type: string
                  pattern: ^\d{3}-?\d{3}-?\d{4}$
                  description: >-
                    A connected Google Ads account to create it in later. See
                    List Google Ads accounts.
                budget:
                  type: number
                  exclusiveMinimum: 0
                  maximum: 10000000
                  description: Daily budget.
                biddingStrategy:
                  type: string
                  enum:
                    - MAXIMIZE_CONVERSIONS
                    - MAXIMIZE_CONVERSION_VALUE
                    - TARGET_CPA
                    - TARGET_ROAS
                    - TARGET_CPC
                    - TARGET_SPEND
                    - MANUAL_CPC
                  description: Google Ads bidding strategy.
                industry:
                  type: string
                  maxLength: 120
                language:
                  type: string
                  maxLength: 20
                  description: Language code. Default `en`.
                locations:
                  type: array
                  items:
                    type: string
                    maxLength: 80
                  maxItems: 20
                  description: Country or region codes, e.g. `["US"]`. Default `["US"]`.
                successMetrics:
                  type: array
                  items:
                    type: string
                    maxLength: 200
                  maxItems: 20
              required:
                - name
                - campaignType
              additionalProperties: false
            example:
              name: Spring launch
              campaignType: DEMAND_GEN
              objective: Reach parents who buy building toys for kids 6–12
              budget: 50
      responses:
        '201':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  name:
                    type: string
                  status:
                    type: string
                    description: '`draft`, `loading` (collecting data), `ready` or `error`.'
                  objective:
                    type: string
                  brandId:
                    type:
                      - string
                      - 'null'
                  brand:
                    type: object
                    properties:
                      name:
                        type: string
                      website:
                        type: string
                      description:
                        type: string
                    required:
                      - name
                      - website
                      - description
                    additionalProperties: false
                  industry:
                    type: string
                  language:
                    type: string
                  locations:
                    type: array
                    items:
                      type: string
                  successMetrics:
                    type: array
                    items:
                      type: string
                  campaignType:
                    type:
                      - string
                      - 'null'
                  budget:
                    type:
                      - number
                      - 'null'
                    description: In the account's currency.
                  budgetType:
                    anyOf:
                      - type: string
                        enum:
                          - daily
                          - total
                      - type: 'null'
                  endDate:
                    type:
                      - string
                      - 'null'
                  biddingStrategy:
                    type:
                      - string
                      - 'null'
                  targetCpa:
                    type:
                      - number
                      - 'null'
                  targetRoas:
                    type:
                      - number
                      - 'null'
                  audiences:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: >-
                            This audience's slot on the campaign. Stable; use it
                            for targeting.
                        name:
                          type: string
                        audienceId:
                          type:
                            - string
                            - 'null'
                          description: >-
                            The saved audience, or null for the campaign's own
                            primary audience.
                        dataStoreIds:
                          type: array
                          items:
                            type: string
                      required:
                        - id
                        - name
                        - audienceId
                        - dataStoreIds
                      additionalProperties: false
                  googleAds:
                    type: object
                    properties:
                      customerId:
                        type:
                          - string
                          - 'null'
                      accountName:
                        type:
                          - string
                          - 'null'
                      campaignId:
                        type:
                          - string
                          - 'null'
                        description: Set once the campaign exists in Google Ads.
                      status:
                        type:
                          - string
                          - 'null'
                    required:
                      - customerId
                      - accountName
                      - campaignId
                      - status
                    additionalProperties: false
                  url:
                    type: string
                    description: Opens the campaign in Fandom.
                  createdAt:
                    type:
                      - string
                      - 'null'
                  updatedAt:
                    type:
                      - string
                      - 'null'
                required:
                  - id
                  - name
                  - status
                  - objective
                  - brandId
                  - brand
                  - industry
                  - language
                  - locations
                  - successMetrics
                  - campaignType
                  - budget
                  - budgetType
                  - endDate
                  - biddingStrategy
                  - targetCpa
                  - targetRoas
                  - audiences
                  - googleAds
                  - url
                  - createdAt
                  - updatedAt
                additionalProperties: false
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  responses:
    BadRequest:
      description: >-
        The request is missing something or has a bad value. The message says
        what.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: No API key, or the key is wrong or revoked.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    PaymentRequired:
      description: The workspace's plan doesn't include this.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: >-
        The key doesn't have the scope, or isn't allowed this campaign or
        account.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Conflict:
      description: >-
        The current state doesn't allow this (for example, it's already done or
        still generating).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: More than 120 requests in a minute. Wait and retry.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Stable, machine-readable.
              examples:
                - not_found
            message:
              type: string
              description: Plain-language explanation.
            requestId:
              type: string
              description: Quote this when asking for help.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: An API key from Settings → API access, starting with `fnd_`.

````

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