> ## 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 User Analytics

> Understand how a specific user engages with your AI across all their conversations. Track their satisfaction, identify pain points, and spot opportunities to improve their experience.

**⚠️ Requires Growth+ plan or higher**

**Two modes available:**

- **simple mode**: Get aggregate metrics like average sentiment, frustration levels, and conversation quality. Perfect for user dashboards. No rate limiting.
- **insights mode** (default): Access detailed patterns, recurring topics, and AI-generated recommendations specific to this user. Rate limited based on your plan's `maxAnalysesPerHour`.

Returns 404 if the user doesn't exist or has no conversations yet.



## OpenAPI

````yaml https://www.greenflash.ai/api/openapi get /users/{userId}/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:
  /users/{userId}/analytics:
    get:
      tags:
        - Analytics
        - Users
      summary: Get User Analytics
      description: >-
        Understand how a specific user engages with your AI across all their
        conversations. Track their satisfaction, identify pain points, and spot
        opportunities to improve their experience.


        **⚠️ Requires Growth+ plan or higher**


        **Two modes available:**


        - **simple mode**: Get aggregate metrics like average sentiment,
        frustration levels, and conversation quality. Perfect for user
        dashboards. No rate limiting.

        - **insights mode** (default): Access detailed patterns, recurring
        topics, and AI-generated recommendations specific to this user. Rate
        limited based on your plan's `maxAnalysesPerHour`.


        Returns 404 if the user doesn't exist or has no conversations yet.
      parameters:
        - schema:
            type: string
            format: uuid
            description: The user ID to get analytics for
          required: true
          description: The user ID to get analytics for
          name: userId
          in: path
        - schema:
            type: string
            enum:
              - simple
              - insights
            default: insights
            description: >-
              Analysis mode: "simple" returns only numeric aggregates (no rate
              limiting), "insights" includes topics, keywords, and
              recommendations (rate limited per tenant plan).
          required: false
          description: >-
            Analysis mode: "simple" returns only numeric aggregates (no rate
            limiting), "insights" includes topics, keywords, and recommendations
            (rate limited per tenant plan).
          name: mode
          in: query
        - schema:
            type: string
            format: uuid
            description: Filter analytics by product ID.
          required: false
          description: Filter analytics by product ID.
          name: productId
          in: query
        - schema:
            type: string
            format: uuid
            description: Filter analytics by version ID.
          required: false
          description: Filter analytics by version ID.
          name: versionId
          in: query
      responses:
        '200':
          description: User analytics retrieved
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetUserAnalysisResponse'
              example:
                averageUserSentiment:
                  label: neutral
                  score: 0.05
                averageChangeInUserSentiment:
                  label: improving
                  score: 0.12
                averageFrustration:
                  label: moderate
                  score: 0.38
                averageStruggle:
                  label: low
                  score: 0.2
                averageCommercialIntent:
                  label: low
                  score: 0.15
                averageConversationRating: 4.2
                averageConversationQualityIndex: 6.8
                topics:
                  - name: billing
                    count: 15
                  - name: account access
                    count: 12
                  - name: feature questions
                    count: 8
                keywords:
                  - name: refund
                    count: 9
                  - name: login
                    count: 7
                summary:
                  profileSummary: >-
                    Engaged user who frequently asks about billing and account
                    access.
                  behavioralPatterns:
                    - pattern: Returns to ask follow-up questions within 24 hours
                      evidence: >-
                        Across 12 conversations, started a new thread the day
                        after resolving the prior one.
                      frequency: recurring
                  engagement:
                    level: regular
                    trajectory: stable
                    description: >-
                      Consistent weekly usage with steady conversation volume
                      over the last 30 days.
                  signals:
                    - type: insight
                      title: Billing questions dominate
                      description: >-
                        Roughly a third of conversations involve billing,
                        suggesting unclear pricing surfaces.
                      priority: medium
                  productAlignment:
                    summary: >-
                      Uses core support flows but rarely engages with self-serve
                      documentation.
                    strengths:
                      - Quick to adopt new chat features
                    gaps:
                      - Does not discover the in-app billing FAQ
                  methodology: Generated from 47 conversations spanning the last 90 days.
                totalConversations: 47
        '404':
          description: User not found or no conversations
          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 user analytics operations.
              example:
                success: false
                error: User not found or has no conversations
        '429':
          description: Rate limit exceeded (insights mode)
          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 user analytics operations.
              example:
                success: false
                error: >-
                  Rate limit exceeded for analytics requests. Please try again
                  later.
      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 getUserAnalyticsResponse = await
            client.users.getUserAnalytics(
              '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
            );


            console.log(getUserAnalyticsResponse.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_user_analytics_response = client.users.get_user_analytics(
                user_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            )
            print(get_user_analytics_response.average_change_in_user_sentiment)
components:
  schemas:
    GetUserAnalysisResponse:
      allOf:
        - $ref: '#/components/schemas/UserAnalyses'
        - type: object
          properties:
            summary:
              type:
                - object
                - 'null'
              properties:
                profileSummary:
                  type: string
                  description: Executive summary of the participant.
                behavioralPatterns:
                  type: array
                  items:
                    type: object
                    properties:
                      pattern:
                        type: string
                        description: What the participant consistently does.
                      evidence:
                        type: string
                        description: Specific examples from conversations.
                      frequency:
                        type: string
                        enum:
                          - recurring
                          - occasional
                          - rare
                        description: How often this pattern appears.
                    required:
                      - pattern
                      - evidence
                      - frequency
                  description: Behavioral patterns observed across conversations.
                engagement:
                  type: object
                  properties:
                    level:
                      type: string
                      enum:
                        - power_user
                        - regular
                        - casual
                        - at_risk
                        - churning
                      description: Engagement level classification.
                    trajectory:
                      type: string
                      enum:
                        - growing
                        - stable
                        - declining
                      description: Engagement trend direction.
                    description:
                      type: string
                      description: Explanation of the engagement assessment.
                  required:
                    - level
                    - trajectory
                    - description
                  description: Engagement profile.
                signals:
                  type: array
                  items:
                    type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - opportunity
                          - risk
                          - insight
                        description: Signal category.
                      title:
                        type: string
                        description: Short headline.
                      description:
                        type: string
                        description: Evidence-based description.
                      priority:
                        type: string
                        enum:
                          - high
                          - medium
                          - low
                        description: Signal priority.
                    required:
                      - type
                      - title
                      - description
                      - priority
                  description: Key signals the product owner should know about.
                productAlignment:
                  type:
                    - object
                    - 'null'
                  properties:
                    summary:
                      type: string
                      description: How the participant relates to product goals.
                    strengths:
                      type: array
                      items:
                        type: string
                      description: What's working well for this participant.
                    gaps:
                      type: array
                      items:
                        type: string
                      description: Where the product isn't serving them.
                  required:
                    - summary
                    - strengths
                    - gaps
                  description: >-
                    Product-specific observations (when business context is
                    available).
                methodology:
                  type: string
                  description: Transparency about what data drove the analysis.
              required:
                - profileSummary
                - behavioralPatterns
                - engagement
                - signals
                - productAlignment
                - methodology
              description: Structured participant profile summary.
            totalConversations:
              type: number
              description: Total number of conversations analyzed.
          required:
            - summary
            - totalConversations
    UserAnalyses:
      type: object
      properties:
        averageUserSentiment:
          type: object
          properties:
            label:
              type: string
            score:
              type: number
          required:
            - label
            - score
          description: Average sentiment across all conversations.
        averageChangeInUserSentiment:
          type: object
          properties:
            label:
              type: string
            score:
              type: number
          required:
            - label
            - score
          description: Distribution of sentiment changes.
        averageFrustration:
          type: object
          properties:
            score:
              type: number
            label:
              type: string
          required:
            - score
            - label
          description: Average frustration level.
        averageStruggle:
          type: object
          properties:
            score:
              type: number
            label:
              type: string
          required:
            - score
            - label
          description: Average struggle level.
        averageCommercialIntent:
          type: object
          properties:
            score:
              type: number
            label:
              type: string
          required:
            - score
            - label
          description: Average commercial intent.
        averageConversationRating:
          type:
            - number
            - 'null'
          description: Average conversation rating.
        averageConversationQualityIndex:
          type:
            - number
            - 'null'
          description: Average conversation quality index.
        topics:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              count:
                type: number
            required:
              - name
              - count
          description: Topics discussed (insights mode only).
        keywords:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              count:
                type: number
            required:
              - name
              - count
          description: Keywords extracted (insights mode only).
      required:
        - averageUserSentiment
        - averageChangeInUserSentiment
        - averageFrustration
        - averageStruggle
        - averageCommercialIntent
        - averageConversationRating
        - averageConversationQualityIndex
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````