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

# Aggregate pipeline metrics

> SQL-computed analytics over your event data, for BI tools and dashboards.

Aggregate analytics computed by SQL over the event data, not by LLMs: stage velocity, pipeline distribution, quarterly trends, and per-actor patterns. Designed to feed BI tools and dashboards. See [Core Concepts → Pattern Metrics](/core-concepts#pattern-metrics) for what each array means.


## OpenAPI

````yaml openapi.yaml GET /v1/patterns/metrics
openapi: 3.1.0
info:
  title: Seyn API
  version: 1.0.0
  description: >
    Programmatic access to Seyn for your organization.


    - **Ingest** data from any source with the Ingestion endpoints (requires a
    key with the `ingest` scope).

    - **Read** extracted process knowledge: search, rules, libraries,
    provenance, and metrics.


    Authenticate with a bearer API key (`sk_live_*`); each key is scoped to a
    single organization.
  contact:
    name: Seyn Support
    email: support@seynlabs.com
    url: https://seynlabs.com
servers:
  - url: https://api.seynlabs.com
    description: Production
  - url: https://api-dev.seynlabs.com
    description: Staging
security:
  - bearerAuth: []
tags:
  - name: Ingestion
    description: >-
      Push data into Seyn from any source: register a custom source and stream
      records to it
  - name: Knowledge
    description: Natural-language search over extracted knowledge
  - name: Rules
    description: Process rules, the atomic knowledge units extracted by the pipeline
  - name: Libraries
    description: Versioned snapshots of extracted knowledge for your organization
  - name: Patterns
    description: Aggregate pipeline analytics
paths:
  /v1/patterns/metrics:
    get:
      tags:
        - Patterns
      summary: Aggregate pipeline metrics
      operationId: patternsMetrics
      responses:
        '200':
          description: Pattern metrics blob.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessEnvelope_PatternMetrics'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    SuccessEnvelope_PatternMetrics:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          $ref: '#/components/schemas/PatternMetrics'
        meta:
          $ref: '#/components/schemas/Meta'
      required:
        - success
        - data
        - meta
    PatternMetrics:
      type: object
      description: Aggregate pipeline analytics blob.
      properties:
        stageVelocity:
          type: array
          items:
            type: object
            properties:
              stage:
                type: string
              medianDays:
                type: number
              p90Days:
                type: number
              transitions:
                type: integer
        pipelineDistribution:
          type: array
          items:
            type: object
            properties:
              stage:
                type: string
              activeDeals:
                type: integer
        killPrecursors:
          type: array
          items:
            type: object
            properties:
              stage:
                type: string
              killCount:
                type: integer
        quarterlyTrend:
          type: array
          items:
            type: object
            properties:
              quarter:
                type: string
              avgCycleDays:
                type: number
              dealCount:
                type: integer
        quarterlyKillTrend:
          type: array
          items:
            type: object
            properties:
              quarter:
                type: string
              killCount:
                type: integer
              totalDeals:
                type: integer
              killRatePct:
                type: number
        actorPatterns:
          type: array
          items:
            type: object
            properties:
              actorName:
                type: string
              dealCount:
                type: integer
              deadDeals:
                type: integer
              killRatePct:
                type: number
              avgCycleDays:
                type: number
        totalDeals:
          type: integer
        totalDeadDeals:
          type: integer
        dataSpan:
          type: object
          properties:
            earliestEvent:
              type: string
            latestEvent:
              type: string
            totalEvents:
              type: integer
      required:
        - stageVelocity
        - pipelineDistribution
        - killPrecursors
        - quarterlyTrend
        - quarterlyKillTrend
        - actorPatterns
        - totalDeals
        - totalDeadDeals
        - dataSpan
    Meta:
      type: object
      properties:
        requestId:
          type: string
          description: Per-request UUID; quote in support tickets.
      additionalProperties: true
      required:
        - requestId
    ErrorBody:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - MISSING_AUTH_HEADER
                - INVALID_API_KEY
                - KEY_REVOKED
                - RATE_LIMITED
                - NOT_FOUND
                - LIBRARY_NOT_FOUND
                - SOURCE_NOT_FOUND
                - VALIDATION_ERROR
                - INSUFFICIENT_SCOPE
                - PAYLOAD_TOO_LARGE
                - INTERNAL_ERROR
            message:
              type: string
          required:
            - code
            - message
      required:
        - success
        - error
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          examples:
            missing:
              summary: No Authorization header
              value:
                success: false
                error:
                  code: MISSING_AUTH_HEADER
                  message: 'Authorization: Bearer <api-key> header is required'
            invalid:
              summary: Unrecognized key
              value:
                success: false
                error:
                  code: INVALID_API_KEY
                  message: API key is invalid or unrecognized
    Forbidden:
      description: API key was revoked.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          examples:
            revoked:
              value:
                success: false
                error:
                  code: KEY_REVOKED
                  message: API key has been revoked
    RateLimited:
      description: Per-key rate limit exceeded (default 60 req/min/key).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          examples:
            rateLimited:
              value:
                success: false
                error:
                  code: RATE_LIMITED
                  message: Rate limit exceeded for this API key
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: sk_live_*
      description: |
        Bearer token from `app.seynlabs.com` → Settings → API Keys.
        Send as `Authorization: Bearer sk_live_...`.

````