> ## 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.

# Pipeline value

> Open, won and lost value with probability-weighted forecast, broken down by stage, pipeline and owner. Totals are reported **per currency** — a figure mixing GBP and USD would be meaningless. Accepts the same filters as `GET /opportunities`.



## OpenAPI

````yaml /openapi.json get /metrics/pipeline
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/pipeline:
    get:
      tags:
        - Metrics
      summary: Pipeline value
      description: >-
        Open, won and lost value with probability-weighted forecast, broken down
        by stage, pipeline and owner. Totals are reported **per currency** — a
        figure mixing GBP and USD would be meaningless. Accepts the same filters
        as `GET /opportunities`.
      operationId: getPipelineMetrics
      parameters:
        - name: pipelineId
          in: query
          description: Restrict to one pipeline.
          schema:
            type: string
        - name: stageId
          in: query
          description: Restrict to one stage.
          schema:
            type: string
        - name: status
          in: query
          description: Restrict to a stage type.
          schema:
            type: string
            enum:
              - open
              - won
              - lost
        - name: ownerId
          in: query
          description: Restrict to one owner.
          schema:
            type: string
        - name: currency
          in: query
          description: Restrict to one currency.
          schema:
            type: string
        - name: createdFrom
          in: query
          description: Created on or after.
          schema:
            type: string
            format: date-time
        - name: createdTo
          in: query
          description: Created on or before.
          schema:
            type: string
            format: date-time
        - name: closedFrom
          in: query
          description: Closed on or after.
          schema:
            type: string
            format: date-time
        - name: closedTo
          in: query
          description: Closed on or before.
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/PipelineMetrics'
              example:
                data:
                  totalCount: 138
                  open:
                    - currency: GBP
                      count: 138
                      value: '15000.50'
                      weightedValue: '8500.45'
                  won:
                    - currency: GBP
                      count: 138
                      value: '15000.50'
                      weightedValue: '8500.45'
                  lost:
                    - currency: GBP
                      count: 138
                      value: '15000.50'
                      weightedValue: '8500.45'
                  byStage:
                    - stageId: stg_negotiation
                      label: Send the revised pricing sheet
                      slug: northwind-logistics
                      type: open
                      pipelineId: pl_default
                      sortOrder: 3
                      totals:
                        - currency: GBP
                          count: 138
                          value: '15000.50'
                          weightedValue: '8500.45'
                  byPipeline:
                    - pipelineId: pl_default
                      totals:
                        - currency: GBP
                          count: 138
                          value: '15000.50'
                          weightedValue: '8500.45'
                  byOwner:
                    - ownerId: user_2pXn4Rk
                      totals:
                        - currency: GBP
                          count: 138
                          value: '15000.50'
                          weightedValue: '8500.45'
                  winRate: 0.706
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    PipelineMetrics:
      type: object
      properties:
        totalCount:
          type: integer
        open:
          type: array
          items:
            $ref: '#/components/schemas/CurrencyTotal'
          description: 'Forecast: open deals only.'
        won:
          type: array
          items:
            $ref: '#/components/schemas/CurrencyTotal'
        lost:
          type: array
          items:
            $ref: '#/components/schemas/CurrencyTotal'
        byStage:
          type: array
          items:
            type: object
            properties:
              stageId:
                type: string
              label:
                type: string
              slug:
                type: string
              type:
                type: string
                enum:
                  - open
                  - won
                  - lost
              pipelineId:
                type: string
              sortOrder:
                type: integer
              totals:
                type: array
                items:
                  $ref: '#/components/schemas/CurrencyTotal'
        byPipeline:
          type: array
          items:
            type: object
            properties:
              pipelineId:
                type: string
              totals:
                type: array
                items:
                  $ref: '#/components/schemas/CurrencyTotal'
        byOwner:
          type: array
          items:
            type: object
            properties:
              ownerId:
                type:
                  - string
                  - 'null'
              totals:
                type: array
                items:
                  $ref: '#/components/schemas/CurrencyTotal'
        winRate:
          type:
            - number
            - 'null'
          description: won / (won + lost) across closed deals in the set.
      required:
        - totalCount
        - open
        - won
        - lost
    CurrencyTotal:
      type: object
      description: >-
        A total for ONE currency. Values are never summed across currencies —
        see the Metrics guide.
      properties:
        currency:
          type: string
          example: GBP
        count:
          type: integer
        value:
          type: string
          description: >-
            Decimal string with 2 places. A string, not a number, so no
            precision is lost in transit.
          example: '15000.50'
        weightedValue:
          type: string
          description: Value × each deal's own probability, summed. The forecast figure.
          example: '8500.45'
      required:
        - currency
        - value
    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_…`.

````