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

# Count activities

> Counts the activities that match a filter, with the same filter and access rules as POST /c/{companyId}/activities/search. Set groupBy to also count by type or by month. A field the request does not define fails validation. No text can contain the NUL character (U+0000) or a lone UTF-16 surrogate (U+D800 to U+DFFF). With permission to manage activities (`activities.manage`), you can read every activity. Otherwise you can read an activity when its access grants you read or write access, for example as an employee on it, as one of their managers, or as the employee who created it. Activities shared with admins can be read with permission to view admin activities (`activities.view_admin`). Access granted to a permission reaches only members who have an employee record; permission to manage activities needs none. Archived activities are never returned.



## OpenAPI

````yaml https://api.gowindmill.com/api/v2/openapi.json post /c/{companyId}/activities/count
openapi: 3.1.0
info:
  title: Windmill API
  version: 2.0.0
  description: >-
    Use the Windmill API to integrate your systems, automate workflows, and
    build applications on your organization's data. Authenticate with an API key
    or OAuth access token. Each request uses the authenticated user's
    permissions within the selected workspace.
servers:
  - url: https://api.gowindmill.com/api/v2
security:
  - bearerAuth: []
paths:
  /c/{companyId}/activities/count:
    post:
      tags:
        - Activities
      summary: Count activities
      description: >-
        Counts the activities that match a filter, with the same filter and
        access rules as POST /c/{companyId}/activities/search. Set groupBy to
        also count by type or by month. A field the request does not define
        fails validation. No text can contain the NUL character (U+0000) or a
        lone UTF-16 surrogate (U+D800 to U+DFFF). With permission to manage
        activities (`activities.manage`), you can read every activity. Otherwise
        you can read an activity when its access grants you read or write
        access, for example as an employee on it, as one of their managers, or
        as the employee who created it. Activities shared with admins can be
        read with permission to view admin activities (`activities.view_admin`).
        Access granted to a permission reaches only members who have an employee
        record; permission to manage activities needs none. Archived activities
        are never returned.
      operationId: activities.count
      parameters:
        - schema:
            type: string
            minLength: 1
            maxLength: 128
            description: >-
              Company ID. A URL slug is also accepted. The caller must have
              access to this company.
            title: Company ID
            example: company-acme
          required: true
          description: >-
            Company ID. A URL slug is also accepted. The caller must have access
            to this company.
          name: companyId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CountActivitiesRequest'
      responses:
        '200':
          description: The number of matching activities, and the groups when requested.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CountActivitiesResponse'
        '400':
          description: Bad request or request validation failed
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - BAD_REQUEST
                          message:
                            type: string
                          requestId:
                            type: string
                          details:
                            type: array
                            items:
                              type: object
                              properties:
                                path:
                                  type: array
                                  items:
                                    anyOf:
                                      - type: string
                                      - type: number
                                message:
                                  type: string
                                resourceId:
                                  type: string
                              required:
                                - path
                                - message
                            description: >-
                              Each request item that failed, by its path in the
                              request, when the operation identifies them.
                              resourceId names an existing resource the failure
                              concerns.
                        required:
                          - code
                          - message
                          - requestId
                    required:
                      - error
                  - type: object
                    properties:
                      error:
                        type: object
                        properties:
                          code:
                            type: string
                            enum:
                              - VALIDATION_ERROR
                          message:
                            type: string
                          requestId:
                            type: string
                          details:
                            type: array
                            items:
                              type: object
                              properties:
                                path:
                                  type: array
                                  items:
                                    anyOf:
                                      - type: string
                                      - type: number
                                message:
                                  type: string
                              required:
                                - path
                                - message
                        required:
                          - code
                          - message
                          - requestId
                          - details
                    required:
                      - error
        '401':
          description: >-
            Authentication is missing or invalid. Send a valid API key or OAuth
            access token in the Authorization: Bearer <TOKEN> header before
            retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - UNAUTHORIZED
                      message:
                        type: string
                      requestId:
                        type: string
                    required:
                      - code
                      - message
                      - requestId
                required:
                  - error
        '403':
          description: >-
            The API key or OAuth access token cannot access the workspace in the
            URL. A token works only in the workspace it was issued for, and only
            while its user is a member of that workspace.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - FORBIDDEN
                      message:
                        type: string
                      requestId:
                        type: string
                      details:
                        type: array
                        items:
                          type: object
                          properties:
                            path:
                              type: array
                              items:
                                anyOf:
                                  - type: string
                                  - type: number
                            message:
                              type: string
                            resourceId:
                              type: string
                          required:
                            - path
                            - message
                        description: >-
                          Each request item you lack permission for, by its path
                          in the request, when the operation identifies them.
                          resourceId names an existing resource the failure
                          concerns.
                    required:
                      - code
                      - message
                      - requestId
                required:
                  - error
        '429':
          description: >-
            The API-client request budget is exhausted. API keys allow 500
            requests per minute per key; OAuth clients allow 500 per minute per
            client and workspace. Reads and writes share the budget. One HTTP
            request counts once, including bulk requests. Wait for the
            Retry-After delay before retrying.
          headers:
            Retry-After:
              description: Number of seconds to wait before retrying the request.
              required: true
              schema:
                type: integer
                minimum: 0
                example: 42
            RateLimit:
              description: >-
                Current request budget: limit is the maximum count, remaining is
                the unused count, and reset is seconds until the window resets,
                not a timestamp.
              required: true
              schema:
                type: string
                example: limit=500, remaining=0, reset=42
            RateLimit-Policy:
              description: >-
                Request limit and window length in seconds, formatted as
                <limit>;w=<seconds>.
              required: true
              schema:
                type: string
                example: 500;w=60
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        enum:
                          - RATE_LIMITED
                      message:
                        type: string
                      requestId:
                        type: string
                    required:
                      - code
                      - message
                      - requestId
                required:
                  - error
      security:
        - bearerAuth: []
