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

# Search Global Ad Library

> Search global, source-scoped ad-library rows without brand context.

Keyword mode (``q`` + filters) is the default and is open to anyone. When
``brand_intel_ad_embeddings_enabled`` is on, ``semantic=<text>`` (meaning-based
search) or ``similar_to_ad_id=<uuid>`` ("more like this") switch to the
pgvector + Cohere-rerank path; when the flag is off those params are ignored.

Those two params are plan-gated (``semantic_ad_search``, Starter and above)
via ``_authorized_semantic_params`` — which drops them for anonymous callers
rather than refusing the request. See its docstring for why the three
outcomes differ.



## OpenAPI

````yaml /openapi.json get /api/v1/ad-library/search
openapi: 3.1.0
info:
  title: AITasker
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/ad-library/search:
    get:
      tags:
        - Ad Library
        - Ad Library
      summary: Search Global Ad Library
      description: >-
        Search global, source-scoped ad-library rows without brand context.


        Keyword mode (``q`` + filters) is the default and is open to anyone.
        When

        ``brand_intel_ad_embeddings_enabled`` is on, ``semantic=<text>``
        (meaning-based

        search) or ``similar_to_ad_id=<uuid>`` ("more like this") switch to the

        pgvector + Cohere-rerank path; when the flag is off those params are
        ignored.


        Those two params are plan-gated (``semantic_ad_search``, Starter and
        above)

        via ``_authorized_semantic_params`` — which drops them for anonymous
        callers

        rather than refusing the request. See its docstring for why the three

        outcomes differ.
      operationId: search_global_ad_library_api_v1_ad_library_search_get
      parameters:
        - name: q
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 200
                minLength: 1
              - type: 'null'
            title: Q
        - name: provider
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                minLength: 1
                maxLength: 80
              - type: 'null'
            title: Provider
        - name: platform
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 200
                minLength: 1
              - type: 'null'
            title: Platform
        - name: sort
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 40
                minLength: 1
              - type: 'null'
            title: Sort
        - name: recommendation_industry
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 120
                minLength: 1
              - type: 'null'
            title: Recommendation Industry
        - name: advertiser
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 255
                minLength: 1
              - type: 'null'
            title: Advertiser
        - name: advertiser_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: Advertiser Id
        - name: advertiser_ids
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                minLength: 1
                maxLength: 2400
              - type: 'null'
            title: Advertiser Ids
        - name: advertiser_domain
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 255
                minLength: 1
              - type: 'null'
            title: Advertiser Domain
        - name: landing_domain
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 255
                minLength: 1
              - type: 'null'
            title: Landing Domain
        - name: country
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                minLength: 2
                maxLength: 1000
              - type: 'null'
            title: Country
        - name: language
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                minLength: 2
                maxLength: 1000
              - type: 'null'
            title: Language
        - name: status
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 200
                minLength: 1
              - type: 'null'
            title: Status
        - name: creative_type
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 200
                minLength: 1
              - type: 'null'
            title: Creative Type
        - name: video_length
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 200
                minLength: 1
              - type: 'null'
            title: Video Length
        - name: industry
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 1000
                minLength: 1
              - type: 'null'
            title: Industry
        - name: brand_industry
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 1000
                minLength: 1
              - type: 'null'
            title: Brand Industry
        - name: business_model
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                minLength: 1
                maxLength: 400
              - type: 'null'
            title: Business Model
        - name: theme
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                minLength: 1
                maxLength: 600
              - type: 'null'
            title: Theme
        - name: activity
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 200
                minLength: 1
              - type: 'null'
            title: Activity
        - name: seen_since
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            title: Seen Since
        - name: seen_until
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date-time
              - type: 'null'
            title: Seen Until
        - name: semantic
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                minLength: 1
                maxLength: 400
              - type: 'null'
            title: Semantic
        - name: similar_to_ad_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: Similar To Ad Id
        - name: per_advertiser_limit
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
                maximum: 100
                minimum: 1
              - type: 'null'
            title: Per Advertiser Limit
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            default: 24
            title: Limit
        - name: offset
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
            title: Offset
            default: 0
        - name: cursor
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                minLength: 1
                maxLength: 512
              - type: 'null'
            title: Cursor
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdLibrarySearchResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    AdLibrarySearchResponse:
      properties:
        query:
          anyOf:
            - type: string
            - type: 'null'
          title: Query
        filters:
          additionalProperties:
            type: string
          type: object
          title: Filters
        unsupported_filters:
          additionalProperties:
            type: string
          type: object
          title: Unsupported Filters
        limit:
          type: integer
          title: Limit
        offset:
          type: integer
          title: Offset
        result_cap:
          anyOf:
            - type: integer
            - type: 'null'
          title: Result Cap
        total:
          type: integer
          title: Total
        returned:
          type: integer
          title: Returned
        has_more:
          type: boolean
          title: Has More
        results:
          items:
            $ref: '#/components/schemas/AdLibrarySearchAd'
          type: array
          title: Results
        next_cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Next Cursor
      type: object
      required:
        - limit
        - offset
        - total
        - returned
        - has_more
        - results
      title: AdLibrarySearchResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AdLibrarySearchAd:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        provider:
          type: string
          title: Provider
        platform:
          type: string
          title: Platform
        publisher_platforms:
          items:
            type: string
          type: array
          title: Publisher Platforms
        source_ad_key:
          type: string
          title: Source Ad Key
        source_ad_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Ad Id
        source_ad_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Ad Url
        display_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Url
        click_through_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Click Through Url
        landing_page_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Landing Page Url
        posting_page_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Posting Page Name
        advertiser_logo_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Advertiser Logo Url
        ad_format:
          anyOf:
            - type: string
            - type: 'null'
          title: Ad Format
        partners:
          items:
            $ref: '#/components/schemas/AdLibraryPartnerSummary'
          type: array
          title: Partners
        status:
          type: string
          title: Status
        started_running_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Started Running At
        launched_month:
          anyOf:
            - type: string
            - type: 'null'
          title: Launched Month
        is_top_ad:
          type: boolean
          title: Is Top Ad
          default: false
        top_ad_rank:
          anyOf:
            - type: integer
            - type: 'null'
          title: Top Ad Rank
        low_impression_count:
          type: boolean
          title: Low Impression Count
          default: false
        ad_has_multiple_versions:
          type: boolean
          title: Ad Has Multiple Versions
          default: false
        is_still_in_ad_library:
          type: boolean
          title: Is Still In Ad Library
          default: true
        last_seen_in_ad_library_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Seen In Ad Library At
        last_confirmed_active_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Confirmed Active At
        active_finished_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Active Finished At
        active_duration_days:
          anyOf:
            - type: integer
            - type: 'null'
          title: Active Duration Days
        industry:
          anyOf:
            - type: string
            - type: 'null'
          title: Industry
        first_seen_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: First Seen At
        last_seen_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Seen At
        advertiser:
          anyOf:
            - $ref: '#/components/schemas/AdLibraryAdvertiserSummary'
            - type: 'null'
        source_account:
          anyOf:
            - $ref: '#/components/schemas/AdLibrarySourceAccountSummary'
            - type: 'null'
        creative:
          anyOf:
            - $ref: '#/components/schemas/AdLibraryCreativeSummary'
            - type: 'null'
        creative_count:
          type: integer
          title: Creative Count
          default: 0
        variant_count:
          type: integer
          title: Variant Count
          default: 1
        provenance:
          additionalProperties:
            anyOf:
              - type: string
              - type: 'null'
          type: object
          title: Provenance
      type: object
      required:
        - id
        - provider
        - platform
        - source_ad_key
        - status
      title: AdLibrarySearchAd
    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
    AdLibraryPartnerSummary:
      properties:
        name:
          type: string
          title: Name
        page_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Page Id
        page_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Page Url
        profile_image_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Profile Image Url
      type: object
      required:
        - name
      title: AdLibraryPartnerSummary
    AdLibraryAdvertiserSummary:
      properties:
        id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Id
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        parent_company:
          anyOf:
            - $ref: '#/components/schemas/AdLibraryOrgSummary'
            - type: 'null'
        primary_domain:
          anyOf:
            - type: string
            - type: 'null'
          title: Primary Domain
        website_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Website Url
        website_header_image_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Website Header Image Url
        industry:
          anyOf:
            - type: string
            - type: 'null'
          title: Industry
        brand_classification:
          anyOf:
            - $ref: '#/components/schemas/BrandClassification'
            - type: 'null'
        partners:
          items:
            $ref: '#/components/schemas/AdLibraryPartnerSummary'
          type: array
          title: Partners
      type: object
      title: AdLibraryAdvertiserSummary
    AdLibrarySourceAccountSummary:
      properties:
        id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Id
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        handle:
          anyOf:
            - type: string
            - type: 'null'
          title: Handle
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
        followers:
          anyOf:
            - type: integer
            - type: 'null'
          title: Followers
        logo_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Logo Url
        tagline:
          anyOf:
            - type: string
            - type: 'null'
          title: Tagline
        raw_data:
          additionalProperties: true
          type: object
          title: Raw Data
      type: object
      title: AdLibrarySourceAccountSummary
    AdLibraryCreativeSummary:
      properties:
        id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Id
        headline:
          anyOf:
            - type: string
            - type: 'null'
          title: Headline
        body_text:
          anyOf:
            - type: string
            - type: 'null'
          title: Body Text
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        cta:
          anyOf:
            - type: string
            - type: 'null'
          title: Cta
        creative_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Creative Type
        first_seen_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: First Seen At
        last_seen_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Seen At
        assets:
          items:
            $ref: '#/components/schemas/AdLibraryAssetSummary'
          type: array
          title: Assets
        media_variants:
          items:
            $ref: '#/components/schemas/AdLibraryMediaVariantSummary'
          type: array
          title: Media Variants
        raw_data:
          additionalProperties: true
          type: object
          title: Raw Data
      type: object
      title: AdLibraryCreativeSummary
    AdLibraryOrgSummary:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
      type: object
      required:
        - id
        - name
      title: AdLibraryOrgSummary
      description: A parent company or paying agency, by id + display name.
    BrandClassification:
      properties:
        primary_industry:
          anyOf:
            - type: string
            - type: 'null'
          title: Primary Industry
        industries:
          items:
            type: string
          type: array
          title: Industries
        business_models:
          items:
            type: string
          type: array
          title: Business Models
        version:
          anyOf:
            - type: string
            - type: 'null'
          title: Version
        source:
          anyOf:
            - type: string
            - type: 'null'
          title: Source
        classified_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Classified At
        needs_review:
          type: boolean
          title: Needs Review
          default: false
      type: object
      title: BrandClassification
      description: >-
        A versioned multi-label brand classification.


        Industries describe what the brand sells or does. Business models
        describe

        how it operates independently of industry. Keeping those dimensions

        separate prevents the historical ``E-Commerce`` pseudo-industry from

        replacing the brand's real product industry.
    AdLibraryAssetSummary:
      properties:
        id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Id
        kind:
          type: string
          title: Kind
        url:
          type: string
          title: Url
        url_source:
          type: string
          title: Url Source
          default: source
        content_hash:
          anyOf:
            - type: string
            - type: 'null'
          title: Content Hash
        width:
          anyOf:
            - type: integer
            - type: 'null'
          title: Width
        height:
          anyOf:
            - type: integer
            - type: 'null'
          title: Height
        mime_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Mime Type
        raw_data:
          additionalProperties: true
          type: object
          title: Raw Data
      type: object
      required:
        - kind
        - url
      title: AdLibraryAssetSummary
    AdLibraryMediaVariantSummary:
      properties:
        media_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Media Url
        headline:
          anyOf:
            - type: string
            - type: 'null'
          title: Headline
        body_text:
          anyOf:
            - type: string
            - type: 'null'
          title: Body Text
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        cta:
          anyOf:
            - type: string
            - type: 'null'
          title: Cta
        link_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Link Url
        display_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Url
      type: object
      title: AdLibraryMediaVariantSummary
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````