> ## 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 contacts by category with pagination

> Drill-down endpoint — return the paginated contact list that maps to the requested `categoryKey` (or all uncategorized contacts when `categoryKey` is omitted).



## OpenAPI

````yaml /api-reference/openapi.yaml get /api/contact-metrics/contacts
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/contacts:
    get:
      tags:
        - Contact Metrics
      summary: Get contacts by category with pagination
      description: >-
        Drill-down endpoint — return the paginated contact list that maps to the
        requested `categoryKey` (or all uncategorized contacts when
        `categoryKey` is omitted).
      operationId: get_contacts_by_category
      parameters:
        - in: query
          name: categoryKey
          required: false
          schema:
            type: string
        - 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: page
          required: false
          schema:
            type: string
        - in: query
          name: limit
          required: false
          schema:
            type: string
        - in: query
          name: pipelineId
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Contacts returned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactsByCategoryResponse'
        '400':
          description: Invalid pipeline ID
          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:
    ContactsByCategoryResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          type: object
          properties:
            contacts:
              type: array
              items:
                $ref: '#/components/schemas/ContactMetricsContactItem'
            total:
              type: integer
            page:
              type: integer
            limit:
              type: integer
            totalPages:
              type: integer
          required:
            - contacts
            - total
            - page
            - limit
            - totalPages
          additionalProperties: true
      required:
        - success
        - data
      additionalProperties: true
      example:
        success: true
        data:
          contacts:
            - _id: 65c2d0e0f0a0b0c0d0e0f0a0
              firstName: Jane
              lastName: Doe
              phoneNumber: '+14155550123'
              status: qualified
              createdAt: '2026-04-12T08:00:00.000Z'
              hasOutbound: true
              channelTypes:
                - sms
          total: 47
          page: 1
          limit: 25
          totalPages: 2
    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
    ContactMetricsContactItem:
      type: object
      description: Projected contact row returned by the contacts-by-category aggregation.
      properties:
        _id:
          type: string
        firstName:
          type: string
          nullable: true
        lastName:
          type: string
          nullable: true
        phoneNumber:
          nullable: true
          oneOf:
            - type: string
            - type: array
              items:
                type: object
                additionalProperties: true
        email:
          type: string
          nullable: true
        status:
          type: string
          nullable: true
        createdAt:
          type: string
          format: date-time
        lastMessageTime:
          type: string
          format: date-time
          nullable: true
        hasOutbound:
          type: boolean
        channelTypes:
          type: array
          items:
            type: string
        createdByUser:
          type: object
          nullable: true
          properties:
            _id:
              type: string
            fullName:
              type: string
          additionalProperties: true
      additionalProperties: true
      example:
        _id: 65c2d0e0f0a0b0c0d0e0f0a0
        firstName: Jane
        lastName: Doe
        phoneNumber: '+14155550123'
        email: jane@example.com
        status: qualified
        createdAt: '2026-04-12T08:00:00.000Z'
        lastMessageTime: '2026-05-18T13:45:00.000Z'
        hasOutbound: true
        channelTypes:
          - sms
          - email
        createdByUser:
          _id: 65b1f0a2c3d4e5f6a7b8c9d0
          fullName: Alice Rivera
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````