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

# Get business dashboard analytics data

> Returns KPIs, time series data, and churn customer details.

    **KPIs returned:**
    - activeSubsEom: Active subscriptions at end of month
    - newSubs: New subscriptions created
    - canceledSubs: Canceled subscriptions
    - netGrowth: Net growth (new - canceled)
    - churnedCustomers: Customers who completely churned
    - mrrEom: Monthly Recurring Revenue at end of month
    - newCustomers: New customers (first subscription)
    - churnMrr: MRR lost from churned customers
    - mrrGained: MRR gained in the period

    **Supports YoY comparison** when compare=yoy.



## OpenAPI

````yaml /generated/specs/finance.json get /api/v1/analytics/business-dashboard
openapi: 3.0.0
info:
  title: Raul API - Finanzas
  description: >-
    Facturas, boletas, ejecuciones de billing, cuentas por pagar y medios de
    pago.
  version: 2.0.0
  contact: {}
servers:
  - url: https://api.raul.ugps.io
    description: Production
security: []
tags: []
paths:
  /api/v1/analytics/business-dashboard:
    get:
      tags:
        - Analytics - Dashboard
      summary: Get business dashboard analytics data
      description: |-
        Returns KPIs, time series data, and churn customer details.

            **KPIs returned:**
            - activeSubsEom: Active subscriptions at end of month
            - newSubs: New subscriptions created
            - canceledSubs: Canceled subscriptions
            - netGrowth: Net growth (new - canceled)
            - churnedCustomers: Customers who completely churned
            - mrrEom: Monthly Recurring Revenue at end of month
            - newCustomers: New customers (first subscription)
            - churnMrr: MRR lost from churned customers
            - mrrGained: MRR gained in the period

            **Supports YoY comparison** when compare=yoy.
      operationId: BusinessDashboardController_getBusinessDashboard
      parameters:
        - name: start
          required: true
          in: query
          description: Start date (inclusive) in YYYY-MM-DD format
          schema:
            example: '2024-01-01'
            type: string
        - name: end
          required: true
          in: query
          description: End date (exclusive) in YYYY-MM-DD format
          schema:
            example: '2024-12-31'
            type: string
        - name: granularity
          required: false
          in: query
          description: Time granularity
          schema:
            default: month
            type: string
            enum:
              - month
              - quarter
              - year
        - name: compare
          required: false
          in: query
          description: Comparison mode
          schema:
            default: none
            type: string
            enum:
              - none
              - yoy
        - name: timezone
          required: false
          in: query
          description: Timezone for calculations
          schema:
            default: America/Santiago
            type: string
      responses:
        '200':
          description: >-
            El rol sin Finanzas recibe solo actividad agregada, sin importes ni
            tablas de clientes.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/BasicBusinessDashboardResponseDto'
                  - $ref: '#/components/schemas/FinancialBusinessDashboardResponseDto'
        '400':
          description: Invalid date range
      security:
        - bearerAuth: []
