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

# Get user chat statistics via API key

> Get chat statistics for the user associated with the API key. Requires CHAT scope.



## OpenAPI

````yaml get /api/chats/stats
openapi: 3.0.0
info:
  title: LeanMCP SDK API
  description: >-
    API endpoints for LeanMCP SDK integration. These endpoints use API key
    authentication and are designed for programmatic access from the CLI and
    SDK.
  version: 1.0.0
servers:
  - url: https://api.leanmcp.com
    description: Production
  - url: http://localhost:3001
    description: Local Development
security: []
tags:
  - name: builds-sdk
  - name: chat-messages-api-key
  - name: chats-api-key
  - name: deployments-api-key
  - name: deployments-sdk
  - name: mapping-sdk
  - name: projects-api-key
paths:
  /api/chats/stats:
    get:
      tags:
        - chats-api-key
      summary: Get user chat statistics via API key
      description: >-
        Get chat statistics for the user associated with the API key. Requires
        CHAT scope.
      operationId: ChatsApiKeyController_getChatStats
      parameters: []
      responses:
        '200':
          description: Chat statistics retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatStats'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    ChatStats:
      type: object
      properties:
        totalChats:
          type: number
          description: Total number of chats
          example: 25
        totalMessages:
          type: number
          description: Total number of messages across all chats
          example: 250
        averageMessagesPerChat:
          type: number
          description: Average messages per chat
          example: 10.5
        modelsUsed:
          type: object
          description: Models used and their frequency
          example:
            claude-3-sonnet: 15
            claude-3-haiku: 10
        mostActiveDay:
          type: string
          description: Date of most active day
          example: '2025-06-15'
        chatsThisWeek:
          type: number
          description: Total chats created this week
          example: 5
        messagesThisWeek:
          type: number
          description: Total messages sent this week
          example: 45
      required:
        - totalChats
        - totalMessages
        - averageMessagesPerChat
        - modelsUsed
        - mostActiveDay
        - chatsThisWeek
        - messagesThisWeek
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Enter your LeanMCP API key

````