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

# Test-count analytics

> Returns the number of distinct test cases run per day for the scoped project.



## OpenAPI

````yaml /api-reference/openapi.generated.json get /api/v2/analytics/test-count
openapi: 3.1.0
info:
  title: Empirical API
  version: 1.0.0
  description: Programmatic access to Empirical test runs, snoozes, and more.
  contact:
    name: Empirical
    url: https://empirical.run
servers:
  - url: https://api.empirical.run
security:
  - Bearer: []
tags:
  - name: Analytics
    description: Aggregated test-run, test-count and test-case analytics for a project.
  - name: Analytics (Deprecated)
    description: >-
      Legacy analytics endpoints retained for backwards compatibility; prefer
      the v2 equivalents.
  - name: Environments
    description: >-
      Named deployment targets (slug + Playwright project filters) a project's
      tests run against.
  - name: Snoozes
    description: Temporarily suppress known test failures for specific Playwright tests.
  - name: Telemetry
    description: Product telemetry derived from analytics events, scoped to a project.
  - name: Test Cases
    description: >-
      Browse the Playwright test cases synced from a project's repository and
      manage their tags.
paths:
  /api/v2/analytics/test-count:
    get:
      tags:
        - Analytics
      summary: Test-count analytics
      description: >-
        Returns the number of distinct test cases run per day for the scoped
        project.
      operationId: getTestCountAnalyticsV2
      parameters:
        - schema:
            type: integer
            minimum: 1
            maximum: 90
            description: >-
              Number of days to include (1-90). Ignored when both `start_date`
              and `end_date` are provided.
          required: false
          description: >-
            Number of days to include (1-90). Ignored when both `start_date` and
            `end_date` are provided.
          name: days
          in: query
        - schema:
            type: string
            description: Start of a custom date range (ISO 8601).
          required: false
          description: Start of a custom date range (ISO 8601).
          name: start_date
          in: query
        - schema:
            type: string
            description: End of a custom date range (ISO 8601).
          required: false
          description: End of a custom date range (ISO 8601).
          name: end_date
          in: query
        - schema:
            type: string
            description: Filter to a single environment by ID.
          required: false
          description: Filter to a single environment by ID.
          name: environment_id
          in: query
      responses:
        '200':
          description: Daily distinct test counts and a period summary.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsTestCountResponse'
        '400':
          description: Invalid request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Analytics backend error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsErrorResponse'
components:
  schemas:
    AnalyticsTestCountResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            daily:
              type: array
              items:
                $ref: '#/components/schemas/TestCountByDayEntry'
            summary:
              $ref: '#/components/schemas/TestCountSummary'
          required:
            - daily
            - summary
          description: Response payload.
      required:
        - data
    ErrorResponse:
      type: object
      properties:
        data:
          nullable: true
          description: Always null for error responses.
        error:
          type: object
          properties:
            message:
              type: string
              description: Human-readable error message.
          required:
            - message
          description: Error details.
      required:
        - data
        - error
    AnalyticsErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Human-readable error message.
      required:
        - error
    TestCountByDayEntry:
      type: object
      properties:
        date:
          type: string
          description: Date in YYYY-MM-DD format.
        test_count:
          type: number
          description: >-
            Number of distinct test cases that ran on this date (skipped tests
            excluded).
      required:
        - date
        - test_count
    TestCountSummary:
      type: object
      properties:
        latest_count:
          type: number
          description: Test count on the most recent day in the window.
        first_count:
          type: number
          description: Test count on the first day in the window.
        change:
          type: number
          description: Absolute change between `first_count` and `latest_count`.
        change_percent:
          type: number
          description: Percentage change (0-100) between first and latest day.
      required:
        - latest_count
        - first_count
        - change
        - change_percent
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

````