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

# Get Google Ads Campaigns

> Retrieve Google Ads campaigns, storing in and retrieving from MongoDB.

Args:
    customer_id (int): The Google Ads customer ID to retrieve campaigns for
    start_date (str): Start date for the data range (YYYY-MM-DD). Defaults to 30 days ago.
    end_date (str): End date for the data range (YYYY-MM-DD). Defaults to today.
    force_refresh (bool): Force refresh data from Google Ads API
    include_drafts (bool): Include non-ENABLED campaigns (PAUSED, REMOVED). Defaults to True.
    search: Optional text search filter
    oauth2_token (OAuth2Token): The OAuth2 token for the user
    approved_user (User): The authenticated user

Returns:
    GoogleAdsCampaignsResponseSchema: The retrieved campaigns and their source



## OpenAPI

````yaml https://dev-api.cattix.com/openapi.json get /api/v1/google-ads/campaigns
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/google-ads/campaigns:
    get:
      tags:
        - Google Ads
      summary: Get Google Ads Campaigns
      description: |-
        Retrieve Google Ads campaigns, storing in and retrieving from MongoDB.

        Args:
            customer_id (int): The Google Ads customer ID to retrieve campaigns for
            start_date (str): Start date for the data range (YYYY-MM-DD). Defaults to 30 days ago.
            end_date (str): End date for the data range (YYYY-MM-DD). Defaults to today.
            force_refresh (bool): Force refresh data from Google Ads API
            include_drafts (bool): Include non-ENABLED campaigns (PAUSED, REMOVED). Defaults to True.
            search: Optional text search filter
            oauth2_token (OAuth2Token): The OAuth2 token for the user
            approved_user (User): The authenticated user

        Returns:
            GoogleAdsCampaignsResponseSchema: The retrieved campaigns and their source
      operationId: get_google_ads_campaigns_api_v1_google_ads_campaigns_get
      parameters:
        - name: customer_id
          in: query
          required: true
          schema:
            type: integer
            title: Customer Id
        - name: start_date
          in: query
          required: false
          schema:
            type: string
            title: Start Date
        - name: end_date
          in: query
          required: false
          schema:
            type: string
            title: End Date
        - name: force_refresh
          in: query
          required: false
          schema:
            type: boolean
            default: false
            title: Force Refresh
        - name: include_drafts
          in: query
          required: false
          schema:
            type: boolean
            default: true
            title: Include Drafts
        - name: search
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                minLength: 1
                maxLength: 200
              - type: 'null'
            title: Search
        - 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/GoogleAdsCampaignsResponseSchema'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
components:
  schemas:
    GoogleAdsCampaignsResponseSchema:
      properties:
        campaigns:
          items:
            $ref: >-
              #/components/schemas/api__google_ads__schemas__GoogleAdsCampaignSchema
          type: array
          title: Campaigns
        source:
          $ref: '#/components/schemas/DataSource'
        storage_result:
          anyOf:
            - type: string
            - type: 'null'
          title: Storage Result
      type: object
      required:
        - campaigns
        - source
      title: GoogleAdsCampaignsResponseSchema
      description: The schema for a response of Google Ads campaigns.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    api__google_ads__schemas__GoogleAdsCampaignSchema:
      properties:
        id:
          type: integer
          title: Id
        name:
          type: string
          title: Name
        status:
          type: string
          title: Status
        channel_type:
          type: string
          title: Channel Type
        start_date:
          type: string
          title: Start Date
        end_date:
          type: string
          title: End Date
        budget:
          type: number
          title: Budget
        metrics:
          $ref: '#/components/schemas/GoogleAdsCampaignMetricsSchema'
      type: object
      required:
        - id
        - name
        - status
        - channel_type
        - start_date
        - end_date
        - budget
        - metrics
      title: GoogleAdsCampaignSchema
      description: The schema for a Google Ads campaign.
    DataSource:
      type: string
      enum:
        - google_ads_api
        - mongodb
      title: DataSource
      description: The data sources for the Google Ads API.
    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
    GoogleAdsCampaignMetricsSchema:
      properties:
        impressions:
          type: integer
          title: Impressions
        clicks:
          type: integer
          title: Clicks
        ctr:
          type: number
          title: Ctr
        average_cost_per_conv:
          type: number
          title: Average Cost Per Conv
        cost:
          type: number
          title: Cost
        conversions:
          type: number
          title: Conversions
        conversion_rate:
          type: number
          title: Conversion Rate
        cost_per_conversion:
          type: number
          title: Cost Per Conversion
        impression_share:
          type: number
          title: Impression Share
        abs_top_page_rate:
          type: number
          title: Abs Top Page Rate
      type: object
      required:
        - impressions
        - clicks
        - ctr
        - average_cost_per_conv
        - cost
        - conversions
        - conversion_rate
        - cost_per_conversion
        - impression_share
        - abs_top_page_rate
      title: GoogleAdsCampaignMetricsSchema
      description: The schema for Google Ads campaign metrics.
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: api/v1/users/authorization/token

````