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

# Get Product Analytics

> Get comprehensive analytics for a specific product, including sentiment analysis, quality scores, safety metrics, topics, root causes, and actionable insights.

**Requires Growth+ plan or higher.**

Rate limited based on your plan's `maxAnalysesPerHour`.



## OpenAPI

````yaml https://www.greenflash.ai/api/openapi get /products/{productId}/analytics
openapi: 3.1.0
info:
  title: Greenflash API Reference
  version: 1.0.0
  description: >-
    Greenflash endpoints for capturing interactions, managing prompts, and
    identifying users.
servers:
  - url: https://www.greenflash.ai/api/v1
    description: Greenflash API v1
security: []
tags:
  - name: Interactions
    description: Capture interactions between users and AI
  - name: Business Events
    description: Capture business events
  - name: Analytics
    description: Understand chat and agentic interactions analyses
  - name: Inbox
    description: Review flagged conversations
  - name: Segments
    description: Manage user segments
  - name: Prompts
    description: Manage prompts
  - name: Chat
    description: Stream chat and agentic conversations
  - name: Models
    description: Manage AI models
  - name: Products
    description: Manage products
  - name: Users
    description: Manage users
  - name: Organizations
    description: Manage organizations
paths:
  /products/{productId}/analytics:
    get:
      tags:
        - Analytics
        - Products
      summary: Get Product Analytics
      description: >-
        Get comprehensive analytics for a specific product, including sentiment
        analysis, quality scores, safety metrics, topics, root causes, and
        actionable insights.


        **Requires Growth+ plan or higher.**


        Rate limited based on your plan's `maxAnalysesPerHour`.
      parameters:
        - schema:
            type: string
            format: uuid
            description: The product ID to get analytics for
          required: true
          description: The product ID to get analytics for
          name: productId
          in: path
      responses:
        '200':
          description: Product analytics retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetProductAnalyticsResponse'
              example:
                averageUserSentiment:
                  label: neutral
                  score: 0.12
                averageChangeInUserSentiment:
                  label: slightly negative
                  score: -0.08
                averageFrustration:
                  label: low
                  score: 0.22
                averageStruggle:
                  label: low
                  score: 0.18
                averageCommercialIntent:
                  label: moderate
                  score: 0.45
                productQualityIndex: 7.4
                pillarScores:
                  satisfaction: 0.78
                  growth: 0.62
                  friction: 0.85
                  safety: 0.91
                topics:
                  - name: billing
                    count: 340
                  - name: account access
                    count: 215
                  - name: refund policy
                    count: 178
                topicGroups:
                  - name: Account & Billing
                    count: 555
                  - name: Product Usage
                    count: 312
                keywords:
                  - subscription
                  - refund
                  - password reset
                  - pricing
                  - upgrade
                insights: null
                hallucinationCount:
                  total: 12
                  percentage: 1.2
                jailbreakCount:
                  total: 3
                  percentage: 0.3
                userBiasCount:
                  total: 0
                  percentage: 0
                modelBiasCount:
                  total: 2
                  percentage: 0.2
                userToxicityCount:
                  total: 5
                  percentage: 0.5
                modelToxicityCount:
                  total: 0
                  percentage: 0
                rootCauseMix:
                  - cause: Outdated knowledge base
                    count: 45
                    avgConfidence: 0.82
                    source: root_cause_analysis
                  - cause: Ambiguous user query
                    count: 31
                    avgConfidence: 0.74
                    source: root_cause_analysis
                topFailingTools:
                  - toolName: search_knowledge_base
                    failureCount: 18
                    totalCalls: 520
                    failureRate: 0.035
                dissatisfactionThemes:
                  - topicCanonical: refund_delays
                    topicGroup: Account & Billing
                    count: 28
                    avgFrustration: 0.72
                    avgStruggle: 0.55
                    avgCqi: 3.8
                averageConversationRating: 4.1
                ratingCount: 650
        '403':
          description: Paid plan required
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether the API call was successful (false for errors).
                  error:
                    type: string
                    description: Error message describing what went wrong.
                description: Error response for get product analytics operations.
              example:
                success: false
                error: This endpoint requires a Growth plan or higher
        '404':
          description: Product not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether the API call was successful (false for errors).
                  error:
                    type: string
                    description: Error message describing what went wrong.
                description: Error response for get product analytics operations.
              example:
                success: false
                error: Product not found
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether the API call was successful (false for errors).
                  error:
                    type: string
                    description: Error message describing what went wrong.
                description: Error response for get product analytics operations.
              example:
                success: false
                error: >-
                  Rate limit exceeded for analytics requests. Please try again
                  later.
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether the API call was successful (false for errors).
                  error:
                    type: string
                    description: Error message describing what went wrong.
                description: Error response for get product analytics operations.
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Greenflash from 'greenflash';


            const client = new Greenflash({
              apiKey: process.env['GREENFLASH_API_KEY'], // This is the default and can be omitted
            });


            const getProductAnalyticsResponse = await
            client.products.getProductAnalytics(
              '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
            );


            console.log(getProductAnalyticsResponse.averageChangeInUserSentiment);
        - lang: Python
          source: >-
            import os

            from greenflash import Greenflash


            client = Greenflash(
                api_key=os.environ.get("GREENFLASH_API_KEY"),  # This is the default and can be omitted
            )

            get_product_analytics_response =
            client.products.get_product_analytics(
                "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            )

            print(get_product_analytics_response.average_change_in_user_sentiment)
components:
  schemas:
    GetProductAnalyticsResponse:
      type: object
      properties:
        averageUserSentiment:
          type: object
          properties:
            label:
              type: string
            score:
              type: number
          required:
            - label
            - score
          description: Average user sentiment across conversations.
        averageChangeInUserSentiment:
          type: object
          properties:
            label:
              type: string
            score:
              type: number
          required:
            - label
            - score
          description: Average change in user sentiment during conversations.
        averageFrustration:
          type: object
          properties:
            label:
              type: string
            score:
              type: number
          required:
            - label
            - score
          description: Average frustration level detected.
        averageStruggle:
          type: object
          properties:
            label:
              type: string
            score:
              type: number
          required:
            - label
            - score
          description: Average struggle level detected.
        averageCommercialIntent:
          type: object
          properties:
            label:
              type: string
            score:
              type: number
          required:
            - label
            - score
          description: Average commercial intent detected.
        productQualityIndex:
          type:
            - number
            - 'null'
          description: Product Quality Index score.
        pillarScores:
          type:
            - object
            - 'null'
          properties:
            satisfaction:
              type: number
              description: Satisfaction pillar score (0-1).
            growth:
              type: number
              description: Growth pillar score (0-1).
            friction:
              type: number
              description: Friction pillar score (0-1).
            safety:
              type: number
              description: Safety pillar score (0-1).
          required:
            - satisfaction
            - growth
            - friction
            - safety
          description: Quality pillar scores.
        topics:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              count:
                type: number
            required:
              - name
              - count
          description: Top topics discussed.
        topicGroups:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              count:
                type: number
            required:
              - name
              - count
          description: Topic group aggregations.
        keywords:
          type: array
          items:
            type: string
          description: Extracted keywords.
        insights:
          description: AI-generated insights.
        hallucinationCount:
          type: object
          properties:
            total:
              type: number
            percentage:
              type: number
          required:
            - total
            - percentage
          description: Hallucination detection counts.
        jailbreakCount:
          type: object
          properties:
            total:
              type: number
            percentage:
              type: number
          required:
            - total
            - percentage
          description: Jailbreak attempt counts.
        userBiasCount:
          type: object
          properties:
            total:
              type: number
            percentage:
              type: number
          required:
            - total
            - percentage
          description: User bias detection counts.
        modelBiasCount:
          type: object
          properties:
            total:
              type: number
            percentage:
              type: number
          required:
            - total
            - percentage
          description: Model bias detection counts.
        userToxicityCount:
          type: object
          properties:
            total:
              type: number
            percentage:
              type: number
          required:
            - total
            - percentage
          description: User toxicity detection counts.
        modelToxicityCount:
          type: object
          properties:
            total:
              type: number
            percentage:
              type: number
          required:
            - total
            - percentage
          description: Model toxicity detection counts.
        rootCauseMix:
          type: array
          items:
            type: object
            properties:
              cause:
                type: string
              count:
                type: number
              avgConfidence:
                type: number
              source:
                type: string
            required:
              - cause
              - count
              - avgConfidence
              - source
          description: Root cause breakdown.
        topFailingTools:
          type: array
          items:
            type: object
            properties:
              toolName:
                type: string
              failureCount:
                type: number
              totalCalls:
                type: number
              failureRate:
                type: number
            required:
              - toolName
              - failureCount
              - totalCalls
              - failureRate
          description: Top failing tools by failure rate.
        dissatisfactionThemes:
          type: array
          items:
            type: object
            properties:
              topicCanonical:
                type: string
              topicGroup:
                type: string
              count:
                type: number
              avgFrustration:
                type: number
              avgStruggle:
                type: number
              avgCqi:
                type:
                  - number
                  - 'null'
            required:
              - topicCanonical
              - topicGroup
              - count
              - avgFrustration
              - avgStruggle
              - avgCqi
          description: Dissatisfaction themes by topic.
        averageConversationRating:
          type:
            - number
            - 'null'
          description: Average conversation rating.
        ratingCount:
          type: number
          description: Number of conversations with a rating.
      required:
        - averageUserSentiment
        - averageChangeInUserSentiment
        - averageFrustration
        - averageStruggle
        - averageCommercialIntent
        - productQualityIndex
        - pillarScores
        - topics
        - topicGroups
        - keywords
        - hallucinationCount
        - jailbreakCount
        - userBiasCount
        - modelBiasCount
        - userToxicityCount
        - modelToxicityCount
        - rootCauseMix
        - topFailingTools
        - dissatisfactionThemes
        - averageConversationRating
        - ratingCount
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````