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

# The Observe metric catalog (self-describing registry)

> The complete, self-describing metric registry — everything a client (or an LLM holding only an API key + this contract) needs to compose a dashboard WITHOUT any out-of-band knowledge. Each entry names the metric's `unit`/`format` (how to render the number), its `agg`/`grain` (how it is computed), the `dimensions` it accepts as filter lenses, and — critically — its `allowedViz` (the ONLY visualizations this metric may render as; `defaultViz` is the natural pick) and its `target` thresholds.
Two flags gate composition: `requiresCapture` is non-empty ("coming soon") when the metric depends on a data-capture pass not yet emitting — such a metric is discoverable but should be shown disabled, not placed live; `hasDrilldown` says whether `GET /metrics/{id}/calls` will return the conversations behind the number. A widget's `viz` MUST be one of that metric's `allowedViz` or the dashboard write is rejected.
This registry is the general, forward path for analytics — the composable engine behind Observe. The bespoke `/analytics/*` endpoints (getOrgAnalyticsOverview, getOrgAnalyticsByAgent, getOrgAnalyticsTimeseries, getAgentAnalytics) are pre-built, fixed money cards that compute similar numbers; reach for the registry when you want to pick and chart metrics yourself, and for the fixed cards when you just want the ready-made hero numbers.




## OpenAPI

````yaml /openapi.yaml get /metrics/catalog
openapi: 3.1.0
info:
  title: Flowyte V2 Control-Plane REST API
  version: 1.0.0
  description: >-
    The single REST API for the Flowyte platform (base path `/api/v1`).
    Authenticate every request with a secret API key — `Authorization: Bearer
    flowyte_sk_…` — and each operation lists the scope the key must hold.
    Successful responses use the `ApiResponse<T>` envelope; list responses use
    cursor-based `PaginatedResponse<T>`. Errors are RFC 9457 problem+json.
    Streaming endpoints return Server-Sent Events
    (`event:<type>\ndata:<json>\n\n`, terminating with `event: done`).
  contact:
    name: Flowyte Platform
  license:
    name: Proprietary
servers:
  - url: /api/v1
    description: Flowyte control-plane (versioned URI; additive in v1).
security:
  - apiKey: []