components:
  schemas:
    CountActivitiesRequest:
      type: object
      properties:
        filter:
          $ref: '#/components/schemas/ActivityFilter'
        groupBy:
          type: string
          enum:
            - type
            - month
          description: >-
            Also count by group. type: one group per type externalId, largest
            count first, then by key. month: one group per UTC calendar month,
            keyed YYYY-MM, in ascending order; months with no activities are
            left out.
      additionalProperties: false
      example:
        filter:
          types:
            - call-score
          tags:
            - q4-push
        groupBy: month
    CountActivitiesResponse:
      type: object
      properties:
        total:
          type: integer
          minimum: 0
          description: The number of matching activities you can read.
          example: 42
        groups:
          type: array
          items:
            type: object
            properties:
              key:
                type: string
                description: The type externalId, or the month as YYYY-MM.
                example: 2026-10
              count:
                type: integer
                minimum: 0
                description: The number of matching activities in the group.
                example: 17
            required:
              - key
              - count
          description: The counts by group. Present only when groupBy is set.
      required:
        - total
      example:
        total: 42
        groups:
          - key: 2026-09
            count: 25
          - key: 2026-10
            count: 17
    ActivityFilter:
      type: object
      properties:
        types:
          type: array
          items:
            type: string
        employeeIds:
          type: array
          items:
            type: string
          description: >-
            Activities about at least one of these employees, or of the
            employees in emails. An empty list matches no activity unless emails
            names an employee.
        emails:
          type: array
          items:
            type: string
        tags:
          type: array
          items:
            type: string
        tagsMatch:
          type: string
          enum:
            - any
            - all
          default: any
          description: >-
            How tags match. any: the activity has at least one listed tag. all:
            it has every listed tag. Defaults to any.
        occurredAt:
          type: object
          properties:
            from:
              type: object
              properties:
                at:
                  type: string
                  format: date-time
                inclusive:
                  type: boolean
                includeNull:
                  type: boolean
              required:
                - at
              additionalProperties: false
            to:
              type: object
              properties:
                at:
                  type: string
                  format: date-time
                inclusive:
                  type: boolean
                includeNull:
                  type: boolean
              required:
                - at
              additionalProperties: false
          additionalProperties: false
          description: >-
            Activities whose occurredAt falls in this range. Each bound's at is
            an RFC 3339 date-time with seconds and `Z` or a `±HH:MM` offset.
            Either bound can be left out, and each bound is inclusive unless you
            set inclusive to false.
        properties:
          type: array
          items:
            $ref: '#/components/schemas/ActivityPropertyCondition'
          maxItems: 49
          description: >-
            Activities whose properties match every condition. At most 49
            conditions; more fail validation.
          example:
            - key: score
              op: gte
              value: 80
      additionalProperties: false
      description: >-
        Which activities to match. Every supplied field must match, and the
        values in one list match when any one does, except tags with tagsMatch
        all and properties, where every condition must match. An omitted or
        empty list leaves its field unfiltered, except employeeIds.
    ActivityPropertyCondition:
      oneOf:
        - type: object
          properties:
            key:
              type: string
              maxLength: 128
            op:
              type: string
              enum:
                - eq
            value:
              anyOf:
                - type: string
                  maxLength: 128
                - type: number
                - type: boolean
          required:
            - key
            - op
            - value
          additionalProperties: false
          description: >-
            eq: the property is a text, number, or boolean equal to value. Text
            matches exactly and case-sensitively.
        - type: object
          properties:
            key:
              type: string
              maxLength: 128
            op:
              type: string
              enum:
                - in
                - notIn
            value:
              anyOf:
                - type: array
                  items:
                    type: string
                    maxLength: 128
                  minItems: 1
                  maxItems: 1000
                - type: array
                  items:
                    type: number
                  minItems: 1
                  maxItems: 1000
              description: 1 to 1,000 texts, or 1 to 1,000 numbers.
          required:
            - key
            - op
            - value
          additionalProperties: false
          description: >-
            in: the property is a text or number equal to one of the values,
            matched exactly and case-sensitively. notIn: the property has no
            value, or is a text, number, or boolean equal to none of the values.
        - type: object
          properties:
            key:
              type: string
              maxLength: 128
            op:
              type: string
              enum:
                - contains
                - startsWith
            value:
              anyOf:
                - type: string
                  maxLength: 128
                - type: array
                  items:
                    type: string
                    maxLength: 128
                  minItems: 1
                  maxItems: 1000
              description: One text, or 1 to 1,000 texts.
          required:
            - key
            - op
            - value
          additionalProperties: false
          description: >-
            contains: the property is a text that contains one of the texts.
            startsWith: the property is a text that starts with one of the
            texts. Both ignore case.
        - type: object
          properties:
            key:
              type: string
              maxLength: 128
            op:
              type: string
              enum:
                - gte
                - lte
            value:
              anyOf:
                - type: string
                  maxLength: 128
                - type: number
          required:
            - key
            - op
            - value
          additionalProperties: false
          description: >-
            gte: at least value. lte: at most value. With a number, the property
            must be a number. With a text, the property must be a text, compared
            by character code, so ISO 8601 timestamps in the same format compare
            in time order and uppercase letters come before lowercase ones.
        - type: object
          properties:
            key:
              type: string
              maxLength: 128
            op:
              type: string
              enum:
                - overlaps
                - containsAll
                - notOverlaps
            value:
              anyOf:
                - type: array
                  items:
                    type: string
                    maxLength: 128
                  minItems: 1
                  maxItems: 1000
                - type: array
                  items:
                    type: number
                  minItems: 1
                  maxItems: 1000
              description: 1 to 1,000 texts, or 1 to 1,000 numbers.
          required:
            - key
            - op
            - value
          additionalProperties: false
          description: >-
            For a list property. overlaps: the list holds at least one of the
            values. containsAll: it holds every value. notOverlaps: the property
            has no value, or is a list that holds none of the values. Items
            match exactly and case-sensitively.
        - type: object
          properties:
            key:
              type: string
              maxLength: 128
            op:
              type: string
              enum:
                - isEmpty
                - isNotEmpty
          required:
            - key
            - op
          additionalProperties: false
          description: >-
            isEmpty: the property has no value. isNotEmpty: the property has a
            value.
      description: >-
        A condition on one property. A property has no value when it is missing
        or is null, an empty text, or an empty list. Values are never converted:
        the text "82" does not equal the number 82. The operators for a single
        value (eq, in, notIn, contains, startsWith, gte, lte) never match a
        non-empty list, and the list operators (overlaps, containsAll,
        notOverlaps) never match a single value. Keys and texts are limited to
        128 characters.
      example:
        key: callType
        op: eq
        value: Discovery
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Use an API key or OAuth access token. Enter only the token in the
        authorization dialog; requests send it as `Authorization: Bearer
        <TOKEN>`.


        Create an API key in your workspace's **Settings → API keys**. Keys
        start with `wm_api_` and only work in the workspace where they were
        created. Read-only keys can read data; creating, updating, or deleting
        data requires a read-write key.


        ```http

        Authorization: Bearer wm_api_example

        ```


        OAuth access tokens are issued for connected Windmill applications.


        ```http

        Authorization: Bearer <OAUTH_ACCESS_TOKEN>

        ```


        Both token types use the authenticated user's workspace permissions.
        Each endpoint's permission requirements and the sharing settings of the
        requested items still apply.

````

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