> ## 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 recent chats via API key

> Get user's most recent chats up to specified limit using API key authentication. Requires CHAT scope.



## OpenAPI

````yaml get /api/chats/recent/{limit}
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/recent/{limit}:
    get:
      tags:
        - chats-api-key
      summary: Get recent chats via API key
      description: >-
        Get user's most recent chats up to specified limit using API key
        authentication. Requires CHAT scope.
      operationId: ChatsApiKeyController_getRecentChats
      parameters:
        - name: limit
          required: true
          in: path
          description: Maximum number of chats to return
          schema:
            type: string
      responses:
        '200':
          description: Recent chats retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Chat'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    Chat:
      type: object
      properties:
        id:
          type: string
          description: Unique chat identifier (UUID)
        userId:
          type: string
          description: User ID who owns this chat
        title:
          type: string
          description: Chat title or subject
        isPublic:
          type: boolean
          description: Whether this chat is publicly accessible
          default: false
        showcased:
          type: boolean
          description: Whether this chat is showcased/featured
          default: false
        summary:
          type: string
          description: Brief summary of the chat conversation
        modelUsed:
          type: string
          description: AI model used in this chat (e.g., claude-3-sonnet)
        systemMessageId:
          type: string
          description: ID of the system message for this chat
        status:
          type: string
          enum:
            - active
            - archived
            - deleted
          default: active
          description: Current status of the chat
        createdAt:
          type: string
          description: Timestamp when chat was created
        updatedAt:
          type: string
          description: Timestamp when chat was last updated
        messageCount:
          type: number
          description: Number of messages in this chat
          minimum: 0
        metadata:
          type: object
          description: Additional metadata for the chat
          additionalProperties: true
      required:
        - id
        - userId
        - title
        - isPublic
        - status
        - createdAt
        - updatedAt
        - messageCount
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Enter your LeanMCP API key

````