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

# List Metric Definitions

> The org's custom metric definitions and their current predicates.

`project_id` filters to what is *in effect* for that project, which includes org-wide definitions (those with no `project_id`) since they run against that project's runs too.

This lists configuration, not data. A definition that has never matched a span appears here but not in `GET /orgs/{org_id}/metrics/catalog`.

Filtered per definition the same way `GET /orgs/{org_id}/alarms` is: org-wide definitions need `alarms.read`, project ones need `projects.alarms.read` on the owner. So a project-scoped caller sees their own definitions but not the org-wide ones that also run against their runs, even with `project_id` set.



## OpenAPI

````yaml GET /orgs/{org_id}/metrics/definitions
openapi: 3.1.0
info:
  title: Timbal Platform API
  description: Public API documentation for the Timbal platform
  license:
    name: ''
  version: 2.0.0
servers:
  - url: https://api.timbal.ai
    description: Production
  - url: https://api.dev.timbal.ai
    description: Development
security: []
tags:
  - name: ace
    description: Action Control Engine (ACE) operations
  - name: alarms
    description: Metric series and threshold alarms
  - name: analytics
    description: Org and project analytics
  - name: billing
    description: Subscriptions, usage, and payment-related operations
  - name: channels
    description: Delivery channels alarms notify through
  - name: content
    description: Re-sign stored content URLs
  - name: files
    description: File operations
  - name: iam
    description: IAM — actions, roles, users, and authorization introspection
  - name: k2
    description: Knowledge Bases v2 operations
  - name: orgs
    description: Organization operations
  - name: projects
    description: Project operations
  - name: runs
    description: Execution operations
  - name: templates
    description: Public project template catalog
  - name: users
    description: Authenticated user profile
paths:
  /orgs/{org_id}/metrics/definitions:
    get:
      tags:
        - alarms
      summary: List custom metric definitions
      description: >-
        The org's custom metric definitions and their current predicates.


        `project_id` filters to what is *in effect* for that project, which
        includes org-wide definitions (those with no `project_id`) since they
        run against that project's runs too.


        This lists configuration, not data. A definition that has never matched
        a span appears here but not in `GET /orgs/{org_id}/metrics/catalog`.


        Filtered per definition the same way `GET /orgs/{org_id}/alarms` is:
        org-wide definitions need `alarms.read`, project ones need
        `projects.alarms.read` on the owner. So a project-scoped caller sees
        their own definitions but not the org-wide ones that also run against
        their runs, even with `project_id` set.
      operationId: list_org_metric_definitions
      parameters:
        - name: org_id
          in: path
          required: true
          schema:
            type: string
        - name: project_id
          in: query
          description: >-
            Only definitions in effect for this project. Omit for every
            definition

            in the org.
          required: false
          schema:
            type:
              - string
              - 'null'
      responses:
        '200':
          description: List of definitions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListMetricDefinitionsResBody'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearer_auth: []
components:
  schemas:
    ListMetricDefinitionsResBody:
      type: object
      title: ListOrgMetricDefinitionsResponse
      description: Wrapper for **GET** `/orgs/{org_id}/metrics/definitions`.
      required:
        - definitions
      properties:
        definitions:
          type: array
          items:
            $ref: '#/components/schemas/MetricDefinitionOut'
    ErrorMessage:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Machine-readable error code (e.g. `ALREADY_EXISTS`, `BAD_REQUEST`).
        message:
          type: string
          description: Human-readable description.
    MetricDefinitionOut:
      type: object
      required:
        - id
        - name
        - metric_name
        - source
        - value_source
        - label_source
        - enabled
        - created_at
      properties:
        created_at:
          type: string
          format: date-time
        enabled:
          type: boolean
        has_error:
          type:
            - boolean
            - 'null'
        id:
          type: integer
          format: int64
        label_source:
          type: string
          description: '`none` or `span_name`.'
        metric_name:
          type: string
        min_duration_ms:
          type:
            - integer
            - 'null'
          format: int32
        name:
          type: string
        project_id:
          type:
            - integer
            - 'null'
          format: int64
          description: Project scope; omitted when the filter applies to the whole org.
        source:
          $ref: '#/components/schemas/MetricDefinitionSource'
          description: Always `trace_span` today; see [`MetricDefinitionSource`].
        span_name:
          type:
            - string
            - 'null'
        span_name_prefix:
          type:
            - string
            - 'null'
        status_code:
          type:
            - string
            - 'null'
        value_source:
          type: string
          description: '`count`, `duration_ms`, or `usage:<key>`.'
    MetricDefinitionSource:
      type: string
      description: >-
        Where a definition draws its observations from.


        One variant today. It is in the payload from the start so that adding a

        second source is an additive change to this enum instead of a new
        resource

        alongside `/metrics/definitions` — the reason the endpoint is named for

        metrics rather than for traces.
      enum:
        - trace_span
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      description: >-
        Timbal API key. Obtain your API key from the Timbal platform settings.
        See [Authentication](/api-reference/authentication) for more
        information.

````