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

# Update keyword selection status

> Select or unselect specific keywords from a market analysis.

This endpoint marks the specified keywords as selected (is_selected=True) or
unselected (is_selected=False) based on the action parameter.

Unselected keywords will not be included in forecasts or campaign creation.

Args:
    analysis_id: The ID of the market analysis
    request: Contains keyword_ids (list of IDs) and action ('select' or 'unselect')
    include_keywords: Whether or not to include keywords in selection
    include_unselected_keywords: Whether or not to include keywords that are NOT selected
    user: The authenticated user



## OpenAPI

````yaml https://dev-api.cattix.com/openapi.json post /api/v1/market-analysis/analyses/{analysis_id}/keywords/update-selection
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/market-analysis/analyses/{analysis_id}/keywords/update-selection:
    post:
      tags:
        - Market Analysis
      summary: Update keyword selection status
      description: >-
        Select or unselect specific keywords from a market analysis.


        This endpoint marks the specified keywords as selected
        (is_selected=True) or

        unselected (is_selected=False) based on the action parameter.


        Unselected keywords will not be included in forecasts or campaign
        creation.


        Args:
            analysis_id: The ID of the market analysis
            request: Contains keyword_ids (list of IDs) and action ('select' or 'unselect')
            include_keywords: Whether or not to include keywords in selection
            include_unselected_keywords: Whether or not to include keywords that are NOT selected
            user: The authenticated user
      operationId: >-
        update_keyword_selection_api_v1_market_analysis_analyses__analysis_id__keywords_update_selection_post
      parameters:
        - name: analysis_id
          in: path
          required: true
          schema:
            type: integer
            title: Analysis Id
        - name: include_keywords
          in: query
          required: false
          schema:
            type: boolean
            default: false
            title: Include Keywords
        - name: include_unselected_keywords
          in: query
          required: false
          schema:
            type: boolean
            default: false
            title: Include Unselected Keywords
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateKeywordSelectionRequestSchema'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MarketAnalysisSchema'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2PasswordBearer: []
components:
  schemas:
    UpdateKeywordSelectionRequestSchema:
      properties:
        keyword_ids:
          items:
            type: integer
          type: array
          minItems: 1
          title: Keyword Ids
          description: List of keyword IDs to select or unselect
        action:
          $ref: '#/components/schemas/KeywordSelectionAction'
          description: 'Action to perform: ''select'' or ''unselect'''
      type: object
      required:
        - keyword_ids
        - action
      title: UpdateKeywordSelectionRequestSchema
      description: Request schema for updating keyword selection status.
    MarketAnalysisSchema:
      properties:
        title:
          type: string
          title: Title
          description: Analysis title
        summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Summary
          description: Summary/description of the market analysis
        do_include_assistant_knowledge_item:
          type: boolean
          title: Do Include Assistant Knowledge Item
          description: Whether to include assistant knowledge items for this analysis
          default: false
        config:
          anyOf:
            - $ref: '#/components/schemas/MarketAnalysisConfigSchema'
            - type: 'null'
          description: Analysis configuration (can be empty on Market Analysis creation)
        google_ads_customer_id:
          type: integer
          title: Google Ads Customer Id
          description: Google Ads customer ID
        id:
          type: integer
          title: Id
          description: Analysis ID
        status:
          $ref: '#/components/schemas/MarketAnalysisStatus'
          description: Analysis status (draft, completed, campaign_created)
        created_campaign_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Created Campaign Id
          description: ID of created campaign if any
        date_added:
          type: string
          format: date-time
          title: Date Added
          description: Creation timestamp
        date_updated:
          type: string
          format: date-time
          title: Date Updated
          description: Last update timestamp
        keywords:
          items:
            $ref: '#/components/schemas/MarketAnalysisKeywordSchema'
          type: array
          title: Keywords
          description: Associated keywords
      type: object
      required:
        - title
        - google_ads_customer_id
        - id
        - status
        - date_added
        - date_updated
      title: MarketAnalysisSchema
      description: Schema for a market analysis.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    KeywordSelectionAction:
      type: string
      enum:
        - select
        - unselect
      title: KeywordSelectionAction
      description: The action for updating keyword selection status.
    MarketAnalysisConfigSchema:
      properties:
        services:
          items:
            type: string
          type: array
          title: Services
          description: Service keywords
        location_ids:
          items:
            type: integer
          type: array
          title: Location Ids
          description: Location IDs
        language_id:
          type: integer
          title: Language Id
          description: Language ID
          default: 1000
        website_url:
          anyOf:
            - type: string
              maxLength: 2083
              minLength: 1
              format: uri
            - type: 'null'
          title: Website Url
          description: Website URL for the business
      type: object
      required:
        - services
        - location_ids
      title: MarketAnalysisConfigSchema
      description: Schema for market analysis configuration.
    MarketAnalysisStatus:
      type: string
      enum:
        - draft
        - completed
        - campaign_created
      title: MarketAnalysisStatus
      description: The status of market analysis.
    MarketAnalysisKeywordSchema:
      properties:
        id:
          type: integer
          title: Id
          description: Keyword ID
        keyword_text:
          type: string
          title: Keyword Text
          description: Keyword text
        is_selected:
          type: boolean
          title: Is Selected
          description: Whether keyword is selected for forecast/campaign
        avg_monthly_searches:
          type: integer
          title: Avg Monthly Searches
          description: Average monthly searches
        competition:
          type: string
          title: Competition
          description: Competition name
        competition_index:
          type: integer
          title: Competition Index
          description: Competition index
        low_bid:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Low Bid
          description: Low-bid price
        high_bid:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: High Bid
          description: High-bid price
      type: object
      required:
        - id
        - keyword_text
        - is_selected
        - avg_monthly_searches
        - competition
        - competition_index
        - low_bid
        - high_bid
      title: MarketAnalysisKeywordSchema
      description: Schema for a market analysis keyword with selection status.
    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
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: api/v1/users/authorization/token

````