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

# Get metrics breakdown by user (Admin only)

> ADMIN/SUPERADMIN-only — return the org metrics broken down by owning user, with the same category buckets the summary endpoint reports. Used by the leaderboard / per-rep activity reports.



## OpenAPI

````yaml /api-reference/openapi.yaml get /api/contact-metrics/by-user
openapi: 3.0.3
info:
  title: Tether Relay and Tether API
  version: 1.0.0
  description: >-
    Route-derived OpenAPI contract generated from tether-relay backend sources.
    Regenerate with scripts/sync-openapi-from-backend.mjs.
servers:
  - url: https://your-instance.example.com
    description: Production
  - url: http://localhost:2212
    description: Local API service
security: []
tags:
  - name: AI
  - name: Applications
  - name: Approval
  - name: Auth
  - name: Automations
  - name: Calls
  - name: Campaigns
  - name: Contact Analytics
  - name: Contact Metrics
  - name: Contact Notes
  - name: Contacts
  - name: Conversation Monitor
  - name: Conversations
  - name: Departments
  - name: Email
  - name: Escalation Dashboard
  - name: Event Logs
  - name: Google Sheets
  - name: Marketplace
  - name: Messages
  - name: Notification Sounds
  - name: Notifications
  - name: Org Snapshots
  - name: Organizations
  - name: Outreach
  - name: Outreach Metrics
  - name: Outreach Sources
  - name: Pipelines
  - name: Processes
  - name: Prompts
  - name: Reminders
  - name: Sms
  - name: Templates
  - name: Traces
  - name: Training
  - name: Upload
  - name: User Snapshots
  - name: Users
  - name: Vertical
  - name: Webchats
  - name: Webhook
paths:
  /api/contact-metrics/by-user:
    get:
      tags:
        - Contact Metrics
      summary: Get metrics breakdown by user (Admin only)
      description: >-
        ADMIN/SUPERADMIN-only — return the org metrics broken down by owning
        user, with the same category buckets the summary endpoint reports. Used
        by the leaderboard / per-rep activity reports.
      operationId: get_contact_metrics_by_user
      parameters:
        - in: query
          name: startDate
          required: false
          schema:
            type: string
            format: date-time
        - in: query
          name: endDate
          required: false
          schema:
            type: string
            format: date-time
        - in: query
          name: pipelineId
          required: false
          schema:
            type: string
      responses:
        '200':
          description: User metrics returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactMetricsByUserResponse'
        '400':
          description: Invalid pipeline ID
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactMetricsErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactMetricsErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactMetricsErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    ContactMetricsByUserResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          type: object
          properties:
            users:
              type: array
              items:
                $ref: '#/components/schemas/ContactMetricsUserRow'
            categories:
              type: array
              items:
                type: object
                properties:
                  key:
                    type: string
                  name:
                    type: string
                  color:
                    type: string
                additionalProperties: true
            pipelineId:
              type: string
              nullable: true
            pipelineName:
              type: string
              nullable: true
          required:
            - users
            - categories
          additionalProperties: true
      required:
        - success
        - data
      additionalProperties: true
      example:
        success: true
        data:
          users:
            - userId: 65b1f0a2c3d4e5f6a7b8c9d0
              userName: Alice Rivera
              userEmail: alice@example.com
              total: 47
              contacted: 38
              neverContacted: 9
              categories:
                new:
                  total: 22
                  contacted: 0
                  neverContacted: 22
                working:
                  total: 25
                  contacted: 25
                  neverContacted: 0
              uncategorized:
                total: 0
                contacted: 0
                neverContacted: 0
          categories:
            - key: new
              name: New
              color: '#3B82F6'
            - key: working
              name: Working
              color: '#10B981'
          pipelineId: 66f0a0b0c0d0e0f0a0b0c0d0
          pipelineName: Sales pipeline
    ContactMetricsErrorResponse:
      type: object
      description: >-
        Error envelope returned by contact-metrics endpoints. Errors are
        returned as `{ error: <message> }`.
      properties:
        error:
          type: string
      additionalProperties: true
      example:
        error: Invalid pipeline ID
    ContactMetricsUserRow:
      type: object
      properties:
        userId:
          type: string
          nullable: true
        userName:
          type: string
        userEmail:
          type: string
          nullable: true
        total:
          type: integer
        contacted:
          type: integer
        neverContacted:
          type: integer
        categories:
          type: object
          description: Keyed by category `key`.
          additionalProperties:
            $ref: '#/components/schemas/ContactMetricsUserCategoryBucket'
        uncategorized:
          $ref: '#/components/schemas/ContactMetricsUserCategoryBucket'
      additionalProperties: true
      example:
        userId: 65b1f0a2c3d4e5f6a7b8c9d0
        userName: Alice Rivera
        userEmail: alice@example.com
        total: 47
        contacted: 38
        neverContacted: 9
        categories:
          new:
            total: 22
            contacted: 0
            neverContacted: 22
          working:
            total: 25
            contacted: 25
            neverContacted: 0
        uncategorized:
          total: 0
          contacted: 0
          neverContacted: 0
    ContactMetricsUserCategoryBucket:
      type: object
      properties:
        total:
          type: integer
        contacted:
          type: integer
        neverContacted:
          type: integer
      additionalProperties: true
      example:
        total: 22
        contacted: 14
        neverContacted: 8
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````