tags:
  - name: Agents
    description: The single user-facing entity.
  - name: Support
    description: In-app "Get help" form → support inbox email.
  - name: Skills
    description: >
      Agent capabilities / tools. A skill is ONE atomic action — typically a
      single API call the agent makes in one step (look up an order, create a
      record, send a message, transfer the call). Use a skill when the task is a
      single step. When a task needs several details gathered across turns
      BEFORE acting, build a Playbook (which gathers the inputs and then calls
      skills) — see the Playbooks tag.
  - name: Integrations
    description: Native OAuth integrations.
  - name: Knowledge
    description: RAG knowledge sources & preview.
  - name: Playbooks
    description: >
      Multi-turn conversation scripts — a node graph (gather → confirm → branch)
      the agent follows to collect several inputs IN ORDER across turns before
      acting. Build a playbook when a single skill call isn't enough because the
      agent must gather MANY details first, or run a SEQUENCE of skills, before
      it can finish (e.g. take a full service request: gather the problem,
      address, and time, confirm, THEN file it; qualify a lead; a multi-step
      intake). A playbook does NOT call an integration itself — it owns the
      conversation and holds the state across turns; the actual action is
      performed by the SKILL(s) it gathers the inputs for. So a playbook
      ORCHESTRATES skills. Rule of thumb — one API call → a Skill; "gather N
      things in order, then submit" → a Playbook that drives the conversation
      and calls the skill(s) at the end.
  - name: Variables
    description: >
      The agent-wide interaction-variable registry — DERIVED at read time from
      the agent's playbooks and skills (collect slots, skill output bindings,
      {var} placeholders) and merged with a thin annotation overlay (notes,
      declared type hints, manual declarations). Read-only observation, NEVER a
      gate: it never validates a reference and never affects authoring, publish,
      or runtime behaviour.
  - name: Guardrails
    description: Deterministic guardrail policies & caller verification.
  - name: Numbers
    description: Phone numbers / DIDs.
  - name: SMS
    description: >
      SMS Hub — A2P 10DLC self-serve registration (brand + campaign), the free
      AI compliance review, per-number SMS enablement, and the consent/opt-out
      surface (suppressions, contacts, TCPA proof export). Texting is US-only; a
      number must be SMS-enabled and the org's 10DLC registration active before
      it can send.
  - name: Test
    description: Test, simulate, talk-token, probe.
  - name: Observe
    description: Post-call analytics, conversations, receipts, transcripts.
  - name: Billing
    description: Plans, wallet, usage, fixed phrases.
  - name: Voices
    description: Voice catalog.
  - name: ApiKeys
    description: Developer / API keys.
  - name: Webhooks
    description: Webhook endpoints & deliveries.
  - name: Records
    description: >
      Caller Context Store — pre-synced external records the agent greets a
      caller from, plus the learned object-type field registry. Fed by the
      Zapier app's Create/Update Record action and directly by this REST API;
      read at call time by the context_lookup skill (a sub-100ms local lookup,
      no Zapier round-trip).
  - name: AuditLogs
    description: API/key activity logs.
  - name: Chat
    description: Chat channel — sessions, messages, OpenAI-compatible, widget.
  - name: PublishableKeys
    description: Browser-safe, one-agent publishable keys.
  - name: Widget
    description: Embed widget config + snippet.
  - name: Uploads
    description: Multipart file uploads backing file_id params
  - name: Meta
    description: Platform metadata (language/SKU/tier capabilities).
  - name: Outbound
    description: >
      Outbound voice — contact lists (import + scrub) and campaigns (create,
      launch, pause/resume/cancel). Launch schedules one call attempt per valid
      contact; a background worker dials them. This release dials informational
      campaigns only.
  - name: OAuth2
    description: >
      Flowyte's minimal OAuth2 authorization server. The Flowyte Zapier app is
      the first registered client. The authorization-code grant (confidential
      client, optional PKCE) issues org-scoped SERVICE tokens (flowyte_oat_…)
      that ride the SAME scope matrix as an sk key. The public
      authorize/token/revoke endpoints are served at the ORIGIN ROOT (NOT under
      /api/v1 — see each path's `servers` override); consent + disconnect are
      /api/v1.
paths:
  /metrics/catalog:
    get:
      tags:
        - Observe
      summary: The Observe metric catalog (self-describing registry)
      description: >
        The complete, self-describing metric registry — everything a client (or
        an LLM holding only an API key + this contract) needs to compose a
        dashboard WITHOUT any out-of-band knowledge. Each entry names the
        metric's `unit`/`format` (how to render the number), its `agg`/`grain`
        (how it is computed), the `dimensions` it accepts as filter lenses, and
        — critically — its `allowedViz` (the ONLY visualizations this metric may
        render as; `defaultViz` is the natural pick) and its `target`
        thresholds.

        Two flags gate composition: `requiresCapture` is non-empty ("coming
        soon") when the metric depends on a data-capture pass not yet emitting —
        such a metric is discoverable but should be shown disabled, not placed
        live; `hasDrilldown` says whether `GET /metrics/{id}/calls` will return
        the conversations behind the number. A widget's `viz` MUST be one of
        that metric's `allowedViz` or the dashboard write is rejected.

        This registry is the general, forward path for analytics — the
        composable engine behind Observe. The bespoke `/analytics/*` endpoints
        (getOrgAnalyticsOverview, getOrgAnalyticsByAgent,
        getOrgAnalyticsTimeseries, getAgentAnalytics) are pre-built, fixed money
        cards that compute similar numbers; reach for the registry when you want
        to pick and chart metrics yourself, and for the fixed cards when you
        just want the ready-made hero numbers.
      operationId: getMetricCatalog
      responses:
        '200':
          description: The ordered metric catalog (heroes first).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse_MetricCatalogEntryList'
              example:
                success: true
                data:
                  - id: containment
                    name: Containment rate
                    description: >-
                      Share of conversations the AI handled without a human
                      transfer.
                    category: AI & handover
                    unit: percent
                    unitLabel: '%'
                    format: 0.0%
                    agg: ratio
                    grain: call
                    dimensions:
                      - agent
                      - queue
                      - channel
                      - time
                    allowedViz:
                      - kpi
                      - line
                    defaultViz: kpi
                    priority: 100
                    target:
                      good: 0.8
                      warn: 0.6
                      dir: up
                    requiresCapture: ''
                    liveCapable: true
                    hasDrilldown: true
                  - id: topics
                    name: Topics
                    description: What callers talk about, clustered by theme.
                    category: Voice of customer
                    unit: categorical
                    unitLabel: ''
                    format: '#,##0'
                    agg: categorical
                    grain: call
                    dimensions:
                      - agent
                      - channel
                      - time
                    allowedViz:
                      - columns
                      - table
                    defaultViz: columns
                    priority: 60
                    requiresCapture: ''
                    liveCapable: false
                    hasDrilldown: true
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      security:
        - apiKey:
            - analytics:read
components:
  schemas:
    ApiResponse_MetricCatalogEntryList:
      allOf:
        - $ref: '#/components/schemas/ApiResponseBase'
        - type: object
          required:
            - data
          properties:
            data:
              type: array
              items:
                $ref: '#/components/schemas/MetricCatalogEntry'
    ApiResponseBase:
      type: object
      required:
        - success
      properties:
        success:
          type: boolean
        message:
          type: string
        errors:
          type: array
          items:
            type: object
            required:
              - field
              - message
            properties:
              field:
                type: string
              message:
                type: string
    MetricCatalogEntry:
      type: object
      description: >
        One self-describing metric in the Observe registry (GET
        /metrics/catalog). It is EVERYTHING a client — including an LLM holding
        only an API key + this contract — needs to place the metric on a
        dashboard: how to render it (`unit`/`format`), how it is computed
        (`agg`/`grain`), which filter lenses it accepts (`dimensions`), and the
        ONLY visualizations it may render as (`allowedViz`; `defaultViz` is the
        natural pick). A dashboard widget's `viz` MUST be one of `allowedViz` or
        the write is rejected.
      required:
        - id
        - name
        - description
        - category
        - unit
        - unitLabel
        - format
        - agg
        - grain
        - dimensions
        - allowedViz
        - defaultViz
        - priority
        - liveCapable
        - hasDrilldown
      properties:
        id:
          type: string
          description: >-
            Stable registry id — the value passed as {id} to queryMetric and as
            widget.metricId.
        name:
          type: string
        description:
          type: string
          description: Rich enough for an LLM to decide when to use the metric.
        category:
          type: string
          description: Grouping in the picker (e.g. "AI & handover").
        unit:
          type: string
          enum:
            - percent
            - count
            - seconds
            - ms
            - mss
            - score
            - categorical
            - distribution
            - currency
          description: >-
            How the number is measured — drives rendering. `mss` = a seconds
            value rendered mm:ss; `currency` = cents.
        unitLabel:
          type: string
          description: >-
            Human-readable unit label for compact display next to a value (e.g.
            "m:ss" for `mss`, "%" for percent, "sec" for seconds). Derived from
            `unit`; distinct from `format` (a number-format hint). The
            picker/chip should show this rather than the raw `unit` enum token.
        format:
          type: string
          description: UI number-format hint (e.g. "0.0%", "#,##0", "0 ms", "m:ss").
        agg:
          type: string
          enum:
            - count
            - ratio
            - avg
            - distribution
            - percentile
            - categorical
            - resolution_time
            - after_hours_share
            - after_hours_answer_rate
            - cost_avg
            - cost_sum
            - dollars_saved
            - fcr
            - repeat_caller
            - service_level
            - mos_good_pct
          description: >-
            The aggregate kind. `categorical` groups by a category column (e.g.
            topics by primary_category) into `breakdown[]` rows; `percentile`
            returns per-language OR per-stage rows; `resolution_time` is a
            resolved-only start→finalize percentile; `after_hours_*` split on
            business hours.
        grain:
          type: string
          description: The row grain the metric aggregates (call|turn|gap|...).
        dimensions:
          type: array
          description: >-
            The filter lenses this metric accepts. Passing any other lens to
            queryMetric is a 400. agent and queue, when both present, are
            independent AND-ed lenses.
          items:
            type: string
            enum:
              - agent
              - queue
              - channel
              - time
              - language
        allowedViz:
          type: array
          description: >-
            The ONLY visualizations this metric may render as. A widget.viz
            outside this set is rejected on dashboard write.
          items:
            $ref: '#/components/schemas/WidgetViz'
        defaultViz:
          $ref: '#/components/schemas/WidgetViz'
        priority:
          type: integer
          description: Catalog ordering weight (higher = more prominent).
        target:
          $ref: '#/components/schemas/MetricTarget'
        requiresCapture:
          type: string
          description: >-
            Non-empty ("coming soon") when the metric depends on a data-capture
            pass not yet emitting: discoverable but should be shown disabled,
            not placed live. Empty = fully live.
        liveCapable:
          type: boolean
          description: >-
            Whether the metric can include in-flight (not-yet-terminated)
            conversations for a live tile.
        hasDrilldown:
          type: boolean
          description: >-
            Whether GET /metrics/{id}/calls returns the conversations behind the
            number.
    ProblemDetails:
      description: RFC 9457 problem+json.
      type: object
      properties:
        type:
          type: string
          format: uri
          default: about:blank
        title:
          type: string
        status:
          type: integer
        detail:
          type: string
        instance:
          type: string
        code:
          type: string
        errors:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
              message:
                type: string
    WidgetViz:
      type: string
      enum:
        - kpi
        - line
        - columns
        - donut
        - leaderboard
        - insight
        - table
        - presence
        - timeline
        - jumbo
        - queues
      description: >
        A visualization kind. A widget may only use a viz in its metric's
        allowedViz. `jumbo` is the wallboard 52px KPI tile (ok/breach states
        derived from the metric's target); `queues` is the per-queue chip strip
        (the metric compiled once per queue via the queue lens); `presence` is
        the live seat grid; `timeline` is the per-seat time-in-status view.
        Layout note: dashboards mirror the mock's 20-column grid — a widget's
        `span` is its width in those columns (2..20).
    MetricTarget:
      type: object
      description: Tile thresholds and which direction is "good".
      required:
        - dir
      properties:
        good:
          type: number
        warn:
          type: number
        dir:
          type: string
          enum:
            - up
            - down
          description: Whether a higher or lower value is better.
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      headers:
        WWW-Authenticate:
          schema:
            type: string
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
    Forbidden:
      description: Org mismatch / RLS / insufficient scope / origin not allowed.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
  securitySchemes:
    apiKey:
      type: oauth2
      description: >
        Flowyte secret API key (`Authorization: Bearer flowyte_sk_live_…`).
        Scope-gated; is scoped to your organization — a key can never reach
        another tenant. The listed scopes in each operation's `apiKey`
        requirement are the scopes that key must hold. The `tokenUrl` is
        nominal: keys are minted in the dashboard.
      flows:
        clientCredentials:
          tokenUrl: /api/v1/api-keys
          scopes:
            agents:read: Read agents.
            agents:write: Create/update/delete agents, publish, rollback.
            knowledge:read: Read knowledge sources & preview.
            knowledge:write: Add/remove knowledge sources, uploads.
            skills:read: Read skills & skill-types.
            skills:write: Create/update/delete skills.
            playbooks:read: Read playbooks & graphs.
            playbooks:write: Create/update/delete playbooks & graphs.
            guardrails:read: Read guardrail policies & caller-verification.
            guardrails:write: Update guardrail policies & caller-verification.
            numbers:read: Read phone numbers / search availability.
            numbers:write: Purchase / assign / release numbers.
            sms:read: Read the org's SMS (10DLC) registration status and numbers.
            sms:write: Save/submit the 10DLC registration and toggle numbers for SMS.
            outbound:read: Read outbound contact lists and campaigns.
            outbound:write: >-
              Create/import contact lists, create/launch/pause/resume/cancel
              outbound campaigns, and enqueue single outbound calls.
            integrations:read: Read connected native integrations (status only — never tokens).
            integrations:write: Discover schemas, set data scoping, and disconnect a connection.
            integrations:connect: >-
              Connect a data source (submit credentials / begin OAuth) — a
              SEPARATE, higher-privilege scope because connecting INGESTS
              credentials and opens a new egress path; a discover/scope/author
              key need not carry it.
            records:read: >-
              Read the pre-synced Caller Context Store records and object-type
              field registry.
            records:write: >-
              Upsert / delete / bulk-import / purge caller-context records and
              edit type metadata.
            calls:read: Read conversations, receipts, transcripts, analytics.
            analytics:read: >-
              Read the Observe history list, per-agent analytics (the
              answer-rate summary), the raw knowledge-gap list, and the metric
              catalog + per-metric queries + metric drill-downs.
            analytics:write: >-
              Curate knowledge gaps (dismiss / mark in-progress). [M4 —
              reserved]
            dashboards:read: List and read saved Observe reporting dashboards.
            dashboards:write: >-
              Create, update (full-document replace), and delete Observe
              reporting dashboards.
            reports:read: List and read Observe scheduled reports (report schedules).
            reports:write: >-
              Create, update, and delete Observe scheduled reports (a delete
              stops a recurring digest).
            billing:read: Read plans, wallet, usage.
            audit:read: Read API/key activity logs.
            webhooks:write: Manage webhook endpoints.
            keys:write: Manage secret API keys.
            chat:read: Read chat sessions & messages.
            chat:write: Create chat sessions & send messages (server-side).
            widgets:read: Read widget config & embed snippet.
            widgets:write: Update widget config.
            pubkeys:read: Read publishable keys.
            pubkeys:write: Manage publishable keys.
            phone:read: >-
              Read Flowyte Phone config — settings, ring targets/queues +
              rosters, contacts, block-list, own presence.
            phone:write: >-
              Update Flowyte Phone config — settings, ring targets/queues +
              members, contacts, block-list.
            presence:write: Set your own softphone presence (available/away/dnd/…).
            team:read: Read the team — softphone seats and the team presence roster.
            team:write: >-
              Manage softphone seats — invite, update, and deactivate team
              members.
            escalation_destinations:read: Read external-agent (AI Harness) escalation destinations.
            escalation_destinations:write: >-
              Create, update, delete, and rotate the signing secret of
              escalation destinations.
            escalation_policies:read: Read an agent's escalation routing policy. [ — reserved]
            escalation_policies:write: Update an agent's escalation routing policy. [ — reserved]
            escalations:read: >-
              Read escalation sessions and their message history (connector). [
              — reserved]
            escalations:claim: >-
              Claim an escalation session and extend its lease (connector). [ —
              reserved]
            escalations:respond: >-
              Post messages into a claimed escalation session (connector). [ —
              reserved]
            escalations:resolve: >-
              Resolve, return, or request human takeover of an escalation
              (connector). [ — reserved]

````