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

# Get ledger analytics

> Retrieve analytical data for a ledger



## OpenAPI

````yaml get /v1/ledgers/{id}/analytics
openapi: 3.0.0
info:
  title: Ledgers API
  version: 1.0.0
  description: API for managing accounting ledgers and entries
servers: []
security:
  - bearerAuth: []
tags:
  - name: Ledgers
    description: Ledger management operations
paths:
  /v1/ledgers/{id}/analytics:
    get:
      tags:
        - Ledger Analytics
      summary: Get ledger analytics
      description: Retrieve analytical data for a ledger
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Ledger UUID
        - name: period
          in: query
          schema:
            type: string
            enum:
              - daily
              - weekly
              - monthly
              - yearly
            default: monthly
          description: Analysis period
        - name: from_date
          in: query
          schema:
            type: string
            format: date-time
          description: Start date for analysis
        - name: to_date
          in: query
          schema:
            type: string
            format: date-time
          description: End date for analysis
      responses:
        '200':
          description: Analytics data retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LedgerAnalytics'
components:
  schemas:
    LedgerAnalytics:
      type: object
      properties:
        ledger_id:
          type: string
          format: uuid
        period:
          type: string
          enum:
            - daily
            - weekly
            - monthly
            - yearly
        metrics:
          type: object
          properties:
            average_balance:
              type: integer
              description: Average balance in cents
            min_balance:
              type: integer
              description: Minimum balance in cents
            max_balance:
              type: integer
              description: Maximum balance in cents
            total_credits:
              type: integer
              description: Total credits in cents
            total_debits:
              type: integer
              description: Total debits in cents
            transaction_count:
              type: integer
              description: Number of transactions
        trends:
          type: array
          items:
            type: object
            properties:
              period_start:
                type: string
                format: date-time
              period_end:
                type: string
                format: date-time
              average_balance:
                type: integer
                description: Period average balance in cents
              credits:
                type: integer
                description: Period total credits in cents
              debits:
                type: integer
                description: Period total debits in cents
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````