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

# Compare Ads Endpoint

> Compare ad creative variants and rank them.

Combines rule-based audit scoring with LLM pairwise comparison.
Returns ranked variants with per-dimension breakdowns.



## OpenAPI

````yaml /openapi.json post /api/v1/ads/compare
openapi: 3.1.0
info:
  title: AITasker
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/ads/compare:
    post:
      tags:
        - Ad Comparison
        - Ad Comparison
      summary: Compare Ads Endpoint
      description: |-
        Compare ad creative variants and rank them.

        Combines rule-based audit scoring with LLM pairwise comparison.
        Returns ranked variants with per-dimension breakdowns.
      operationId: compare_ads_endpoint_api_v1_ads_compare_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompareAdsRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompareAdsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    CompareAdsRequest:
      properties:
        variants:
          items:
            $ref: '#/components/schemas/AdVariant'
          type: array
          maxItems: 10
          minItems: 2
          title: Variants
        platform:
          type: string
          title: Platform
          description: Target ad platform (e.g. meta, google, linkedin)
      type: object
      required:
        - variants
        - platform
      title: CompareAdsRequest
    CompareAdsResponse:
      properties:
        rankings:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Rankings
        winner_index:
          type: integer
          title: Winner Index
        rationale:
          type: string
          title: Rationale
        per_variant_scores:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Per Variant Scores
      type: object
      required:
        - rankings
        - winner_index
        - rationale
        - per_variant_scores
      title: CompareAdsResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AdVariant:
      properties:
        headline:
          type: string
          maxLength: 500
          title: Headline
          default: ''
        primary_text:
          anyOf:
            - type: string
              maxLength: 5000
            - type: 'null'
          title: Primary Text
        body:
          anyOf:
            - type: string
              maxLength: 5000
            - type: 'null'
          title: Body
        cta:
          anyOf:
            - type: string
              maxLength: 200
            - type: 'null'
          title: Cta
        description:
          anyOf:
            - type: string
              maxLength: 2000
            - type: 'null'
          title: Description
        image_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Image Url
      type: object
      title: AdVariant
    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

````