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

# List enrollment series

> Scoped to company_id; the handler does not restrict this read to the session school assignments. The response representation is selected in this order:

| Selection | Response | Date selectors |
| --- | --- | --- |
| view=trend | EnrollmentTrend array | Optional period_from/period_to |
| group_by=period (unless trend) | EnrollmentPeriodAnalytics array | year_from/year_to |
| view=analytics, group_by=month | EnrollmentAnalytics array | period_from/period_to |
| Default: view=basic, group_by=month | EnrollmentMonthly array | period_from/period_to |

Monthly basic/analytics default to 2023-01 through the current month. Period analytics defaults to 2023 through the current year. Trend uses the available calculated periods when bounds are omitted. No pagination is implemented. Each representation returns its row count in X-Total-Count. For view=trend, omit both range bounds or provide both; endpoints must lie within the available horizon. Incomplete, invalid, inverted or out-of-horizon trend ranges fail in the data layer and currently return HTTP 500.



## OpenAPI

````yaml /openapi.yaml get /enrollments
openapi: 3.1.0
info:
  title: Primula Tracker API V3
  version: 3.0.0
  description: >-
    Reference for the 66 operations registered under `/primula/api/v3` in the V3
    release baseline.


    ## Authentication

    Create a session with `POST /sessions`, then send `Authorization: Bearer
    <access_token>` on protected operations. Tokens must remain associated with
    a valid server-side session. The returned refresh token has no refresh
    endpoint in V3. Session company and school restrictions are documented per
    operation; company_id is not inferred from the token.


    ## Responses and errors

    Collections generally return bare JSON arrays and items return bare JSON
    objects. Report objects, nested maps, and update summaries are explicitly
    described below. List metadata travels in response headers rather than an
    envelope. Empty lists written by collection helpers are `[]`; fields backed
    by nullable values may be `null`, and omitted properties are distinguished
    from null properties in schemas. Handlers generally return `{ "error":
    "message" }`; authentication middleware and activity proxy errors use plain
    text. Unsupported methods on a registered path return 405 with Allow after
    any applicable authentication checks.


    ## Pagination and projections

    Only operations documenting page/per_page support pagination. Defaults are
    page=1 and per_page=100. Values exceeding the documented effective cap are
    clamped, not rejected. X-Total-Count describes the full matching set. Link
    contains applicable navigation links and is omitted for a single page.
    Aggregates use limit (default 50, effective cap 200) instead of pagination
    and send X-Truncated only when rows were omitted. The fields parameter,
    where available, selects the exact response properties; unsupported fields
    return 400.


    ## Query encoding

    Multi-value parameters documented as arrays accept repeated keys or
    comma-separated values. Prefer repeated keys for long UUID lists. Except for
    the two activity proxy operations, query parsing drops the entire query
    string above 8192 bytes and truncates each decoded query value to 128 bytes.
    Parameter combinations and interpretation differ by resource and
    representation; consult each operation. Unknown parameters are rejected only
    where explicitly documented.


    ## Dates and writes

    Calendar dates use YYYY-MM-DD, monthly periods use YYYY-MM, and timestamp
    formats are described in the corresponding schema. Defaults such as today
    depend on the server clock. PATCH operations change only the documented
    properties and reject unknown body properties. Clearing values,
    authorization, and partial-write behavior vary by resource and are described
    per operation.


    Examples use synthetic identifiers and placeholder tokens. Replace the
    server host before using an interactive API client.
servers:
  - url: https://{host}/primula/api/v3
    description: V3 API deployment. Replace the placeholder hostname.
    variables:
      host:
        default: api.example.com
security:
  - bearerAuth: []
