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

# Get metrics

> The figures of a period for your subaccount or one of its agents. The period is made of calendar days in Europe/Madrid, both included, up to today and at most 92 days; without from and to, the last 7 days. leads follows the leads that came in during the period and how far each one got, as Analysis does in the dashboard; the other figures count what happened in those days. Filter by text_agent_id or voice_agent_id, not both. When you filter by text_agent_id, new_leads_by_channel, conversations, calls and call_minutes also include the activity of the voice agents that share that text agent's leads, while leads and median_first_response_seconds do not. Figures can be a few minutes old.



## OpenAPI

````yaml /openapi.yaml get /metrics
openapi: 3.1.0
info:
  title: NewLead API
  version: 1.0.0
  description: >-
    The NewLead public API. Each API key belongs to one subaccount and can read
    and change only that subaccount's data. Errors, pagination, idempotency and
    rate limits are documented at https://docs.newlead.ai.
servers:
  - url: https://rest.newlead.ai/v1
security:
  - BearerAuth: []
  - ApiKeyHeader: []
tags:
  - name: Account
    description: >-
      The account and subaccount of the API key, and the subaccount's wallet
      balance.
  - name: Metrics
    description: >-
      Counts of leads, conversations and calls for a period, as in the
      dashboard.
  - name: Text agents
    description: >-
      Your WhatsApp, Instagram and web chat agents, their templates, lead fields
      and qualification questions.
  - name: Leads
    description: >-
      The people your agents talk to. Create, update, search and pause the AI
      for each one.
  - name: Messages
    description: >-
      Send text and WhatsApp templates, read the conversation and download
      attachments.
  - name: Voice agents
    description: Your voice agents.
  - name: Calls
    description: >-
      Have a voice agent call a phone number, and read calls, transcripts and
      recordings.
  - name: Webhooks
    description: Endpoints that receive your agents' events.
  - name: Properties
    description: The property catalog your agents offer.
  - name: Specification
    description: This document.
paths:
  /metrics:
    get:
      tags:
        - Metrics
      summary: Get metrics
      description: >-
        The figures of a period for your subaccount or one of its agents. The
        period is made of calendar days in Europe/Madrid, both included, up to
        today and at most 92 days; without from and to, the last 7 days. leads
        follows the leads that came in during the period and how far each one
        got, as Analysis does in the dashboard; the other figures count what
        happened in those days. Filter by text_agent_id or voice_agent_id, not
        both. When you filter by text_agent_id, new_leads_by_channel,
        conversations, calls and call_minutes also include the activity of the
        voice agents that share that text agent's leads, while leads and
        median_first_response_seconds do not. Figures can be a few minutes old.
      operationId: getMetrics
      parameters:
        - name: from
          in: query
          required: false
          description: First day, YYYY-MM-DD. Defaults to 6 days before to.
          schema:
            type: string
            format: date
        - name: to
          in: query
          required: false
          description: >-
            Last day, YYYY-MM-DD, no later than today in Europe/Madrid. Defaults
            to today.
          schema:
            type: string
            format: date
        - name: text_agent_id
          in: query
          required: false
          description: >-
            Only this text agent. Its calls are those of the voice agents that
            share its leads.
          schema:
            type: string
            format: uuid
        - name: voice_agent_id
          in: query
          required: false
          description: >-
            Only this voice agent. If it shares its leads with a text agent,
            new_leads_by_channel, conversations, calls and call_minutes are
            null: filter by that text agent for them.
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: The figures.
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Metrics'
        '429':
          $ref: '#/components/responses/RateLimited'
        4XX:
          $ref: '#/components/responses/Error'
        5XX:
          $ref: '#/components/responses/Error'