components:
  schemas:
    BasicBusinessDashboardResponseDto:
      type: object
      properties:
        financialAccess:
          type: boolean
          enum:
            - false
        meta:
          $ref: '#/components/schemas/DashboardMetaDto'
        kpis:
          $ref: '#/components/schemas/BasicDashboardKpisDto'
        series:
          type: array
          items:
            $ref: '#/components/schemas/BasicDashboardSeriesDto'
        compareSeries:
          type: array
          items:
            $ref: '#/components/schemas/BasicDashboardSeriesDto'
      required:
        - financialAccess
        - meta
        - kpis
        - series
    FinancialBusinessDashboardResponseDto:
      type: object
      properties:
        meta:
          $ref: '#/components/schemas/DashboardMetaDto'
        kpis:
          $ref: '#/components/schemas/KPIsDto'
        series:
          type: array
          items:
            $ref: '#/components/schemas/SeriesDataPointDto'
        compareSeries:
          type: array
          items:
            $ref: '#/components/schemas/SeriesDataPointDto'
        tables:
          $ref: '#/components/schemas/DashboardTablesDto'
        revenueByRubro:
          type: array
          items:
            $ref: '#/components/schemas/RevenueByRubroDto'
        financialAccess:
          type: boolean
          enum:
            - true
      required:
        - meta
        - kpis
        - series
        - tables
        - revenueByRubro
        - financialAccess
    DashboardMetaDto:
      type: object
      properties:
        timezone:
          type: string
        granularity:
          type: string
        period:
          $ref: '#/components/schemas/PeriodInfoDto'
        compare:
          type: string
        comparePeriod:
          $ref: '#/components/schemas/PeriodInfoDto'
      required:
        - timezone
        - granularity
        - period
        - compare
    BasicDashboardKpisDto:
      type: object
      properties:
        activeSubsEom:
          $ref: '#/components/schemas/MetricValueDto'
        newSubs:
          $ref: '#/components/schemas/MetricValueDto'
        canceledSubs:
          $ref: '#/components/schemas/MetricValueDto'
        netGrowth:
          $ref: '#/components/schemas/MetricValueDto'
        churnedCustomers:
          $ref: '#/components/schemas/MetricValueDto'
        newCustomers:
          $ref: '#/components/schemas/MetricValueDto'
      required:
        - activeSubsEom
        - newSubs
        - canceledSubs
        - netGrowth
        - churnedCustomers
        - newCustomers
    BasicDashboardSeriesDto:
      type: object
      properties:
        period:
          type: string
        activeSubsEom:
          type: number
        newSubs:
          type: number
        canceledSubs:
          type: number
        netGrowth:
          type: number
        churnedCustomers:
          type: number
      required:
        - period
        - activeSubsEom
        - newSubs
        - canceledSubs
        - netGrowth
        - churnedCustomers
    KPIsDto:
      type: object
      properties:
        activeSubsEom:
          $ref: '#/components/schemas/MetricValueDto'
        newSubs:
          $ref: '#/components/schemas/MetricValueDto'
        canceledSubs:
          $ref: '#/components/schemas/MetricValueDto'
        netGrowth:
          $ref: '#/components/schemas/MetricValueDto'
        churnedCustomers:
          $ref: '#/components/schemas/MetricValueDto'
        mrrEom:
          $ref: '#/components/schemas/MonetaryMetricValueDto'
        newCustomers:
          $ref: '#/components/schemas/MetricValueDto'
        churnMrr:
          $ref: '#/components/schemas/MonetaryMetricValueDto'
        mrrGained:
          $ref: '#/components/schemas/MonetaryMetricValueDto'
      required:
        - activeSubsEom
        - newSubs
        - canceledSubs
        - netGrowth
        - churnedCustomers
        - mrrEom
        - newCustomers
        - churnMrr
        - mrrGained
    SeriesDataPointDto:
      type: object
      properties:
        period:
          type: string
        activeSubsEom:
          type: number
        newSubs:
          type: number
        canceledSubs:
          type: number
        netGrowth:
          type: number
        churnedCustomers:
          type: number
        mrrEom:
          type: number
          nullable: true
        revenue:
          type: number
        churnMrr:
          type: number
          nullable: true
      required:
        - period
        - activeSubsEom
        - newSubs
        - canceledSubs
        - netGrowth
        - churnedCustomers
        - mrrEom
        - revenue
        - churnMrr
    DashboardTablesDto:
      type: object
      properties:
        churnCustomers:
          type: array
          items:
            $ref: '#/components/schemas/ChurnCustomerRowDto'
        newSubscriptions:
          type: array
          items:
            $ref: '#/components/schemas/NewSubscriptionRowDto'
        canceledSubscriptions:
          type: array
          items:
            $ref: '#/components/schemas/CanceledSubscriptionRowDto'
      required:
        - churnCustomers
        - newSubscriptions
        - canceledSubscriptions
    RevenueByRubroDto:
      type: object
      properties:
        rubro:
          type: string
        total_ingresos:
          type: number
      required:
        - rubro
        - total_ingresos
    PeriodInfoDto:
      type: object
      properties:
        start:
          type: string
        end:
          type: string
      required:
        - start
        - end
    MetricValueDto:
      type: object
      properties:
        value:
          type: number
        delta:
          type: number
        deltaPct:
          type: number
      required:
        - value
    MonetaryMetricValueDto:
      type: object
      properties:
        value:
          type: number
          nullable: true
        delta:
          type: number
        deltaPct:
          type: number
      required:
        - value
    ChurnCustomerRowDto:
      type: object
      properties:
        customerId:
          type: string
        customerName:
          type: string
        month:
          type: string
        subsLost:
          type: number
        mrrLostEst:
          type: number
          nullable: true
      required:
        - customerId
        - customerName
        - month
        - subsLost
        - mrrLostEst
    NewSubscriptionRowDto:
      type: object
      properties:
        subscriptionDetailId:
          type: string
        clientName:
          type: string
        planName:
          type: string
        activationDate:
          type: string
        month:
          type: string
      required:
        - subscriptionDetailId
        - clientName
        - planName
        - activationDate
        - month
    CanceledSubscriptionRowDto:
      type: object
      properties:
        subscriptionDetailId:
          type: string
        clientName:
          type: string
        planName:
          type: string
        cancellationDate:
          type: string
        month:
          type: string
        reason:
          type: object
          nullable: true
      required:
        - subscriptionDetailId
        - clientName
        - planName
        - cancellationDate
        - month
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Token de sesión Better Auth para rutas de backoffice; las rutas de
        portal usan su token propio.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.