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

# Google Ads Callback

> Exchange OAuth2 code for tokens.



## OpenAPI

````yaml /openapi.json post /api/v1/workspaces/{workspace_id}/integrations/google-ads/callback
openapi: 3.1.0
info:
  title: AITasker
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/workspaces/{workspace_id}/integrations/google-ads/callback:
    post:
      tags:
        - Integrations
      summary: Google Ads Callback
      description: Exchange OAuth2 code for tokens.
      operationId: >-
        google_ads_callback_api_v1_workspaces__workspace_id__integrations_google_ads_callback_post
      parameters:
        - name: workspace_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Workspace Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IntegrationCallbackRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IntegrationStatusResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    IntegrationCallbackRequest:
      properties:
        code:
          type: string
          title: Code
        state:
          type: string
          title: State
      type: object
      required:
        - code
        - state
      title: IntegrationCallbackRequest
    IntegrationStatusResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        provider:
          type: string
          title: Provider
        account_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Account Id
        account_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Account Name
        status:
          type: string
          title: Status
        scopes:
          items:
            type: string
          type: array
          title: Scopes
        has_oauth_credentials:
          type: boolean
          title: Has Oauth Credentials
          default: false
        last_synced_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Synced At
        token_expires_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Token Expires At
        created_at:
          type: string
          format: date-time
          title: Created At
        meta_pages:
          items:
            $ref: '#/components/schemas/MetaPageRef'
          type: array
          title: Meta Pages
          default: []
        ig_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Ig User Id
      type: object
      required:
        - id
        - provider
        - account_id
        - account_name
        - status
        - scopes
        - last_synced_at
        - token_expires_at
        - created_at
      title: IntegrationStatusResponse
      description: >-
        Integration status — includes has_oauth_credentials so UI knows when

        the user has saved their own Google Cloud OAuth app credentials.


        SECURITY — ``extra_data`` is deliberately NOT a field here. This model
        is

        the ``response_model`` for the workspace/brand integration-status routes

        (``GET /brands/{id}/integrations/status``,

        ``GET /workspaces/{id}/integrations/status``) and for the nested

        ``WorkspaceDetailResponse.integration_credentials`` list. FastAPI's

        ``response_model`` + Pydantic ``from_attributes`` is a strict
        allow-list:

        only the fields declared below are read off the ORM row and serialized,
        so

        ``IntegrationCredential.extra_data`` is dropped before it reaches the

        client. That matters because OAuth providers (e.g. Meta) stash secrets
        in

        ``extra_data`` — ``pages[*].page_access_token`` is written there before

        page selection (``integration_service.py`` ``exchange_meta_code`` /

        ``exchange_meta_code_for_brand``). Adding an ``extra_data`` field to
        this

        model would leak those page tokens to the browser — the exact class of
        bug

        fixed for the TEAM status endpoint in PR #2079. If a future edit UI
        needs

        config from ``extra_data``, expose a NEW field carrying only the

        non-secret keys (mirror ``team_integration_service.CONFIG_PROVIDERS``

        gating) — never the raw dict. Pinned by

        ``tests/contracts/shapes/test_integration_status_response_no_extra_data.py``.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    MetaPageRef:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
      type: object
      required:
        - id
        - name
      title: MetaPageRef
      description: >-
        Non-secret Facebook Page reference for the workspace settings
        page-picker.


        Carries ONLY the page id + display name. NEVER the ``page_access_token``

        that lives alongside these in ``IntegrationCredential.extra_data``.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````