> ## 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 historical stage distribution for outreach contacts

> Returns counts of pipeline-stage transitions for outreach contacts grouped by period (day/week/month), stage, and lead source. Backed by ContactPipelineTransition records and scoped to the org's outreach configs.



## OpenAPI

````yaml /api-reference/openapi.yaml get /api/outreach-metrics/history
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/outreach-metrics/history:
    get:
      tags:
        - Outreach Metrics
      summary: Get historical stage distribution for outreach contacts
      description: >-
        Returns counts of pipeline-stage transitions for outreach contacts
        grouped by period (day/week/month), stage, and lead source. Backed by
        ContactPipelineTransition records and scoped to the org's outreach
        configs.
      operationId: get_outreach_metrics_history
      parameters:
        - in: query
          name: from
          required: true
          schema:
            type: string
            format: date-time
          description: Inclusive lower bound on transition createdAt.
        - in: query
          name: to
          required: true
          schema:
            type: string
            format: date-time
          description: Inclusive upper bound on transition createdAt.
        - in: query
          name: groupBy
          required: false
          schema:
            type: string
            enum:
              - day
              - week
              - month
            default: day
        - in: query
          name: source
          required: false
          schema:
            type: string
          description: Optional source name filter (case-insensitive exact match).
        - in: query
          name: filterUserId
          required: false
          schema:
            type: string
          description: >-
            Admin-only. Target a specific user, or 'all' for the whole
            organization.
      responses:
        '200':
          description: History returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OutreachMetricsHistoryResponse'
        '400':
          description: '''from'' and ''to'' query params are required'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OutreachErrorResponse'
        '403':
          description: Admin access required to filter by user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OutreachErrorResponse'
        '500':
          description: Error fetching outreach metrics history
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OutreachErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    OutreachMetricsHistoryResponse:
      type: object
      properties:
        success:
          type: boolean
        data:
          type: array
          items:
            $ref: '#/components/schemas/OutreachMetricsHistoryEntry'
      required:
        - success
        - data
      additionalProperties: true
      example:
        success: true
        data:
          - period: '2026-05-17'
            stage: Contacted
            source: Facebook Lead Ad
            count: 12
          - period: '2026-05-17'
            stage: Closed Won
            source: Facebook Lead Ad
            count: 3
    OutreachErrorResponse:
      type: object
      description: Error envelope returned by `/api/outreach`.
      properties:
        success:
          type: boolean
          enum:
            - false
        message:
          type: string
        error:
          type: string
          description: Stack/detail string for 500 paths.
      required:
        - success
        - message
      additionalProperties: true
      example:
        success: false
        message: Configuration is inactive and cannot process outreach requests
    OutreachMetricsHistoryEntry:
      type: object
      properties:
        period:
          type: string
          description: Period key formatted per groupBy (YYYY-MM-DD, YYYY-WW, YYYY-MM).
        stage:
          type: string
          description: Destination pipeline stage of the transition.
        source:
          type: string
          description: Lead source attributed to the transition.
        count:
          type: integer
      required:
        - period
        - stage
        - source
        - count
      additionalProperties: false
      example:
        period: '2026-05-17'
        stage: Contacted
        source: Facebook Lead Ad
        count: 12
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````