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

# Rewrite a group's targeting

> Writes a fresh list of context hints (`hints`) or negative phrases (`phrases`) for the whole group. Free.



## OpenAPI

````yaml /api/openapi.yaml post /chatgpt-ad-groups/{ad_group_id}/targeting
openapi: 3.1.0
info:
  title: LocalAds API
  version: 1.0.0
  description: Public API for LocalAds customer integrations.
servers:
  - url: https://makelocalads.com/api/v1
security:
  - apiKey: []
paths:
  /chatgpt-ad-groups/{ad_group_id}/targeting:
    parameters:
      - $ref: '#/components/parameters/AdGroupId'
    post:
      summary: Rewrite a group's targeting
      description: >-
        Writes a fresh list of context hints (`hints`) or negative phrases
        (`phrases`) for the whole group. Free.
      operationId: regenerateChatgptAdTargeting
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - scope
              properties:
                scope:
                  type: string
                  enum:
                    - hints
                    - phrases
            example:
              scope: hints
      responses:
        '200':
          description: The group with its new targeting.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatgptAdGroup'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/Unprocessable'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    AdGroupId:
      name: ad_group_id
      in: path
      required: true
      schema:
        type: string
        format: uuid
  schemas:
    ChatgptAdGroup:
      type: object
      required:
        - id
        - product_id
        - name
        - target_url
        - angle
        - price
        - context_hints
        - negative_phrases
        - status
        - credits_charged
        - ads
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        product_id:
          type: string
          format: uuid
        name:
          type:
            - string
            - 'null'
        target_url:
          type:
            - string
            - 'null'
          format: uri
        angle:
          type:
            - string
            - 'null'
        price:
          type:
            - string
            - 'null'
        context_hints:
          type: array
          items:
            type: string
          description: Shared by every ad in the group. Empty until the copy is written.
        negative_phrases:
          type: array
          items:
            type: string
        status:
          type: string
          enum:
            - in_progress
            - completed
            - failed
        credits_charged:
          type: integer
          description: >-
            Net credits charged so far. Refunds for failed renders are
            subtracted.
        ads:
          type: array
          items:
            $ref: '#/components/schemas/ChatgptAd'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    ChatgptAd:
      type: object
      required:
        - id
        - status
        - position
        - title
        - body
        - image_url
        - width
        - height
      properties:
        id:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - queued
            - in_progress
            - completed
            - failed
            - canceled
        position:
          type: integer
        title:
          type:
            - string
            - 'null'
          description: Null until the copy is written.
        body:
          type:
            - string
            - 'null'
        image_url:
          type:
            - string
            - 'null'
          format: uri
        width:
          type:
            - integer
            - 'null'
        height:
          type:
            - integer
            - 'null'
    Problem:
      type: object
      required:
        - type
        - title
        - status
        - detail
        - code
        - request_id
      properties:
        type:
          type: string
          format: uri
        title:
          type: string
        status:
          type: integer
        detail:
          type: string
        code:
          type: string
        request_id:
          type: string
  responses:
    BadRequest:
      description: Invalid request.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    Forbidden:
      description: >-
        The API key lacks the required permission (`insufficient_permission`),
        the organization's plan does not include API access
        (`plan_upgrade_required`; Pro and Enterprise only), or the organization
        is suspended (`org_suspended`).
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    NotFound:
      description: Resource not found.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    Unprocessable:
      description: >-
        A product rule, plan limit, or credit limit blocked the request: not
        enough credits (`insufficient_credits`), an API key's monthly credit
        budget (`key_budget_exceeded`), a request costing more than its
        `max_credits` (`credit_limit_exceeded`), a plan without the feature
        (`plan_required`), or a rule the app enforces too (`request_rejected`,
        with the reason in `detail`).
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    RateLimited:
      description: API key rate limit exceeded.
      headers:
        Retry-After:
          schema:
            type: integer
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: lads_...

````