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

# Active users by platform



## OpenAPI

````yaml /openapi/user.yaml get /api/v1/analytics/platforms
openapi: 3.0.3
info:
  title: CapeMedia User Service API
  version: 1.0.0
  description: |2-

        **CapeMedia User Service API** - Comprehensive user service and management system.

        ## Authentication
        This API uses **JWT Bearer tokens** for authentication.

        1. Login via `/api/v1/auth/login` to obtain tokens
        2. Include the access token in the `Authorization` header: `Bearer <access_token>`
        3. Refresh expired tokens via `/api/v1/auth/refresh-token`

        ## Versioning
        The API uses URL path versioning (e.g., `/api/v1/`, `/api/v2/`).
        Current version: **v1**
        
  contact:
    name: API Support
    email: support@capemedia.co.ke
  license:
    name: Cape Media
servers:
  - url: https://api.diginacape.co.ke/acl
    description: Production
  - url: http://sapi.diginacape.co.ke/acl
    description: Local development
security: []
paths:
  /api/v1/analytics/platforms:
    get:
      tags:
        - Analytics
      summary: Active users by platform
      operationId: analytics_platforms_retrieve
      parameters:
        - in: query
          name: days
          schema:
            type: integer
          description: Look-back window in days
        - in: query
          name: realm
          schema:
            type: string
          description: Keycloak realm
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformsResponse'
          description: ''
      security:
        - bearerAuth: []
components:
  schemas:
    PlatformsResponse:
      type: object
      properties:
        success:
          type: boolean
        message:
          type: string
        data:
          $ref: '#/components/schemas/Platforms'
      required:
        - data
        - message
        - success
    Platforms:
      type: object
      properties:
        platforms:
          type: array
          items:
            type: string
        active:
          $ref: '#/components/schemas/ActiveByPlatform'
        tv_paired:
          $ref: '#/components/schemas/TvPaired'
        sign_ins_7d:
          $ref: '#/components/schemas/PlatformCounts'
        multi_platform_users_30d:
          type: integer
        tracking_since:
          type: string
          format: date
          nullable: true
          description: Earliest captured activity day; windows before it undercount.
        generated_at:
          type: string
          format: date-time
        series:
          type: array
          items:
            $ref: '#/components/schemas/PlatformDay'
      required:
        - active
        - generated_at
        - multi_platform_users_30d
        - platforms
        - series
        - sign_ins_7d
        - tracking_since
        - tv_paired
    ActiveByPlatform:
      type: object
      properties:
        dau:
          allOf:
            - $ref: '#/components/schemas/PlatformCounts'
          description: Active today (calendar day).
        wau:
          allOf:
            - $ref: '#/components/schemas/PlatformCounts'
          description: Active in the last 7 days.
        mau:
          allOf:
            - $ref: '#/components/schemas/PlatformCounts'
          description: Active in the last 30 days.
      required:
        - dau
        - mau
        - wau
    TvPaired:
      type: object
      properties:
        users:
          type: integer
          description: Users with at least one paired TV.
        tvs:
          type: integer
          description: TVs with a live pairing (claimed, not revoked, not expired).
        by_platform:
          type: object
          additionalProperties:
            type: integer
          description: Live TV pairings per TV platform.
      required:
        - by_platform
        - tvs
        - users
    PlatformCounts:
      type: object
      properties:
        ios:
          type: integer
        android:
          type: integer
        web:
          type: integer
        tizen:
          type: integer
        webos:
          type: integer
        android_tv:
          type: integer
        tv_other:
          type: integer
        tv:
          type: integer
          description: Distinct users across tizen, webos, android_tv and tv_other.
        total:
          type: integer
          description: >-
            Distinct users across platforms; less than the sum when users are on
            more than one platform.
      required:
        - android
        - android_tv
        - ios
        - tizen
        - total
        - tv
        - tv_other
        - web
        - webos
    PlatformDay:
      type: object
      properties:
        date:
          type: string
          format: date
        active:
          $ref: '#/components/schemas/PlatformCounts'
        sign_ins:
          $ref: '#/components/schemas/PlatformCounts'
      required:
        - active
        - date
        - sign_ins
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Enter your JWT token in the format: Bearer <token>'

````

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