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

# Get AI function analytics

> Get AI function/action call analytics including success rates and per-function breakdown



## OpenAPI

````yaml get /api/v2/analytics/ai-functions
openapi: 3.0.1
info:
  title: LiveChatAI API v2
  description: >-
    LiveChatAI API v2 - Build powerful AI-powered customer support experiences.
    This API follows REST principles with predictable, resource-oriented URLs,
    JSON responses, and standard HTTP methods.
  version: 2.0.0
servers:
  - url: https://app.livechatai.com
    description: Production server
security:
  - bearerAuth: []
paths:
  /api/v2/analytics/ai-functions:
    get:
      tags:
        - Analytics
      summary: Get AI function analytics
      description: >-
        Get AI function/action call analytics including success rates and
        per-function breakdown
      parameters:
        - in: query
          name: agentId
          required: true
          schema:
            type: string
            example: clx1234567890abcdef
          description: The ID of the agent/chatbot
        - in: query
          name: startDate
          required: true
          schema:
            type: string
            format: date
            example: '2024-01-01'
          description: Start date for analytics (ISO 8601 format)
        - in: query
          name: endDate
          required: true
          schema:
            type: string
            format: date
            example: '2024-01-31'
          description: End date for analytics (ISO 8601 format)
        - in: query
          name: timezone
          schema:
            type: string
            example: America/New_York
          description: Timezone for date calculations (defaults to system timezone)
      responses:
        '200':
          description: Successfully retrieved AI function analytics data
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  data:
                    type: object
                    properties:
                      currentPeriod:
                        type: object
                        properties:
                          total:
                            type: number
                            example: 245
                            description: Total function calls
                          totalFailed:
                            type: number
                            example: 12
                            description: Total failed function calls
                          functions:
                            type: array
                            items:
                              type: object
                              properties:
                                name:
                                  type: string
                                  example: send_email
                                  description: Function name
                                description:
                                  type: string
                                  example: Send email to user
                                  description: Function description
                                total:
                                  type: number
                                  example: 85
                                  description: Total calls for this function
                                totalFailed:
                                  type: number
                                  example: 3
                                  description: Failed calls for this function
                                type:
                                  type: string
                                  example: CUSTOM
                                  description: Function type
                                mcpName:
                                  type: string
                                  nullable: true
                                  example: null
                                  description: MCP name if applicable
                                mcpProvider:
                                  type: string
                                  nullable: true
                                  example: slack
                                  description: MCP provider name (e.g., shopify)
                            description: Breakdown of function calls per function
                      previousPeriod:
                        type: object
                        description: Previous period data for comparison
                        properties:
                          total:
                            type: number
                            example: 212
                            description: Total function calls in previous period
                          totalFailed:
                            type: number
                            example: 13
                            description: Total failed function calls in previous period
                      changes:
                        type: object
                        description: Percentage changes compared to previous period
                        properties:
                          total:
                            type: number
                            example: 15.5
                            description: Percentage change in total function calls
                          totalFailed:
                            type: number
                            example: -8.2
                            description: >-
                              Percentage change in failed calls (negative means
                              improvement)
        '400':
          description: Bad request - Missing or invalid parameters
        '401':
          description: Unauthorized - Invalid API token
        '403':
          description: Forbidden - API access not available for plan
        '404':
          description: Chatbot not found or access denied
        '500':
          description: Internal server error
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````