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

# Generate Hooks Route

> Generate alternative ad hooks from one own ad or one tracked group.

Ownership is resolved inside the service from whichever id the
discriminator selected — an ad or group the caller does not own is a 404,
never another brand's hooks.



## OpenAPI

````yaml /openapi.json post /api/v1/brand-intelligence/hooks/generate
openapi: 3.1.0
info:
  title: AITasker
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/brand-intelligence/hooks/generate:
    post:
      tags:
        - Brand Intelligence
        - Brand Intelligence
      summary: Generate Hooks Route
      description: >-
        Generate alternative ad hooks from one own ad or one tracked group.


        Ownership is resolved inside the service from whichever id the

        discriminator selected — an ad or group the caller does not own is a
        404,

        never another brand's hooks.
      operationId: generate_hooks_route_api_v1_brand_intelligence_hooks_generate_post
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/OwnAdHookGenerationRequest'
                - $ref: '#/components/schemas/GroupInsightsHookGenerationRequest'
              title: Payload
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HookGenerationResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    OwnAdHookGenerationRequest:
      properties:
        count:
          type: integer
          maximum: 10
          minimum: 3
          title: Count
          description: How many alternative hooks to generate.
          default: 5
        source:
          type: string
          const: own_ad
          title: Source
        ad_id:
          type: string
          format: uuid
          title: Ad Id
      additionalProperties: false
      type: object
      required:
        - source
        - ad_id
      title: OwnAdHookGenerationRequest
      description: Generate alternatives for one of the caller's OWN ads.
    GroupInsightsHookGenerationRequest:
      properties:
        count:
          type: integer
          maximum: 10
          minimum: 3
          title: Count
          description: How many alternative hooks to generate.
          default: 5
        source:
          type: string
          const: group_insights
          title: Source
        group_id:
          type: string
          format: uuid
          title: Group Id
      additionalProperties: false
      type: object
      required:
        - source
        - group_id
      title: GroupInsightsHookGenerationRequest
      description: Generate alternatives inspired by a tracked group's Top Hooks.
    HookGenerationResponse:
      properties:
        source:
          type: string
          enum:
            - own_ad
            - group_insights
          title: Source
        subject_label:
          anyOf:
            - type: string
            - type: 'null'
          title: Subject Label
        brand_id:
          type: string
          format: uuid
          title: Brand Id
        brand_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Brand Name
        source_hooks:
          items:
            type: string
          type: array
          title: Source Hooks
        hooks:
          items:
            $ref: '#/components/schemas/GeneratedHook'
          type: array
          title: Hooks
        generated_at:
          type: string
          format: date-time
          title: Generated At
      type: object
      required:
        - source
        - brand_id
        - hooks
        - generated_at
      title: HookGenerationResponse
      description: The generated set plus enough provenance to render its header.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    GeneratedHook:
      properties:
        hook:
          type: string
          maxLength: 200
          minLength: 1
          title: Hook
        angle:
          type: string
          maxLength: 280
          minLength: 1
          title: Angle
      type: object
      required:
        - hook
        - angle
      title: GeneratedHook
      description: >-
        One alternative. ``angle`` is the visible "why", never optional.


        Design principle 4 — every generated result carries a visible reason —
        is

        a schema property here rather than a prompt hope: a payload without an

        ``angle`` fails validation before it can reach a caption slot.
    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

````