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

# Team Performance KPI cards (team-wide totals)

> Team-wide actual/target sums per activity type, for the 4 KPI cards.

Always computed across the caller's full remit — never paginated,
since a card's total would be wrong if it only summed one page of
team_kpi's per-rep rows.



## OpenAPI

````yaml /openapi/commercial.yaml get /api/v1/activities/team-kpi-summary
openapi: 3.0.3
info:
  title: Commercial Service API
  version: 1.0.0
  description: |2-

        **Commercial Service API** - Lead management and campaign workflow system.

        ## Versioning
        The API uses URL path versioning (e.g., `/api/v1/`, `/api/v2/`).
        Current version: **v1**
        
servers:
  - url: https://api.capedigital.co.ke/commercial
    description: Production
security: []
paths:
  /api/v1/activities/team-kpi-summary:
    get:
      tags:
        - Activities
      summary: Team Performance KPI cards (team-wide totals)
      description: |-
        Team-wide actual/target sums per activity type, for the 4 KPI cards.

        Always computed across the caller's full remit — never paginated,
        since a card's total would be wrong if it only summed one page of
        team_kpi's per-rep rows.
      operationId: activities_team_kpi_summary
      parameters:
        - in: query
          name: period
          schema:
            type: string
          description: today|this_week|this_month (drives the target multiplier)
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActivityList'
          description: ''
      security:
        - bearerAuth: []
components:
  schemas:
    ActivityList:
      type: object
      description: >-
        Flattens the lead's contact fields in, so the table needs no second
        lookup.
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        lead:
          type: string
          format: uuid
          description: The lead this activity belongs to
        client:
          type: string
        contact_person:
          type: string
        contact_phone:
          type: string
        contact_email:
          type: string
        activity_name:
          type: string
          description: Name/title of the activity
          maxLength: 100
        activity_type:
          enum:
            - call
            - meeting
            - email
            - follow_up
            - site_visit
            - proposal
          type: string
          x-spec-enum-id: ea259bbfa05f58b2
          description: |-
            Type of activity

            * `call` - Call
            * `meeting` - Meeting
            * `email` - Email
            * `follow_up` - Follow Up
            * `site_visit` - Site Visit
            * `proposal` - Proposal
        notes:
          type: string
          description: Detailed notes about the activity
        actor:
          type: string
          readOnly: true
        activity_at:
          type: string
          format: date-time
          description: When the activity was performed
      required:
        - activity_name
        - activity_type
        - actor
        - client
        - contact_email
        - contact_person
        - contact_phone
        - id
        - lead
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Enter your JWT token in the format: Bearer <token>'

````