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

# Get appointment statistics



## OpenAPI

````yaml get /v1/statistics/appointments
openapi: 3.1.0
info:
  title: Flextell API
  version: 0.0.1
  description: >-
    Flextell REST API referansı. Kimlik doğrulama, scope ve istek kuralları için
    API sekmesindeki rehberlere bakın.
servers:
  - url: https://app.flextell.ai/api
    description: Üretim
security:
  - oauth2: []
  - bearer: []
paths:
  /v1/statistics/appointments:
    get:
      tags:
        - Statistics
      summary: Get appointment statistics
      operationId: statistics.appointments
      parameters:
        - name: period
          in: query
          description: The reporting period. Defaults to `this_month` when omitted.
          schema:
            type:
              - string
              - 'null'
            enum:
              - today
              - yesterday
              - this_week
              - this_month
              - last_month
              - this_year
              - last_7_days
              - last_30_days
              - custom
              - null
        - name: from
          in: query
          description: >-
            Custom period start date (`Y-m-d`, tenant-local, inclusive).
            Required when `period` is `custom`.
          schema:
            type:
              - string
              - 'null'
            format: date
        - name: to
          in: query
          description: >-
            Custom period end date (`Y-m-d`, tenant-local, inclusive). Required
            when `period` is `custom`; must not be before `from`.
          schema:
            type:
              - string
              - 'null'
            format: date
        - name: X-Tenant
          in: header
          required: true
          description: >-
            Tenant identifier. Send the Tenant ID in the `X-Tenant` header to
            scope API requests to a specific tenant.
          schema:
            type: number
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    $ref: '#/components/schemas/StatisticsAppointmentsResource'
                required:
                  - success
                  - data
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
        '428':
          description: >-
            Mandatory setup is incomplete. Finish the setup wizard first;
            `data.next_step` names the step to continue with.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    examples:
                      - false
                  error_code:
                    type: string
                    enum:
                      - SETUP_REQUIRED
                    examples:
                      - SETUP_REQUIRED
                  message:
                    type: string
                    examples:
                      - Complete the required setup steps to continue.
                  data:
                    type: object
                    properties:
                      next_step:
                        type:
                          - string
                          - 'null'
                        examples:
                          - clinic_info
                    required:
                      - next_step
                required:
                  - success
                  - error_code
                  - message
                  - data
components:
  schemas:
    StatisticsAppointmentsResource:
      type: object
      properties:
        period:
          $ref: '#/components/schemas/StatisticsPeriodResource'
        metrics:
          type: object
          properties:
            total_appointments:
              type: string
            completed_appointments:
              type: string
            no_show_rate:
              type: string
            status_distribution:
              type: string
            daily_distribution:
              type: string
            hourly_distribution:
              type: string
          required:
            - total_appointments
            - completed_appointments
            - no_show_rate
            - status_distribution
            - daily_distribution
            - hourly_distribution
        computed_at:
          type: string
      required:
        - period
        - metrics
        - computed_at
      title: StatisticsAppointmentsResource
    StatisticsPeriodResource:
      type: object
      properties:
        period:
          type: string
        from:
          type: string
        to:
          type: string
        timezone:
          type: string
      required:
        - period
        - from
        - to
        - timezone
      title: StatisticsPeriodResource
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://dev.flextell.ai/oauth/authorize
          tokenUrl: https://dev.flextell.ai/oauth/token
          scopes:
            '*': all
    bearer:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.