> ## Documentation Index
> Fetch the complete documentation index at: https://sure-917046f5-docs-cloudflare-tunnel-self-hosting.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# List chats



## OpenAPI

````yaml /openapi.yaml get /api/v1/chats
openapi: 3.0.3
info:
  title: Sure API
  version: v1
  description: OpenAPI documentation for the Sure API.
servers:
  - url: https://app.sure.am
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
paths:
  /api/v1/chats:
    get:
      tags:
        - Chats
      summary: List chats
      responses:
        '200':
          description: chats listed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCollection'
        '403':
          description: AI features disabled
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - apiKeyAuth: []
components:
  schemas:
    ChatCollection:
      type: object
      required:
        - chats
        - pagination
      properties:
        chats:
          type: array
          items:
            $ref: '#/components/schemas/ChatSummary'
        pagination:
          $ref: '#/components/schemas/Pagination'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        message:
          type: string
          nullable: true
        details:
          oneOf:
            - type: array
              items:
                type: string
            - type: object
          nullable: true
    ChatSummary:
      allOf:
        - $ref: '#/components/schemas/ChatResource'
        - type: object
          required:
            - message_count
          properties:
            message_count:
              type: integer
              minimum: 0
            last_message_at:
              type: string
              format: date-time
              nullable: true
    Pagination:
      type: object
      required:
        - page
        - per_page
        - total_count
        - total_pages
      properties:
        page:
          type: integer
          minimum: 1
        per_page:
          type: integer
          minimum: 1
        total_count:
          type: integer
          minimum: 0
        total_pages:
          type: integer
          minimum: 0
    ChatResource:
      type: object
      required:
        - id
        - title
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        title:
          type: string
        error:
          type: string
          nullable: true
          description: >
            User-friendly error message describing the most recent failure of
            the

            assistant for this chat, or `null` when no error is present. Errors

            are classified into a small set of presentable messages so clients

            can display them directly without exposing raw provider details:
              * Rate limited — "The AI provider is rate limited right now. Please try again in a few minutes."
              * Temporarily unavailable — "The AI provider is temporarily unavailable right now. Please try again in a few minutes."
              * Misconfigured — "The AI provider is not configured correctly. Please contact your administrator."
              * Default fallback — "Failed to generate a response. Please try again."
            Successful chats always return `null` for this field.
          example: >-
            The AI provider is rate limited right now. Please try again in a few
            minutes.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      name: X-Api-Key
      in: header
      description: API key for authentication. Generate one from your account settings.

````