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

# Get a metric definition

> Fetch a single metric definition by its UUID or its stable `slug` (e.g. `customer_satisfaction`). Resolution is scoped to the project — a project-owned metric wins over an org-wide one, which wins over a system metric of the same `slug`.



## OpenAPI

````yaml /api-reference/openapi.documented.json get /v1/metric/definitions/{idOrSlug}
openapi: 3.1.0
info:
  title: Roark Analytics API
  description: >-
    The Roark Analytics API gives you access to the same API that powers the
    award winning Roark Analytics platform.
  version: 1.0.0
servers:
  - description: Production
    url: https://api.roark.ai
security:
  - Bearer: []
tags:
  - name: Agent
  - name: Agent Endpoint
  - name: Call
  - name: Chat
  - name: Metric
  - name: Metric Policy
  - name: Metric Collection Job
  - name: Simulation Persona
  - name: Simulation Scenario
  - name: Simulation Run Plan
  - name: Simulation Run Plan Job
  - name: Simulation Job
  - name: HTTP Request Definition
  - name: Webhook
  - name: Issue
  - name: Knowledge Base
  - name: Call Analysis
  - name: Health
paths:
  /v1/metric/definitions/{idOrSlug}:
    get:
      tags:
        - Metric
      summary: Get a metric definition
      description: >-
        Fetch a single metric definition by its UUID or its stable `slug` (e.g.
        `customer_satisfaction`). Resolution is scoped to the project — a
        project-owned metric wins over an org-wide one, which wins over a system
        metric of the same `slug`.
      operationId: getV1MetricDefinitionsByIdOrSlug
      parameters:
        - name: idOrSlug
          in: path
          required: true
          description: >-
            The metric definition's Roark ID (UUID) or its stable `slug` (e.g.
            `customer_satisfaction`).
          schema:
            type: string
      responses:
        '200':
          description: The metric definition
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/MetricDefinitionResponse'
                required:
                  - data
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Authentication error
              example:
                type: authentication
                code: unauthorized
                message: Authentication required
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Permission error
              example:
                type: forbidden
                code: permission_denied
                message: You do not have permission to access this resource
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Not found error
              example:
                type: not_found
                code: resource_not_found
                message: The requested resource could not be found
          description: Not Found
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Rate limit error
              example:
                type: rate_limit
                code: too_many_requests
                message: Rate limit exceeded
          description: Too Many Requests
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
                description: Server error
              example:
                type: internal
                code: internal_error
                message: Internal server error
          description: Internal Server Error
