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

# Get Patient Analytics

> Get patient analytics data without grouping (flat list with pagination).

Returns paginated list of patients with their analytics data.
Default sort is by most recent appointment date (desc).



## OpenAPI

````yaml get /analytics/dashboards/patient-breakdown/patient-analytics
openapi: 3.1.0
info:
  title: Decoda API
  description: External API documentation for the Decoda Health platform.
  version: '1.0'
servers: []
security: []
paths:
  /analytics/dashboards/patient-breakdown/patient-analytics:
    get:
      tags:
        - provider
        - analytics
        - analytics
      summary: Get Patient Analytics
      description: |-
        Get patient analytics data without grouping (flat list with pagination).

        Returns paginated list of patients with their analytics data.
        Default sort is by most recent appointment date (desc).
      operationId: >-
        get_patient_analytics_analytics_dashboards_patient_breakdown_patient_analytics_get
      parameters:
        - name: TENANT
          in: header
          required: true
          schema:
            type: string
            title: Tenant
          description: The tenant you are making this request on behalf of
        - name: API-KEY
          in: header
          required: true
          schema:
            type: string
            title: Api-Key
          description: Your api key
        - name: timezone
          in: query
          required: false
          schema:
            type: string
            default: UTC
            title: Timezone
        - name: sort_by
          in: query
          required: false
          schema:
            type: string
            default: last_appointment_date
            title: Sort By
        - name: sort_direction
          in: query
          required: false
          schema:
            enum:
              - asc
              - desc
            type: string
            default: desc
            title: Sort Direction
        - name: start_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Start Date
        - name: end_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: End Date
        - name: patient_source
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Patient Source
        - name: location_ids
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Location Ids
        - name: days_since_last_appointment
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            title: Days Since Last Appointment
        - name: patient_name
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Patient Name
        - name: patient_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Patient Id
        - name: last_appointment_service_ids
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Last Appointment Service Ids
        - name: last_appointment_provider_ids
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Last Appointment Provider Ids
        - name: last_visit_days
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Last Visit Days
        - name: visit_span_days
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Visit Span Days
        - name: page
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
            title: Page
        - name: per_page
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            default: 25
            title: Per Page
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page_PatientAnalyticsItem_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Page_PatientAnalyticsItem_:
      properties:
        data:
          items:
            $ref: '#/components/schemas/PatientAnalyticsItem'
          type: array
          title: Data
        total:
          type: integer
          title: Total
      type: object
      required:
        - data
        - total
      title: Page[PatientAnalyticsItem]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    PatientAnalyticsItem:
      properties:
        patient:
          $ref: '#/components/schemas/PatientTiny'
        patientSource:
          anyOf:
            - type: string
            - type: 'null'
          title: Patientsource
          description: Patient source (e.g. WALK_IN, REFERRAL)
        firstAppointmentDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Firstappointmentdate
          description: First appointment date/time
        lastAppointmentDate:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Lastappointmentdate
          description: Last appointment date/time
        lastAppointmentServices:
          items:
            type: string
          type: array
          title: Lastappointmentservices
          description: Services from last appointment
        lastAppointmentProviders:
          items:
            $ref: >-
              #/components/schemas/decoda__apps__api__routes__analytics__dashboards__patient_breakdown__ProviderInfo
          type: array
          title: Lastappointmentproviders
          description: Providers from last appointment
        totalSpent:
          type: integer
          title: Totalspent
          description: Total amount spent in cents
          default: 0
        appointmentCount:
          type: integer
          title: Appointmentcount
          description: Total number of appointments
          default: 0
      type: object
      required:
        - patient
      title: PatientAnalyticsItem
      description: Individual patient analytics item.
    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
    PatientTiny:
      properties:
        id:
          type: string
          title: Id
          description: The unique identifier for the user.
        firstName:
          anyOf:
            - type: string
            - type: 'null'
          title: Firstname
          description: The user's first name.
        lastName:
          anyOf:
            - type: string
            - type: 'null'
          title: Lastname
          description: The user's last name.
        phoneNumber:
          anyOf:
            - type: string
            - type: 'null'
          title: Phonenumber
          description: The user's phone number.
        email:
          anyOf:
            - type: string
            - type: 'null'
          title: Email
          description: The user's email address.
        type:
          $ref: '#/components/schemas/UserType'
          description: The type of user.
          default: PATIENT
        locationId:
          anyOf:
            - type: string
            - type: 'null'
          title: Locationid
          description: The location of the user.
        dateOfBirth:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Dateofbirth
          description: The date of birth of the patient.
        onSchedulingBlacklist:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Onschedulingblacklist
          description: Whether the patient is on the scheduling blacklist.
      type: object
      required:
        - id
      title: PatientTiny
    decoda__apps__api__routes__analytics__dashboards__patient_breakdown__ProviderInfo:
      properties:
        id:
          type: string
          title: Id
        firstName:
          type: string
          title: Firstname
        lastName:
          type: string
          title: Lastname
      type: object
      required:
        - id
        - firstName
        - lastName
      title: ProviderInfo
      description: Provider information.
    UserType:
      type: string
      enum:
        - PROVIDER
        - PATIENT
        - ASSISTANT
      title: UserType

````