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

# Aggregate event stats for the org with current vs previous window comparison



## OpenAPI

````yaml /api-reference/openapi.json get /v2/tasks/-/stats
openapi: 3.1.0
info:
  title: Base39 API
  description: Base39 API
  version: 1.0.0
  contact:
    name: Base39 Team
    url: https://base39.com.br
    email: suporte@base39.com.br
  termsOfService: https://base39.com.br/termos
  license:
    name: Proprietary
    url: https://base39.com.br/termos
servers:
  - url: http://localhost:3000
    description: Local
  - url: https://api.dev.base39.cloud
    description: Development
  - url: https://api.base39.com.br
    description: Production
security:
  - OAuth2: []
tags:
  - name: pages
    description: Profiles and reports pages
  - name: pipelines
    description: Pipeline boards (kanban) of pages
  - name: blocks
    description: Blocks operations
  - name: search
    description: Search across content
  - name: targets
    description: Lookup targets via datasets
  - name: CognitoTriggers
    description: Cognito triggers
paths:
  /v2/tasks/-/stats:
    get:
      tags:
        - tasks
      summary: >-
        Aggregate event stats for the org with current vs previous window
        comparison
      operationId: task_find_stats
      parameters:
        - name: window_days
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 365
            default: 30
            example: 30
            type: number
        - name: filter
          required: false
          in: query
          description: Search in task displayName and queryPrimary
          schema:
            type: string
            example: base39
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskStatsOutput'
components:
  schemas:
    TaskStatsOutput:
      type: object
      properties:
        current:
          $ref: '#/components/schemas/TaskStatsPeriodOutput'
        previous:
          $ref: '#/components/schemas/TaskStatsPeriodOutput'
        topTasks:
          type: array
          items:
            $ref: '#/components/schemas/TaskStatsTopTaskOutput'
        categoryMix:
          description: >-
            Share of updates by monitoring task kind (processos, notícias,
            alterações Receita Federal): % in last 30d vs % in last 90d per
            window
          type: array
          items:
            $ref: '#/components/schemas/TaskStatsCategorySliceOutput'
      required:
        - current
        - previous
        - topTasks
        - categoryMix
    TaskStatsPeriodOutput:
      type: object
      properties:
        events:
          type: number
          example: 42
        monitored:
          type: number
          example: 18
        startDate:
          type: string
          example: '2026-03-12T00:00:00.000Z'
          format: date-time
        endDate:
          type: string
          example: '2026-04-11T00:00:00.000Z'
          format: date-time
      required:
        - events
        - monitored
        - startDate
        - endDate
    TaskStatsTopTaskOutput:
      type: object
      properties:
        taskId:
          type: string
          example: tsk_abc
        displayName:
          type: string
          example: Base39 Tecnologia Ltda
        document:
          type: object
          nullable: true
          example: '12345678000190'
        currentEventCount:
          type: number
          example: 12
        previousEventCount:
          type: number
          example: 8
        trend:
          example:
            - 0
            - 1
            - 2
            - 0
            - 3
            - 1
            - 0
          type: array
          items:
            type: number
      required:
        - taskId
        - displayName
        - document
        - currentEventCount
        - previousEventCount
        - trend
    TaskStatsCategorySliceOutput:
      type: object
      properties:
        key:
          type: string
          example: financial
        percentLast30Days:
          type: number
          description: Share of updates in the last 30 days (%)
          example: 24.5
        percentLast90Days:
          type: number
          description: Share of updates in the last 90 days (%)
          example: 18.2
      required:
        - key
        - percentLast30Days
        - percentLast90Days
  securitySchemes:
    OAuth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://id.local.base39.cloud/oauth2/authorize
          tokenUrl: https://id.local.base39.cloud/oauth2/token
          scopes:
            profile: Read user profile
            email: Read user email
            openid: OpenID authentication
      description: OAuth2 Authorization Code flow

````