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

# Get a monitor



## OpenAPI

````yaml /openapi-butterfly.json get /api/v1/monitors/{id}
openapi: 3.1.0
info:
  contact:
    email: support@datafold.com
    name: API Support
  description: >-
    The Datafold API reference is a guide to our available endpoints and
    authentication methods.

    If you're just getting started with Datafold, we recommend first checking
    out our [documentation](https://docs.datafold.com).


    :::info
      To use the Datafold API, you should first create a Datafold API Key,
      which should be stored as a local environment variable named DATAFOLD_API_KEY.
      This can be set in your Datafold Cloud's Settings under the Account page.
    :::
  title: Datafold API
  version: latest
servers:
  - url: https://us.datafold.com
    description: US
  - url: https://eub.datafold.com
    description: EU
security:
  - ApiKeyAuth: []
paths:
  /api/v1/monitors/{id}:
    get:
      tags:
        - Monitors
      summary: Get a monitor
      operationId: get_monitor_api_v1_monitors__id__get
      parameters:
        - description: The unique identifier of the monitor.
          in: path
          name: id
          required: true
          schema:
            description: The unique identifier of the monitor.
            title: Id
            type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiPublicGetMonitorOutFull'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    ApiPublicGetMonitorOutFull:
      description: >-
        The list row plus the definition, in exactly the shape create and update
        accept.
      properties:
        alert:
          $ref: '#/components/schemas/AlertSpec'
          description: What makes a run alert.
        created_at:
          description: When the monitor was created.
          format: date-time
          title: Created At
          type: string
        datadiff:
          anyOf:
            - $ref: '#/components/schemas/DiffConfigSpec'
            - type: 'null'
          description: >-
            The diff the monitor runs. Null only for a monitor whose stored
            definition has gone missing, which cannot happen for one this API
            created.
        description:
          anyOf:
            - type: string
            - type: 'null'
          description: Free-text description.
          title: Description
        enabled:
          description: Whether the schedule fires.
          title: Enabled
          type: boolean
        id:
          description: Unique identifier for the monitor.
          title: Id
          type: integer
        last_run:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: When the monitor last started a run.
          title: Last Run
        managed_in_code:
          description: >-
            True when the monitor's definition lives in a repo. Update and
            delete are refused for such a monitor — change its YAML instead.
          title: Managed In Code
          type: boolean
        modified_at:
          description: When the monitor was last modified.
          format: date-time
          title: Modified At
          type: string
        monitor_type:
          const: diff
          description: Type of the monitor.
          title: Monitor Type
          type: string
        name:
          anyOf:
            - type: string
            - type: 'null'
          description: Name of the monitor.
          title: Name
        next_run:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: When the schedule fires next.
          title: Next Run
        owner:
          anyOf:
            - type: string
            - type: 'null'
          description: Email of the monitor owner.
          title: Owner
        schedule:
          $ref: '#/components/schemas/ScheduleSpec'
          description: When the monitor runs.
        slug:
          anyOf:
            - type: string
            - type: 'null'
          description: Stable identifier.
          title: Slug
        state:
          anyOf:
            - $ref: '#/components/schemas/MonitorRunState'
            - type: 'null'
          description: Outcome of the latest run, once it has one.
        tags:
          description: Tags on the monitor.
          items:
            type: string
          title: Tags
          type: array
      required:
        - id
        - name
        - monitor_type
        - created_at
        - modified_at
        - enabled
        - managed_in_code
        - schedule
        - alert
      title: ApiPublicGetMonitorOutFull
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    AlertSpec:
      additionalProperties: false
      description: >-
        The thresholds. Names are the pre-fork ones; units are documented per
        field.
      properties:
        different_rows_count:
          anyOf:
            - minimum: 0
              type: integer
            - type: 'null'
          title: Different Rows Count
        different_rows_percent:
          anyOf:
            - maximum: 100
              minimum: 0
              type: number
            - type: 'null'
          title: Different Rows Percent
        match_ratio_min:
          anyOf:
            - maximum: 1
              minimum: 0
              type: number
            - type: 'null'
          title: Match Ratio Min
      title: AlertSpec
      type: object
    DiffConfigSpec:
      additionalProperties: false
      properties:
        column_remapping:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Column Remapping
        column_rules:
          anyOf:
            - items:
                $ref: '#/components/schemas/ColumnRule'
              type: array
            - type: 'null'
          title: Column Rules
        columns_to_compare:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Columns To Compare
        compare_duplicates:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Compare Duplicates
        dataset_a:
          $ref: '#/components/schemas/DatasetSpec'
        dataset_b:
          $ref: '#/components/schemas/DatasetSpec'
        diff_type:
          anyOf:
            - enum:
                - inmem
                - indb
              type: string
            - type: 'null'
          title: Diff Type
        empty_tables_match:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Empty Tables Match
        exclude_columns:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Exclude Columns
        ignore_string_case:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Ignore String Case
        include_columns:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Include Columns
        null_equals_empty_string:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Null Equals Empty String
        primary_key:
          items:
            type: string
          title: Primary Key
          type: array
        sampling:
          anyOf:
            - $ref: '#/components/schemas/SamplingSpec'
            - type: 'null'
        sort_array_columns:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Sort Array Columns
        tolerance:
          anyOf:
            - $ref: '#/components/schemas/ToleranceSpec'
            - type: 'null'
      required:
        - dataset_a
        - dataset_b
        - primary_key
      title: DiffConfigSpec
      type: object
    ScheduleSpec:
      additionalProperties: false
      description: >-
        One of three shapes, mirroring the pre-fork spec: cron, interval, or
        none.
      properties:
        cron:
          anyOf:
            - type: string
            - type: 'null'
          title: Cron
        interval:
          anyOf:
            - $ref: '#/components/schemas/IntervalSpec'
            - type: 'null'
        type:
          anyOf:
            - const: none
              type: string
            - type: 'null'
          title: Type
      title: ScheduleSpec
      type: object
    MonitorRunState:
      description: >-
        A finished run's verdict. NULL means the run is still in flight.


        Plain text in the database rather than a PG enum: `ALTER TYPE ... ADD
        VALUE` has to

        run in an autocommit block and cannot be reverted, which is a bad
        property for a

        value set that grows when other monitor kinds arrive.
      enum:
        - ok
        - alert
        - error
        - cancelled
      title: MonitorRunState
      type: string
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
    ColumnRule:
      description: >-
        One `DataDiff.column_rules` entry as authored: a selector plus its
        `equal_if`.


        The validated shape every authoring surface shares — the REST body

        (`ApiColumnRule`), the diff agent tool
        (`dma/tools/diff_validation.DiffRequest`) —

        so the two cannot drift on what a rule is. Upstream keeps this on its
        monitors

        schemas; this fork's monitors (ENG-5134) have their own spec, so it
        lives with the

        matcher that consumes it. `column_rule_to_dict` is the stored form.
      properties:
        column:
          anyOf:
            - minLength: 1
              type: string
            - type: 'null'
          description: >-
            Column name the rule applies to, matched case-insensitively. When
            column remapping is enabled, this refers to the dataset-A
            (canonical) column name — the same name the comparator operates on
            after remapping. A selector matching no compared column applies
            nothing and is logged as a warning. Mutually exclusive with `type`.
            Exactly one of `column` or `type` must be set.
          title: Column
        equal_if:
          description: >-
            SQL boolean expression OR-ed into the value comparator for the
            matching column(s). Use {a} and {b} as placeholders for the side-A
            and side-B column references. Multiple rules matching the same
            column are all OR-ed together. Example: "{a} = '1900-01-01' AND {b}
            IS NULL". In a cross-database diff the expression runs in DuckDB on
            the types both sides were loaded as: two warehouse types with no
            common type (e.g. a timestamp and a double) both load as VARCHAR, so
            cast inside the rule, e.g. "epoch(TRY_CAST({a} AS TIMESTAMP)) =
            TRY_CAST({b} AS DOUBLE)". A rule that does not compile fails the
            diff.
          title: Equal If
          type: string
        type:
          anyOf:
            - $ref: '#/components/schemas/DatatypeName'
            - type: 'null'
          description: >-
            Type-based selector — matches all columns whose Datatype.typename
            equals this value, resolved against the types the comparison
            actually runs on (the source warehouse types for same-database
            diffs, the negotiated DuckDB types for cross-database diffs).
            Mutually exclusive with `column`. Exactly one of `column` or `type`
            must be set.
      required:
        - equal_if
      title: ColumnRule
      type: object
    DatasetSpec:
      additionalProperties: false
      properties:
        connection_id:
          title: Connection Id
          type: integer
        filter:
          anyOf:
            - type: string
            - type: 'null'
          title: Filter
        materialize:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Materialize
        query:
          anyOf:
            - type: string
            - type: 'null'
          title: Query
        table:
          anyOf:
            - type: string
            - type: 'null'
          title: Table
      required:
        - connection_id
      title: DatasetSpec
      type: object
    SamplingSpec:
      additionalProperties: false
      description: >-
        One of the pre-fork's three sampling modes: `tolerance` + `confidence`
        (a sample

        sized for a statistical guarantee), `rate` (a fixed fraction), or
        `max_rows` (a fixed

        count). `threshold` applies to all three: tables smaller than it are not
        sampled.
      properties:
        confidence:
          anyOf:
            - maximum: 100
              minimum: 0
              type: number
            - type: 'null'
          title: Confidence
        max_rows:
          anyOf:
            - exclusiveMinimum: 0
              type: integer
            - type: 'null'
          title: Max Rows
        rate:
          anyOf:
            - exclusiveMaximum: 1
              exclusiveMinimum: 0
              type: number
            - type: 'null'
          title: Rate
        threshold:
          anyOf:
            - minimum: 0
              type: integer
            - type: 'null'
          title: Threshold
        tolerance:
          anyOf:
            - maximum: 1
              minimum: 0
              type: number
            - type: 'null'
          title: Tolerance
      title: SamplingSpec
      type: object
    ToleranceSpec:
      additionalProperties: false
      properties:
        datetime:
          anyOf:
            - $ref: '#/components/schemas/DatetimeToleranceSpec'
            - type: 'null'
        float:
          anyOf:
            - $ref: '#/components/schemas/FloatToleranceSpec'
            - type: 'null'
      title: ToleranceSpec
      type: object
    IntervalSpec:
      additionalProperties: false
      properties:
        every:
          enum:
            - hour
            - day
          title: Every
          type: string
        hour:
          anyOf:
            - maximum: 23
              minimum: 0
              type: integer
            - type: 'null'
          title: Hour
      required:
        - every
      title: IntervalSpec
      type: object
    DatatypeName:
      enum:
        - boolean
        - integer
        - float
        - decimal
        - unbounded_decimal
        - money
        - string
        - fixed_length_string
        - varbinary
        - binary
        - date
        - super
        - time
        - time_interval
        - timestamp
        - year
        - uuid
        - array
        - struct
        - json
        - xml
        - map
        - void
        - unsupported
      title: DatatypeName
      type: string
    DatetimeToleranceSpec:
      additionalProperties: false
      properties:
        default:
          enum:
            - 1s
            - 0.1s
            - 0.01s
            - 1ms
            - 0.1ms
            - 0.01ms
            - 1us
          title: Default
          type: string
      required:
        - default
      title: DatetimeToleranceSpec
      type: object
    FloatToleranceSpec:
      additionalProperties: false
      properties:
        column_tolerance:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/ColumnToleranceSpec'
              type: object
            - type: 'null'
          title: Column Tolerance
        default:
          anyOf:
            - $ref: '#/components/schemas/ColumnToleranceSpec'
            - type: 'null'
      title: FloatToleranceSpec
      type: object
    ColumnToleranceSpec:
      additionalProperties: false
      description: >-
        `relative` is a percentage (`0.5` = 0.5%), `absolute` a plain number —
        the

        pre-fork units. The engine stores a relative tolerance as a fraction, so
        the mapping

        divides by 100.
      properties:
        type:
          $ref: '#/components/schemas/ToleranceModeEnum'
        value:
          minimum: 0
          title: Value
          type: number
      required:
        - type
        - value
      title: ColumnToleranceSpec
      type: object
    ToleranceModeEnum:
      enum:
        - absolute
        - relative
      title: ToleranceModeEnum
      type: string
  securitySchemes:
    ApiKeyAuth:
      description: Use the 'Authorization' header with the format 'Key <api-key>'
      in: header
      name: Authorization
      type: apiKey

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.