tags:
  - name: sessions
    description: Sessions.
  - name: schools
    description: Schools.
  - name: companies
    description: Companies.
  - name: rooms
    description: Rooms.
  - name: users
    description: Users.
  - name: gusto_companies
    description: Gusto companies.
  - name: gusto_employees
    description: Gusto employees.
  - name: gusto_contractors
    description: Gusto contractors.
  - name: gusto_payrolls
    description: Gusto payrolls.
  - name: procare_staff
    description: Procare staff.
  - name: efficiency_ratios
    description: Efficiency ratios.
  - name: enrollment_tracker
    description: Enrollment tracker.
  - name: classroom_attendance
    description: Classroom attendance.
  - name: absences
    description: Absences.
  - name: billing_attendance_audits
    description: Billing attendance audits.
  - name: data_refresh
    description: Data refresh.
  - name: waitlist
    description: Waitlist.
  - name: sibling_discounts
    description: Sibling discounts.
  - name: new_start_tracker
    description: New start tracker.
  - name: withdrawal_tracker
    description: Withdrawal tracker.
  - name: transition_tracker
    description: Transition tracker.
  - name: enrollments
    description: Enrollments.
  - name: pre_registration_fallout
    description: Pre registration fallout.
  - name: procare_messages
    description: Procare messages.
  - name: activities_summary
    description: Activities summary.
  - name: activity_details
    description: Activity details.
  - name: leads
    description: Leads.
  - name: students
    description: Students.
  - name: payments
    description: Payments.
  - name: family_balances
    description: Family balances.
  - name: attendances
    description: Attendances.
  - name: billing_plans
    description: Billing plans.
  - name: spaces
    description: Spaces.
paths:
  /enrollments:
    get:
      tags:
        - enrollments
      summary: List enrollment series
      description: >-
        Scoped to company_id; the handler does not restrict this read to the
        session school assignments. The response representation is selected in
        this order:


        | Selection | Response | Date selectors |

        | --- | --- | --- |

        | view=trend | EnrollmentTrend array | Optional period_from/period_to |

        | group_by=period (unless trend) | EnrollmentPeriodAnalytics array |
        year_from/year_to |

        | view=analytics, group_by=month | EnrollmentAnalytics array |
        period_from/period_to |

        | Default: view=basic, group_by=month | EnrollmentMonthly array |
        period_from/period_to |


        Monthly basic/analytics default to 2023-01 through the current month.
        Period analytics defaults to 2023 through the current year. Trend uses
        the available calculated periods when bounds are omitted. No pagination
        is implemented. Each representation returns its row count in
        X-Total-Count. For view=trend, omit both range bounds or provide both;
        endpoints must lie within the available horizon. Incomplete, invalid,
        inverted or out-of-horizon trend ranges fail in the data layer and
        currently return HTTP 500.
      operationId: GetEnrollmentsV3
      parameters:
        - $ref: '#/components/parameters/CompanyId'
        - name: school_id
          in: query
          required: true
          description: School UUID.
          schema:
            type: string
            format: uuid
          example: 22222222-2222-4222-8222-222222222222
        - name: view
          in: query
          required: false
          description: Select the representation.
          schema:
            type: string
            enum:
              - basic
              - analytics
              - trend
            default: basic
        - name: group_by
          in: query
          required: false
          description: period implies period analytics unless view=trend.
          schema:
            type: string
            enum:
              - month
              - period
            default: month
        - name: period_from
          in: query
          required: false
          description: First monthly period for monthly or trend views.
          schema:
            type: string
            pattern: ^\d{4}-(0[1-9]|1[0-2])$
        - name: period_to
          in: query
          required: false
          description: Last monthly period for monthly or trend views.
          schema:
            type: string
            pattern: ^\d{4}-(0[1-9]|1[0-2])$
        - name: year_from
          in: query
          required: false
          description: First year for group_by=period; defaults to 2023.
          schema:
            type: string
            pattern: ^\d{4}$
            default: '2023'
        - name: year_to
          in: query
          required: false
          description: Last year for group_by=period; defaults to the current year.
          schema:
            type: string
            pattern: ^\d{4}$
      responses:
        '200':
          description: Successful response.
          content:
            application/json:
              schema:
                anyOf:
                  - type: array
                    items:
                      $ref: '#/components/schemas/EnrollmentMonthly'
                  - type: array
                    items:
                      $ref: '#/components/schemas/EnrollmentAnalytics'
                  - type: array
                    items:
                      $ref: '#/components/schemas/EnrollmentPeriodAnalytics'
                  - type: array
                    items:
                      $ref: '#/components/schemas/EnrollmentTrend'
          headers:
            X-Total-Count:
              $ref: '#/components/headers/TotalCount'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '405':
          $ref: '#/components/responses/405'
        '500':
          $ref: '#/components/responses/500'
