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

# Compare Analytics Endpoint



## OpenAPI

````yaml /api-reference/openapi/portal.json get /api/v1/merchants/{merchant_id}/analytics/compare
openapi: 3.1.0
info:
  title: Depict Portal API
  version: 1.0.0
  description: >-
    REST API behind the Depict merchant portal: merchants, products,
    collections, curation, metrics, analytics and search insights. All endpoints
    require an Auth0-issued bearer token.
servers:
  - url: ''
security: []
paths:
  /api/v1/merchants/{merchant_id}/analytics/compare:
    get:
      tags:
        - Analytics
      summary: Compare Analytics Endpoint
      operationId: >-
        compare_analytics_endpoint_api_v1_merchants__merchant_id__analytics_compare_get
      parameters:
        - name: merchant_id
          in: path
          required: true
          schema:
            type: string
            title: Merchant Id
        - name: period_type
          in: query
          required: true
          schema:
            type: string
            enum:
              - week
              - month
              - week4
            title: Period Type
        - name: period_a
          in: query
          required: true
          schema:
            type: string
            format: date
            description: ISO date — period A start
            title: Period A
          description: ISO date — period A start
        - name: period_b
          in: query
          required: true
          schema:
            type: string
            format: date
            description: ISO date — period B start
            title: Period B
          description: ISO date — period B start
        - name: collection_ids
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                  format: uuid
                type: array
              - type: 'null'
            title: Collection Ids
        - name: market
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Market
        - name: locale
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Locale
        - name: market_group_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Market Group Id
        - name: X-API-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/MerchantCompareResponse'
                  - type: 'null'
                title: >-
                  Response Compare Analytics Endpoint Api V1 Merchants  Merchant
                  Id  Analytics Compare Get
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - Auth0: []
components:
  schemas:
    MerchantCompareResponse:
      properties:
        period_a:
          $ref: '#/components/schemas/AnalyticsSourceMeta'
        period_b:
          $ref: '#/components/schemas/AnalyticsSourceMeta'
        collections:
          items:
            $ref: '#/components/schemas/CollectionCompareRow'
          type: array
          title: Collections
          default: []
        totals:
          $ref: '#/components/schemas/MerchantCompareTotals'
      type: object
      required:
        - period_a
        - period_b
      title: MerchantCompareResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AnalyticsSourceMeta:
      properties:
        period_type:
          type: string
          enum:
            - week
            - month
            - week4
          title: Period Type
        period_start:
          type: string
          format: date
          title: Period Start
        period_end:
          type: string
          format: date
          title: Period End
        market_group_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Market Group Id
        market:
          anyOf:
            - type: string
            - type: 'null'
          title: Market
        source:
          type: string
          enum:
            - snapshot
            - live
          title: Source
        computed_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Computed At
        pipeline_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Pipeline Version
        note:
          anyOf:
            - type: string
            - type: 'null'
          title: Note
      type: object
      required:
        - period_type
        - period_start
        - period_end
        - source
      title: AnalyticsSourceMeta
    CollectionCompareRow:
      properties:
        collection_id:
          type: string
          format: uuid
          title: Collection Id
        title:
          type: string
          title: Title
        views:
          $ref: '#/components/schemas/MetricAB'
        unique_views:
          $ref: '#/components/schemas/MetricAB'
        clicks:
          $ref: '#/components/schemas/MetricAB'
        ctr:
          $ref: '#/components/schemas/MetricAB'
        add_to_carts:
          $ref: '#/components/schemas/MetricAB'
        units_sold:
          $ref: '#/components/schemas/MetricAB'
        revenue:
          $ref: '#/components/schemas/MetricAB'
        revenue_currency:
          type: string
          title: Revenue Currency
          default: ''
        str_value:
          $ref: '#/components/schemas/MetricAB'
        dead_stock_count:
          $ref: '#/components/schemas/MetricAB'
        inventory_units:
          $ref: '#/components/schemas/MetricAB'
        source_a:
          type: string
          enum:
            - snapshot
            - live
          title: Source A
          default: live
        source_b:
          type: string
          enum:
            - snapshot
            - live
          title: Source B
          default: live
      type: object
      required:
        - collection_id
        - title
      title: CollectionCompareRow
    MerchantCompareTotals:
      properties:
        views:
          $ref: '#/components/schemas/MetricAB'
        unique_views:
          $ref: '#/components/schemas/MetricAB'
        clicks:
          $ref: '#/components/schemas/MetricAB'
        ctr:
          $ref: '#/components/schemas/MetricAB'
        units_sold:
          $ref: '#/components/schemas/MetricAB'
        revenue:
          $ref: '#/components/schemas/MetricAB'
        revenue_currency:
          type: string
          title: Revenue Currency
          default: ''
      type: object
      title: MerchantCompareTotals
    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
    MetricAB:
      properties:
        a:
          anyOf:
            - type: number
            - type: 'null'
          title: A
        b:
          anyOf:
            - type: number
            - type: 'null'
          title: B
        delta_pct:
          anyOf:
            - type: number
            - type: 'null'
          title: Delta Pct
        delta_pts:
          anyOf:
            - type: number
            - type: 'null'
          title: Delta Pts
      type: object
      title: MetricAB
  securitySchemes:
    Auth0:
      type: oauth2
      flows:
        authorizationCode:
          scopes:
            openid: OpenID Connect
            profile: User profile
            email: User email
          authorizationUrl: https://depictai.eu.auth0.com/oauth/authorize
          tokenUrl: https://depictai.eu.auth0.com/oauth/token
      x-tokenName: id_token

````