> ## 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.

# Sales summary KPIs

> Powers the KPI card row on the **Sales analytics** screen and the top row of the **Executive overview** screen.

Returns total revenue, avg deal size, open leads, new clients, and deals closed for the requested period. All monetary values are in the contract currency (KES for domestic deals).

Campaign counts have moved to `GET analytics/campaigns/summary`.



## OpenAPI

````yaml /openapi/commercial.yaml get /api/v1/analytics/sales/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
  - url: http://localhost:8000
    description: Local
security: []
paths:
  /api/v1/analytics/sales/summary:
    get:
      tags:
        - Sales Analytics
      summary: Sales summary KPIs
      description: >-
        Powers the KPI card row on the **Sales analytics** screen and the top
        row of the **Executive overview** screen.


        Returns total revenue, avg deal size, open leads, new clients, and deals
        closed for the requested period. All monetary values are in the contract
        currency (KES for domestic deals).


        Campaign counts have moved to `GET analytics/campaigns/summary`.
      operationId: analytics_sales_summary_retrieve
      parameters:
        - in: query
          name: period
          schema:
            type: string
          description: |-
            Period string. Accepted formats:
            - `2026-05` — calendar month
            - `Q2-2026` — quarter (Q1–Q4)
            - `YTD-2026` — year to date
          required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SalesSummary'
              examples:
                May2026:
                  value:
                    total_contracted_revenue: '21400000.00'
                    avg_deal_value: '455000.00'
                    open_leads: 38
                    deals_closed: 11
                    new_clients: 7
                  summary: May 2026
          description: ''
      security:
        - bearerAuth: []
components:
  schemas:
    SalesSummary:
      type: object
      properties:
        total_contracted_revenue:
          type: string
          format: decimal
          pattern: ^-?\d{0,16}(?:\.\d{0,2})?$
        open_leads:
          type: integer
        new_clients:
          type: integer
        deals_closed:
          type: integer
        avg_deal_value:
          type: string
          format: decimal
          pattern: ^-?\d{0,16}(?:\.\d{0,2})?$
      required:
        - avg_deal_value
        - deals_closed
        - new_clients
        - open_leads
        - total_contracted_revenue
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Enter your JWT token in the format: Bearer <token>'

````