components:
  parameters:
    CompanyId:
      name: company_id
      in: query
      required: true
      description: >-
        Company UUID. Must equal the authenticated session company when that
        session has a company assigned; the equality check is skipped for
        sessions without one.
      schema:
        type: string
        format: uuid
      example: 11111111-1111-4111-8111-111111111111
  schemas:
    EnrollmentMonthly:
      type: object
      properties:
        period:
          type: string
        as_of_date:
          type: string
        total_enrollment:
          type: integer
      required:
        - period
        - as_of_date
        - total_enrollment
      description: Enrollment Monthly.
    EnrollmentAnalytics:
      type: object
      properties:
        period:
          type: string
        capacity_days:
          type: integer
        vacancy_days:
          type: integer
        vacancy_percent:
          type: number
          format: double
        enrolled_days:
          type: integer
        enrolled_percent:
          type: number
          format: double
        target_occupancy:
          type: number
          format: double
        targeted_enrolled_days:
          type: number
          format: double
        vacant_days_shortfall:
          type: number
          format: double
        monthly_tuition:
          type: number
          format: double
        daily_tuition:
          type: number
          format: double
        tuition_shortfall:
          type: number
          format: double
      required:
        - period
        - capacity_days
        - vacancy_days
        - vacancy_percent
        - enrolled_days
        - enrolled_percent
        - target_occupancy
        - targeted_enrolled_days
        - vacant_days_shortfall
        - monthly_tuition
        - daily_tuition
        - tuition_shortfall
      description: Enrollment Analytics.
    EnrollmentPeriodAnalytics:
      type: object
      properties:
        year:
          type: string
        period:
          type: string
        period_type:
          type: string
        month_start:
          type: string
        month_end:
          type: string
        months_in_period:
          type: integer
        target_occupancy_percent:
          type: number
          format: double
        actual_occupancy_percent:
          type: number
          format: double
        difference:
          type: number
          format: double
        target_tuition:
          type: number
          format: double
        target_tuition_shortfall:
          type: number
          format: double
        vacant_days_shortfall:
          type: number
          format: double
        fte_enrollment_shortfall_month:
          type: integer
        vacancy_months:
          type: number
          format: double
        target_occupancy_days:
          type: number
          format: double
        daily_tuition:
          type: number
          format: double
      required:
        - year
        - period
        - period_type
        - month_start
        - month_end
        - months_in_period
        - target_occupancy_percent
        - actual_occupancy_percent
        - difference
        - target_tuition
        - target_tuition_shortfall
        - vacant_days_shortfall
        - fte_enrollment_shortfall_month
        - vacancy_months
        - target_occupancy_days
        - daily_tuition
      description: Enrollment Period Analytics.
    EnrollmentTrend:
      type: object
      properties:
        period:
          type: string
        enrolled:
          type: integer
        capacity:
          type: integer
        occupancy_rate:
          type: number
          description: >-
            Enrolled divided by capacity; ratio, not a percentage. Zero when
            capacity is zero.
          examples:
            - 0.8
      required:
        - period
        - enrolled
        - capacity
        - occupancy_rate
      description: Enrollment Trend.
    Error:
      type: object
      properties:
        error:
          type: string
          description: Human-readable error message.
      required:
        - error
      description: Error.
  headers:
    TotalCount:
      description: >-
        Total matching rows before pagination, or matching groups before the
        aggregate limit. For unpaginated arrays, the number of returned rows.
      schema:
        type: integer
        minimum: 0
      example: 125
  responses:
    '400':
      description: Invalid or missing parameters or request body.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Invalid or missing parameters or request body.
    '401':
      description: >-
        Missing or invalid Bearer token, or an absent, invalid or expired
        server-side session. The authentication middleware returns plain text
        with a trailing newline.
      content:
        text/plain:
          schema:
            type: string
          examples:
            missing:
              value: |
                missing authorization header
            invalid:
              value: |
                Unauthorized
            expired:
              value: |
                Session expired
    '403':
      description: The authenticated session is not allowed to perform this operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: >-
              The authenticated session is not allowed to perform this
              operation.
    '405':
      description: The path exists but does not support this HTTP method.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: The path exists but does not support this HTTP method.
      headers:
        Allow:
          description: Comma-separated HTTP methods accepted by this path.
          schema:
            type: string
    '500':
      description: The operation could not be completed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: The operation could not be completed.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Access token issued by POST /sessions and associated with a valid
        server-side session.

````

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