components:
  headers:
    X-Request-ID:
      description: The id of this request. Quote it when you contact support.
      schema:
        type: string
    RateLimit-Limit:
      description: Requests allowed per minute for this API key.
      schema:
        type: integer
    RateLimit-Remaining:
      description: Requests left in the current minute.
      schema:
        type: integer
    RateLimit-Reset:
      description: Seconds until the counter resets.
      schema:
        type: integer
    Retry-After:
      description: Seconds to wait before repeating the request.
      schema:
        type: integer
    Idempotent-Replayed:
      description: true when the response is the stored one for a repeated Idempotency-Key.
      schema:
        type: string
        const: 'true'
  schemas:
    Metrics:
      type: object
      additionalProperties: false
      required:
        - object
        - from
        - to
        - timezone
        - text_agent_id
        - voice_agent_id
        - leads
        - median_first_response_seconds
        - new_leads_by_channel
        - conversations
        - calls
        - call_minutes
      properties:
        object:
          type: string
          const: metrics
        from:
          type: string
          format: date
          description: First day of the period, included.
        to:
          type: string
          format: date
          description: Last day of the period, included.
        timezone:
          type: string
          const: Europe/Madrid
          description: The days are calendar days in this time zone, as in the dashboard.
        text_agent_id:
          type:
            - string
            - 'null'
          format: uuid
          description: The text agent the figures are filtered by, or null.
        voice_agent_id:
          type:
            - string
            - 'null'
          format: uuid
          description: The voice agent the figures are filtered by, or null.
        leads:
          type: object
          additionalProperties: false
          required:
            - new
            - contacted
            - replied
            - qualified
            - with_appointment
          description: >-
            The leads that came in during the period and how far each one got,
            at any time up to now, as in Analysis in the dashboard. Deleted and
            test leads are left out.
          properties:
            new:
              type: integer
              description: Leads that came in.
            contacted:
              type: integer
              description: >-
                Of those, the ones that got a first message or a call from the
                agent.
            replied:
              type: integer
              description: Of the contacted, the ones that answered.
            qualified:
              type:
                - integer
                - 'null'
              description: >-
                Of those who replied, the ones that completed the qualification
                or booked an appointment. null when no agent with leads in the
                period requires the qualification before booking.
            with_appointment:
              type: integer
              description: >-
                Of those who replied, the ones with at least one appointment
                booked by the agent.
        median_first_response_seconds:
          type:
            - integer
            - 'null'
          description: >-
            Median seconds from a lead coming in to the agent's first message or
            call, over the contacted leads. null with none.
        new_leads_by_channel:
          type:
            - array
            - 'null'
          description: >-
            Every lead created in the period by where it came from, most first,
            as in the agency's client results. Unlike leads.new it also counts
            leads deleted later. null when the figures are filtered by a voice
            agent that shares its leads with a text agent.
          items:
            type: object
            additionalProperties: false
            required:
              - channel
              - count
            properties:
              channel:
                type: string
                enum:
                  - whatsapp
                  - instagram
                  - webchat
                  - meta_lead_form
                  - gmail
                  - outlook
                  - manual
                  - other
              count:
                type: integer
        conversations:
          type:
            - integer
            - 'null'
          description: >-
            Billable conversations that started in the period: one per lead and
            text agent in each billing period, as usage counts them. null before
            measurement began or when filtered by a voice agent that shares its
            leads with a text agent.
        calls:
          type:
            - integer
            - 'null'
          description: >-
            Calls that started in the period, inbound and outbound, answered or
            not. null in the same cases as conversations.
        call_minutes:
          type:
            - number
            - 'null'
          description: Minutes of those calls. null in the same cases as conversations.
      examples:
        - object: metrics
          from: '2026-11-21'
          to: '2026-11-27'
          timezone: Europe/Madrid
          text_agent_id: null
          voice_agent_id: null
          leads:
            new: 120
            contacted: 112
            replied: 64
            qualified: 31
            with_appointment: 12
          median_first_response_seconds: 38
          new_leads_by_channel:
            - channel: whatsapp
              count: 80
            - channel: meta_lead_form
              count: 40
          conversations: 97
          calls: 14
          call_minutes: 52.5
    ErrorResponse:
      type: object
      additionalProperties: false
      required:
        - error
      properties:
        error:
          type: object
          additionalProperties: false
          required:
            - type
            - code
            - message
            - param
            - request_id
            - doc_url
          properties:
            type:
              $ref: '#/components/schemas/ErrorType'
            code:
              $ref: '#/components/schemas/ErrorCode'
            message:
              type: string
              description: 'A human-readable explanation. It can change: never match on it.'
            param:
              type:
                - string
                - 'null'
              description: The offending field, dot-separated (variables.city), or null.
            request_id:
              type: string
              description: The same value as the x-request-id header.
            doc_url:
              type: string
              format: uri
            details:
              type: object
              additionalProperties: true
              description: >-
                On agent_not_ready, carries blockers. On send_outcome_unknown
                from POST /calls, carries call_id if the call is known.
      examples:
        - error:
            type: invalid_request_error
            code: parameter_invalid
            message: phone must match pattern "^\+[1-9]\d{6,14}$".
            param: phone
            request_id: req_m3k2a9_4f1c2b7e
            doc_url: https://docs.newlead.ai/errors#parameter_invalid
    ErrorType:
      type: string
      enum:
        - invalid_request_error
        - authentication_error
        - billing_error
        - permission_error
        - not_found_error
        - conflict_error
        - rate_limit_error
        - api_error
        - provider_error
    ErrorCode:
      type: string
      description: >-
        The closed list of error causes. The table is at
        https://docs.newlead.ai/errors.
      enum:
        - parameter_missing
        - parameter_invalid
        - parameter_unknown
        - body_invalid_json
        - recipient_invalid
        - api_key_missing
        - api_key_invalid
        - insufficient_balance
        - subscription_inactive
        - api_key_forbidden
        - feature_disabled
        - resource_not_found
        - route_not_found
        - agent_not_ready
        - lead_do_not_contact
        - lead_ai_paused
        - messaging_window_closed
        - template_not_approved
        - outside_initiation_hours
        - voice_number_missing
        - webhook_endpoint_limit_reached
        - webhook_endpoint_disabled
        - idempotency_key_reused
        - idempotency_key_in_use
        - rate_limit_exceeded
        - internal_error
        - provider_unavailable
        - media_unavailable
        - send_outcome_unknown
  responses:
    RateLimited:
      description: Too many requests for this API key. Wait for Retry-After and repeat.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Error:
      description: An error. type is the family and code is the cause.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        RateLimit-Limit:
          $ref: '#/components/headers/RateLimit-Limit'
        RateLimit-Remaining:
          $ref: '#/components/headers/RateLimit-Remaining'
        RateLimit-Reset:
          $ref: '#/components/headers/RateLimit-Reset'
        Retry-After:
          $ref: '#/components/headers/Retry-After'
        Idempotent-Replayed:
          $ref: '#/components/headers/Idempotent-Replayed'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        The API key, created in Settings › API keys, in the header
        Authorization: Bearer <key>. The default.
    ApiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: The same key, in the x-api-key header. Still accepted.

````

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