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

# Campaign delivery funnel (post-commitment, by stage)

> The post-commitment counterpart to the open sales pipeline. Tracks campaigns through the delivery-to-cash stages, bucketed on the workflow `node` code:

Booking & Trafficking → Live Delivery → Reporting → Billing → Paid & Closed.

A campaign is included if its date range overlaps the requested period. Rejected/cancelled campaigns are excluded. Same stage shape as the sales pipeline funnel (`key`/`label`/`signal`/`count`) so the dashboard can render both as one continuous lead-to-cash view.

> **Note:** `Paid & Closed` reflects campaigns that reached the paid node. Actual cash collected lives in payment-service (`GET /payments/stats`).



## OpenAPI

````yaml /openapi/commercial.yaml get /api/v1/analytics/campaigns/delivery-funnel
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/campaigns/delivery-funnel:
    get:
      tags:
        - Campaigns
      summary: Campaign delivery funnel (post-commitment, by stage)
      description: >-
        The post-commitment counterpart to the open sales pipeline. Tracks
        campaigns through the delivery-to-cash stages, bucketed on the workflow
        `node` code:


        Booking & Trafficking → Live Delivery → Reporting → Billing → Paid &
        Closed.


        A campaign is included if its date range overlaps the requested period.
        Rejected/cancelled campaigns are excluded. Same stage shape as the sales
        pipeline funnel (`key`/`label`/`signal`/`count`) so the dashboard can
        render both as one continuous lead-to-cash view.


        > **Note:** `Paid & Closed` reflects campaigns that reached the paid
        node. Actual cash collected lives in payment-service (`GET
        /payments/stats`).
      operationId: analytics_campaigns_delivery_funnel_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/DeliveryFunnel'
              examples:
                May2026:
                  value:
                    total: 57
                    stages:
                      - key: booking
                        label: Booking & Trafficking
                        signal: Setup, not yet live.
                        count: 8
                      - key: live
                        label: Live Delivery
                        signal: On air.
                        count: 21
                      - key: reporting
                        label: Reporting
                        signal: Delivered; reporting.
                        count: 9
                      - key: billing
                        label: Billing
                        signal: Invoiced, cash owed.
                        count: 13
                      - key: paid
                        label: Paid & Closed
                        signal: Cash collected.
                        count: 6
                  summary: May 2026
          description: ''
      security:
        - bearerAuth: []
components:
  schemas:
    DeliveryFunnel:
      type: object
      properties:
        total:
          type: integer
        stages:
          type: array
          items:
            $ref: '#/components/schemas/DeliveryStage'
      required:
        - stages
        - total
    DeliveryStage:
      type: object
      properties:
        key:
          type: string
        label:
          type: string
        signal:
          type: string
        count:
          type: integer
      required:
        - count
        - key
        - label
        - signal
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Enter your JWT token in the format: Bearer <token>'

````