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

# Get Metrics

> Get fine grained analytics data from Trata AI like call, duration stats, etc.



## OpenAPI

````yaml openapi.json post /v1/metrics
openapi: 3.1.0
info:
  title: Trata AI API
  description: >-
    Human like conversation to answer calls, drive engagement, automate
    follow-ups & schedule bookings 24/7  with end to end integrations ensuring
    you never miss a sales enquiry.
  version: 1.0.0
servers:
  - url: https://api.trata.ai
    description: Production
  - url: http://localhost:8000
    description: Development
security: []
paths:
  /v1/metrics:
    post:
      tags:
        - Analytics
      summary: Get Metrics
      description: >-
        Get fine grained analytics data from Trata AI like call, duration stats,
        etc.
      operationId: getMetrics_v1_metrics_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchMetricsRequests'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchMetricsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    BatchMetricsRequests:
      properties:
        requests:
          items:
            $ref: '#/components/schemas/MetricsRequest'
          type: array
          title: Requests
      type: object
      required:
        - requests
      title: BatchMetricsRequests
    BatchMetricsResponse:
      properties:
        responses:
          items:
            $ref: '#/components/schemas/MetricsResponse'
          type: array
          title: Responses
      type: object
      required:
        - responses
      title: BatchMetricsResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    MetricsRequest:
      properties:
        id:
          type: string
          maxLength: 512
          minLength: 1
          title: Id
          description: >-
            Unique identifier for the metric request. This can be helped to
            co-relate the request and response
        name:
          allOf:
            - $ref: '#/components/schemas/MetricName'
          description: Name of the metric
        fromDate:
          type: string
          format: date
          title: Fromdate
          description: Start date to get metric request
        toDate:
          type: string
          format: date
          title: Todate
          description: End date until get metric request
        aggregationPeriod:
          allOf:
            - $ref: '#/components/schemas/AggregationPeriod'
          description: Aggregation period for the metric request
        aggregationFormula:
          allOf:
            - $ref: '#/components/schemas/AggregationFormula'
          description: Aggregation formula for the metric request
      type: object
      required:
        - id
        - name
        - fromDate
        - toDate
        - aggregationPeriod
        - aggregationFormula
      title: MetricsRequest
    MetricsResponse:
      properties:
        id:
          type: string
          maxLength: 512
          minLength: 1
          title: Id
          description: >-
            Unique identifier for the metric response. This will help co-relate
            the request and response
        name:
          allOf:
            - $ref: '#/components/schemas/MetricName'
          description: Name of the metric
        datapoints:
          items:
            $ref: '#/components/schemas/MetricResponseDataPoint'
          type: array
          title: Datapoints
          description: List of data points for the metric response
      type: object
      required:
        - id
        - name
        - datapoints
      title: MetricsResponse
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    MetricName:
      type: string
      enum:
        - CALLS
        - CALL_DURATION
        - APPOINTMENT_SCHEDULED
        - PROSPECTS
        - INTERESTED
        - NOT_INTERESTED
      title: MetricName
    AggregationPeriod:
      type: string
      enum:
        - MONTHLY
        - WEEKLY
        - DAILY
      title: AggregationPeriod
    AggregationFormula:
      type: string
      enum:
        - COUNT
        - SUM
        - MEDIAN
      title: AggregationFormula
    MetricResponseDataPoint:
      properties:
        timestamp:
          type: string
          format: date
          title: Timestamp
          description: Timestamp of the data point
        value:
          type: string
          title: Value
          description: >-
            Value which will be a string representation of integer or floating
            number
      type: object
      required:
        - timestamp
        - value
      title: MetricResponseDataPoint
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````