components:
  schemas:
    MetricDefinitionResponse:
      oneOf:
        - $ref: '#/components/schemas/LlmJudgeMetricResponse'
        - $ref: '#/components/schemas/ProviderMetricResponse'
        - $ref: '#/components/schemas/ThresholdMetricResponse'
        - $ref: '#/components/schemas/FormulaMetricResponse'
        - $ref: '#/components/schemas/PatternMetricResponse'
      discriminator:
        propertyName: calculationType
        mapping:
          LLM_JUDGE:
            $ref: '#/components/schemas/LlmJudgeMetricResponse'
          PROVIDER:
            $ref: '#/components/schemas/ProviderMetricResponse'
          THRESHOLD:
            $ref: '#/components/schemas/ThresholdMetricResponse'
          FORMULA:
            $ref: '#/components/schemas/FormulaMetricResponse'
          PATTERN:
            $ref: '#/components/schemas/PatternMetricResponse'
      description: Metric definition data. The variant is selected by `calculationType`.
    ErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - validation
            - authentication
            - forbidden
            - not_found
            - conflict
            - rate_limit
            - internal
          description: The error type category
          examples:
            - validation
            - authentication
        code:
          type: string
          description: Machine-readable error code identifier
          examples:
            - invalid_parameter
            - missing_required_field
            - unauthorized
        message:
          type: string
          description: Human-readable error message
          examples:
            - The request was invalid
            - Authentication required
        param:
          type: string
          description: The parameter that caused the error (if applicable)
          examples:
            - email
            - user_id
        details:
          description: Additional error context information
      required:
        - type
        - code
        - message
    LlmJudgeMetricResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the metric definition
        slug:
          type: string
          description: Stable metric slug (e.g. "call_reason", "customer_satisfaction")
        metricId:
          type: string
          description: >-
            Alias of `slug` retained for backwards compatibility. Same value as
            `slug`.
        variantId:
          type: string
          format: uuid
          description: >-
            The resolved variant this response reflects (org-scoped Default if
            the org has customized it, otherwise the system Default). Pass this
            as sourceVariantId when building a derived metric off this one to
            pin the exact config.
        versionId:
          type: string
          format: uuid
          description: >-
            The variant's current version. Immutable snapshot of the config —
            editing the metric produces a new versionId. Use it to detect config
            changes.
        name:
          type: string
          description: Name of the metric
        description:
          type: string
          description: Description of what the metric measures
        type:
          type: string
          enum:
            - COUNT
            - NUMERIC
            - BOOLEAN
            - SCALE
            - TEXT
            - CLASSIFICATION
            - OFFSET
          description: Type of value this metric produces
        scope:
          type: string
          enum:
            - GLOBAL
            - PER_PARTICIPANT
          description: Whether metric is global or per-participant
        supportedContexts:
          type: array
          items:
            type: string
            enum:
              - CALL
              - SEGMENT
              - TURN
          description: Which levels this metric can produce values at
        unit:
          type: object
          properties:
            name:
              type: string
              description: Name of the unit
            symbol:
              type:
                - string
                - 'null'
              description: Symbol for the unit
          required:
            - name
            - symbol
          description: Unit information if applicable
        calculationType:
          type: string
          const: LLM_JUDGE
          description: Metric evaluated by an LLM against a prompt.
      required:
        - id
        - slug
        - metricId
        - variantId
        - versionId
        - name
        - description
        - type
        - scope
        - supportedContexts
        - calculationType
      title: LLM judge metric
    ProviderMetricResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the metric definition
        slug:
          type: string
          description: Stable metric slug (e.g. "call_reason", "customer_satisfaction")
        metricId:
          type: string
          description: >-
            Alias of `slug` retained for backwards compatibility. Same value as
            `slug`.
        variantId:
          type: string
          format: uuid
          description: >-
            The resolved variant this response reflects (org-scoped Default if
            the org has customized it, otherwise the system Default). Pass this
            as sourceVariantId when building a derived metric off this one to
            pin the exact config.
        versionId:
          type: string
          format: uuid
          description: >-
            The variant's current version. Immutable snapshot of the config —
            editing the metric produces a new versionId. Use it to detect config
            changes.
        name:
          type: string
          description: Name of the metric
        description:
          type: string
          description: Description of what the metric measures
        type:
          type: string
          enum:
            - COUNT
            - NUMERIC
            - BOOLEAN
            - SCALE
            - TEXT
            - CLASSIFICATION
            - OFFSET
          description: Type of value this metric produces
        scope:
          type: string
          enum:
            - GLOBAL
            - PER_PARTICIPANT
          description: Whether metric is global or per-participant
        supportedContexts:
          type: array
          items:
            type: string
            enum:
              - CALL
              - SEGMENT
              - TURN
          description: Which levels this metric can produce values at
        unit:
          type: object
          properties:
            name:
              type: string
              description: Name of the unit
            symbol:
              type:
                - string
                - 'null'
              description: Symbol for the unit
          required:
            - name
            - symbol
          description: Unit information if applicable
        calculationType:
          type: string
          const: PROVIDER
          description: System-managed metric produced by an analysis provider.
      required:
        - id
        - slug
        - metricId
        - variantId
        - versionId
        - name
        - description
        - type
        - scope
        - supportedContexts
        - calculationType
      title: Provider metric
    ThresholdMetricResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the metric definition
        slug:
          type: string
          description: Stable metric slug (e.g. "call_reason", "customer_satisfaction")
        metricId:
          type: string
          description: >-
            Alias of `slug` retained for backwards compatibility. Same value as
            `slug`.
        variantId:
          type: string
          format: uuid
          description: >-
            The resolved variant this response reflects (org-scoped Default if
            the org has customized it, otherwise the system Default). Pass this
            as sourceVariantId when building a derived metric off this one to
            pin the exact config.
        versionId:
          type: string
          format: uuid
          description: >-
            The variant's current version. Immutable snapshot of the config —
            editing the metric produces a new versionId. Use it to detect config
            changes.
        name:
          type: string
          description: Name of the metric
        description:
          type: string
          description: Description of what the metric measures
        type:
          type: string
          enum:
            - COUNT
            - NUMERIC
            - BOOLEAN
            - SCALE
            - TEXT
            - CLASSIFICATION
            - OFFSET
          description: Type of value this metric produces
        scope:
          type: string
          enum:
            - GLOBAL
            - PER_PARTICIPANT
          description: Whether metric is global or per-participant
        supportedContexts:
          type: array
          items:
            type: string
            enum:
              - CALL
              - SEGMENT
              - TURN
          description: Which levels this metric can produce values at
        unit:
          type: object
          properties:
            name:
              type: string
              description: Name of the unit
            symbol:
              type:
                - string
                - 'null'
              description: Symbol for the unit
          required:
            - name
            - symbol
          description: Unit information if applicable
        calculationType:
          type: string
          const: THRESHOLD
          description: >-
            Boolean metric derived by comparing a source metric against a
            threshold.
        threshold:
          $ref: '#/components/schemas/ThresholdMetricDetails'
          description: Threshold configuration.
      required:
        - id
        - slug
        - metricId
        - variantId
        - versionId
        - name
        - description
        - type
        - scope
        - supportedContexts
        - calculationType
      title: Threshold metric
    FormulaMetricResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the metric definition
        slug:
          type: string
          description: Stable metric slug (e.g. "call_reason", "customer_satisfaction")
        metricId:
          type: string
          description: >-
            Alias of `slug` retained for backwards compatibility. Same value as
            `slug`.
        variantId:
          type: string
          format: uuid
          description: >-
            The resolved variant this response reflects (org-scoped Default if
            the org has customized it, otherwise the system Default). Pass this
            as sourceVariantId when building a derived metric off this one to
            pin the exact config.
        versionId:
          type: string
          format: uuid
          description: >-
            The variant's current version. Immutable snapshot of the config —
            editing the metric produces a new versionId. Use it to detect config
            changes.
        name:
          type: string
          description: Name of the metric
        description:
          type: string
          description: Description of what the metric measures
        type:
          type: string
          enum:
            - COUNT
            - NUMERIC
            - BOOLEAN
            - SCALE
            - TEXT
            - CLASSIFICATION
            - OFFSET
          description: Type of value this metric produces
        scope:
          type: string
          enum:
            - GLOBAL
            - PER_PARTICIPANT
          description: Whether metric is global or per-participant
        supportedContexts:
          type: array
          items:
            type: string
            enum:
              - CALL
              - SEGMENT
              - TURN
          description: Which levels this metric can produce values at
        unit:
          type: object
          properties:
            name:
              type: string
              description: Name of the unit
            symbol:
              type:
                - string
                - 'null'
              description: Symbol for the unit
          required:
            - name
            - symbol
          description: Unit information if applicable
        calculationType:
          type: string
          const: FORMULA
          description: Metric computed by evaluating an expression over other metrics.
        formula:
          $ref: '#/components/schemas/FormulaMetricDetails'
          description: Formula configuration.
      required:
        - id
        - slug
        - metricId
        - variantId
        - versionId
        - name
        - description
        - type
        - scope
        - supportedContexts
        - calculationType
        - formula
      title: Formula metric
    PatternMetricResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the metric definition
        slug:
          type: string
          description: Stable metric slug (e.g. "call_reason", "customer_satisfaction")
        metricId:
          type: string
          description: >-
            Alias of `slug` retained for backwards compatibility. Same value as
            `slug`.
        variantId:
          type: string
          format: uuid
          description: >-
            The resolved variant this response reflects (org-scoped Default if
            the org has customized it, otherwise the system Default). Pass this
            as sourceVariantId when building a derived metric off this one to
            pin the exact config.
        versionId:
          type: string
          format: uuid
          description: >-
            The variant's current version. Immutable snapshot of the config —
            editing the metric produces a new versionId. Use it to detect config
            changes.
        name:
          type: string
          description: Name of the metric
        description:
          type: string
          description: Description of what the metric measures
        type:
          type: string
          enum:
            - COUNT
            - NUMERIC
            - BOOLEAN
            - SCALE
            - TEXT
            - CLASSIFICATION
            - OFFSET
          description: Type of value this metric produces
        scope:
          type: string
          enum:
            - GLOBAL
            - PER_PARTICIPANT
          description: Whether metric is global or per-participant
        supportedContexts:
          type: array
          items:
            type: string
            enum:
              - CALL
              - SEGMENT
              - TURN
          description: Which levels this metric can produce values at
        unit:
          type: object
          properties:
            name:
              type: string
              description: Name of the unit
            symbol:
              type:
                - string
                - 'null'
              description: Symbol for the unit
          required:
            - name
            - symbol
          description: Unit information if applicable
        calculationType:
          type: string
          const: PATTERN
          description: >-
            Metric detecting a trigger condition followed by an outcome within a
            window.
        pattern:
          $ref: '#/components/schemas/PatternMetricDetails'
          description: Pattern configuration.
      required:
        - id
        - slug
        - metricId
        - variantId
        - versionId
        - name
        - description
        - type
        - scope
        - supportedContexts
        - calculationType
        - pattern
      title: Pattern metric
    ThresholdMetricDetails:
      type: object
      properties:
        sourceMetricDefinitionId:
          type: string
          format: uuid
        operator:
          type: string
          enum:
            - GREATER_THAN
            - GREATER_THAN_OR_EQUALS
            - LESS_THAN
            - LESS_THAN_OR_EQUALS
            - EQUALS
            - NOT_EQUALS
        thresholdValue:
          type: string
        aggregationMode:
          type: string
          enum:
            - EACH
            - COUNT
            - AVERAGE
            - MIN
            - MAX
            - MEDIAN
            - P95
            - P99
            - SUM
        countThreshold:
          type:
            - integer
            - 'null'
        sourceParticipantRole:
          type:
            - string
            - 'null'
          enum:
            - AGENT
            - CUSTOMER
            - SIMULATED_CUSTOMER
            - BACKGROUND_SPEAKER
        sourceVariantId:
          type:
            - string
            - 'null'
          format: uuid
      required:
        - sourceMetricDefinitionId
        - operator
        - thresholdValue
        - aggregationMode
        - countThreshold
        - sourceParticipantRole
        - sourceVariantId
    FormulaMetricDetails:
      type: object
      properties:
        expression:
          type: string
        sources:
          type: array
          items:
            type: object
            properties:
              sourceMetricDefinitionId:
                type: string
                format: uuid
              sourceVariantId:
                type:
                  - string
                  - 'null'
                format: uuid
            required:
              - sourceMetricDefinitionId
              - sourceVariantId
      required:
        - expression
        - sources
    PatternMetricDetails:
      type: object
      properties:
        operation:
          type: string
          enum:
            - PATTERN_EXISTS
            - PATTERN_COUNT
            - OUTCOME_AGGREGATE
        windowMode:
          type:
            - string
            - 'null'
        triggerCombinator:
          type:
            - string
            - 'null'
          enum:
            - AND
            - OR
        triggers:
          type: array
          items:
            type: object
            properties:
              sourceMetricDefinitionId:
                type: string
                format: uuid
              operator:
                type: string
                enum:
                  - GREATER_THAN
                  - GREATER_THAN_OR_EQUALS
                  - LESS_THAN
                  - LESS_THAN_OR_EQUALS
                  - EQUALS
                  - NOT_EQUALS
              thresholdValue:
                type: string
              sourceParticipantRole:
                type:
                  - string
                  - 'null'
                enum:
                  - AGENT
                  - CUSTOMER
                  - SIMULATED_CUSTOMER
                  - BACKGROUND_SPEAKER
              sourceVariantId:
                type:
                  - string
                  - 'null'
                format: uuid
            required:
              - sourceMetricDefinitionId
              - operator
              - thresholdValue
              - sourceParticipantRole
              - sourceVariantId
        outcome:
          type:
            - object
            - 'null'
          properties:
            sourceMetricDefinitionId:
              type: string
              format: uuid
            operator:
              type: string
              enum:
                - GREATER_THAN
                - GREATER_THAN_OR_EQUALS
                - LESS_THAN
                - LESS_THAN_OR_EQUALS
                - EQUALS
                - NOT_EQUALS
            thresholdValue:
              type: string
            sourceParticipantRole:
              type:
                - string
                - 'null'
              enum:
                - AGENT
                - CUSTOMER
                - SIMULATED_CUSTOMER
                - BACKGROUND_SPEAKER
            sourceVariantId:
              type:
                - string
                - 'null'
              format: uuid
            windowBefore:
              type:
                - integer
                - 'null'
            windowAfter:
              type:
                - integer
                - 'null'
          required:
            - sourceMetricDefinitionId
            - operator
            - thresholdValue
            - sourceParticipantRole
            - sourceVariantId
            - windowBefore
            - windowAfter
      required:
        - operation
        - windowMode
        - triggerCombinator
        - triggers
        - outcome
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````