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

# Call metrics

> Dials, connects, connect rate and talk time in a window, optionally broken down by day, week, rep or campaign.



## OpenAPI

````yaml /openapi.json get /metrics/calls
openapi: 3.1.0
info:
  title: Leadey API
  version: 1.4.0
  description: >-
    The Leadey API gives you programmatic access to your workspace: leads,
    companies, contacts, campaigns, meetings, opportunities and calls, plus the
    reporting metrics behind the Cockpit.


    Every request is authenticated with an organization-scoped API key, and
    every response is JSON. Reads work with any key. Writes — creating leads,
    adding notes, logging calls, managing tasks — need a key with write access,
    and are attributed to the workspace member that key belongs to. See [Writing
    data](/guides/writing-data).
servers:
  - url: https://backend.leadey.ai/v1
    description: Production
  - url: http://localhost:3001/v1
    description: Local development
security:
  - bearerAuth: []
tags:
  - name: Account
    description: The organization behind the API key.
  - name: Leads
    description: People enrolled in your campaigns.
  - name: Notes
    description: >-
      Free-text notes on a lead. Notes appear in the lead's timeline and in the
      Cockpit.
  - name: Tasks
    description: Follow-ups and reminders, each assigned to a workspace member.
  - name: Campaigns
    description: Outreach sequences and their performance.
  - name: Companies
    description: Companies in your workspace.
  - name: Contacts
    description: The canonical person record behind your leads.
  - name: Meetings
    description: Bookings merged across Calendly, Leadey and connected calendars.
  - name: Opportunities
    description: Deals, their value, and the pipelines they sit in.
  - name: Pipelines
    description: Deal pipelines and the stages inside them.
  - name: Calls
    description: Dial history, recordings and transcripts.
  - name: Metrics
    description: >-
      Aggregated reporting — meetings booked, sit rate, dial activity and
      pipeline value.
  - name: Reference
    description: The vocabularies other endpoints return values from.
paths:
  /metrics/calls:
    get:
      tags:
        - Metrics
      summary: Call metrics
      description: >-
        Dials, connects, connect rate and talk time in a window, optionally
        broken down by day, week, rep or campaign.
      operationId: getCallMetrics
      parameters:
        - $ref: '#/components/parameters/From'
        - $ref: '#/components/parameters/To'
        - $ref: '#/components/parameters/Timezone'
        - $ref: '#/components/parameters/GroupBy'
        - name: campaignId
          in: query
          description: Restrict to one campaign.
          schema:
            type: string
        - name: userId
          in: query
          description: Restrict to one user.
          schema:
            type: string
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/CallMetrics'
              example:
                data:
                  window:
                    from: '2026-07-01T00:00:00.000Z'
                    to: '2026-07-31T23:59:59.999Z'
                    timezone: UTC
                  totals:
                    dials: 412
                    connected: 138
                    connectRate: 0.335
                    voicemails: 96
                    inbound: 22
                    outbound: 390
                    talkSeconds: 386
                    avgTalkSeconds: 214
                  groupBy: week
                  groups:
                    - key: 2026-W28
                      dials: 412
                      connected: 138
                      connectRate: 0.335
                      voicemails: 96
                      inbound: 22
                      outbound: 390
                      talkSeconds: 386
                      avgTalkSeconds: 214
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    From:
      name: from
      in: query
      description: Start of the window, ISO 8601. A window longer than 62 days is clamped.
      schema:
        type: string
        format: date-time
    To:
      name: to
      in: query
      description: End of the window, ISO 8601.
      schema:
        type: string
        format: date-time
    Timezone:
      name: timezone
      in: query
      description: >-
        IANA timezone used to decide which calendar day a record falls on — e.g.
        `Europe/London`. Defaults to `UTC`. Set this whenever you report on a
        day, or a late-evening meeting can land in the wrong one.
      schema:
        type: string
        example: Europe/London
    GroupBy:
      name: groupBy
      in: query
      description: Return a per-bucket breakdown alongside the totals.
      schema:
        type: string
        enum:
          - day
          - week
          - rep
          - campaign
  schemas:
    CallMetrics:
      type: object
      properties:
        window:
          $ref: '#/components/schemas/Window'
        totals:
          $ref: '#/components/schemas/CallTally'
        groupBy:
          type:
            - string
            - 'null'
        groups:
          type: array
          items:
            allOf:
              - type: object
                properties:
                  key:
                    type:
                      - string
                      - 'null'
              - $ref: '#/components/schemas/CallTally'
      required:
        - window
        - totals
    Window:
      type: object
      properties:
        from:
          type: string
          format: date-time
        to:
          type: string
          format: date-time
        timezone:
          type: string
          example: UTC
      required:
        - from
        - to
        - timezone
    CallTally:
      type: object
      properties:
        dials:
          type: integer
        connected:
          type: integer
        connectRate:
          type:
            - number
            - 'null'
          description: >-
            Ratio 0–1, rounded to 4dp. Null when the denominator is zero —
            distinguishable from a genuine 0.
        voicemails:
          type: integer
        inbound:
          type: integer
        outbound:
          type: integer
        talkSeconds:
          type: integer
        avgTalkSeconds:
          type: integer
          description: Averaged over connected calls only.
      required:
        - dials
        - connected
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: Human-readable error message.
            details:
              type:
                - object
                - array
                - string
                - 'null'
              description: Optional structured detail.
          required:
            - message
  responses:
    Unauthorized:
      description: The API key is missing, invalid, or revoked.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: Invalid or revoked API key.
              details: null
    RateLimited:
      description: Too many requests. Retry after the period in the `Retry-After` header.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: Rate limit exceeded. Retry in 42s.
              details: null
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your API key, created in the Leadey dashboard under Settings → API Keys.
        Send it as `Authorization: Bearer leadey_sk_live_…`.

````