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

> See how an entire organization (company, team, etc.) engages with your AI across all their users and conversations. Spot trends, measure satisfaction, and identify opportunities to improve the experience for your biggest customers.

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

**Two modes available:**

- **simple mode**: Get organization-wide metrics like average sentiment, frustration levels, commercial intent, and quality scores. Perfect for executive dashboards and health monitoring. No rate limiting.
- **insights mode** (default): Dive into detailed patterns, common topics, and AI-generated recommendations for improving this organization's experience. Rate limited based on your plan's `maxAnalysesPerHour`.

If analytics don't exist yet, they'll be generated in real-time from the organization's conversations (this may take a few seconds). Returns 404 if the organization doesn't exist or has no conversations.



## OpenAPI

````yaml https://www.greenflash.ai/api/openapi get /organizations/{organizationId}/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:
  /organizations/{organizationId}/analytics:
    get:
      tags:
        - Analytics
        - Users
        - Organizations
      summary: Get Organization Analytics
      description: >-
        See how an entire organization (company, team, etc.) engages with your
        AI across all their users and conversations. Spot trends, measure
        satisfaction, and identify opportunities to improve the experience for
        your biggest customers.


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


        **Two modes available:**


        - **simple mode**: Get organization-wide metrics like average sentiment,
        frustration levels, commercial intent, and quality scores. Perfect for
        executive dashboards and health monitoring. No rate limiting.

        - **insights mode** (default): Dive into detailed patterns, common
        topics, and AI-generated recommendations for improving this
        organization's experience. Rate limited based on your plan's
        `maxAnalysesPerHour`.


        If analytics don't exist yet, they'll be generated in real-time from the
        organization's conversations (this may take a few seconds). Returns 404
        if the organization doesn't exist or has no conversations.
      parameters:
        - schema:
            type: string
            format: uuid
            description: The organization ID to get analytics for
          required: true
          description: The organization ID to get analytics for
          name: organizationId
          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: Organization analytics retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetOrganizationAnalysisResponse'
        '404':
          description: Organization not found or no conversations exist
          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 organization analytics operations.
              example:
                success: false
                error: No conversations found for this organization
        '429':
          description: Rate limit exceeded (insights mode only)
          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 organization analytics operations.
              example:
                success: false
                error: >-
                  Rate limit exceeded for analytics insights. Please try again
                  later or use simple mode.
        '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 organization 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 getOrganizationAnalyticsResponse = await
            client.organizations.getOrganizationAnalytics(
              '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
            );


            console.log(getOrganizationAnalyticsResponse.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_organization_analytics_response =
            client.organizations.get_organization_analytics(
                organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            )

            print(get_organization_analytics_response.average_change_in_user_sentiment)
components:
  schemas:
    GetOrganizationAnalysisResponse:
      allOf:
        - $ref: '#/components/schemas/OrganizationAnalyses'
        - type: object
          properties:
            summary:
              type:
                - object
                - 'null'
              properties:
                analysis:
                  type: string
                reason:
                  type: string
              required:
                - analysis
                - reason
              description: Summary of the organization analytics.
            totalConversations:
              type: number
              description: Total number of conversations analyzed.
          required:
            - summary
            - totalConversations
    OrganizationAnalyses:
      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

````