Update a Monitor by ID

PUT /api/0/organizations/{organization_id_or_slug}/detectors/{detector_id}/

Update an existing monitor

Path Parameters

organization_id_or_slug (string)
REQUIRED

The ID or slug of the organization the resource belongs to.

detector_id (integer)
REQUIRED

The ID of the monitor you'd like to query.

Body Parameters

name (string)

Name of the monitor.

type (string)

The type of monitor - metric_issue.

workflowIds (array(integer))

The IDs of the alerts to connect this monitor to. Use the 'Fetch Alerts' endpoint to find the IDs.

dataSources (array(undefined))

The data sources for the metric monitor to use based on what you want to measure.

The schema of each data source lists the aggregate values that its dataset and eventTypes accept.

timeWindow is measured in seconds. Cron Monitors use schedules instead of this field. Legacy metric alert rules expressed this value in minutes, so multiply a legacy value by 60 when migrating it to a monitor. For example, a legacy 5-minute window becomes "timeWindow": 300.

Number of Errors Metric Monitor

  • eventTypes: Any of error or default.
    [
        {
            "aggregate": "count()",
            "dataset" : "events",
            "environment": "prod",
            "eventTypes": ["default", "error"],
            "query": "is:unresolved",
            "queryType": 0,
            "timeWindow": 3600
        }
    ]

Users Experiencing Errors Metric Monitor

  • eventTypes: Any of error or default.
    [
        {
            "aggregate": "count_unique(tags[sentry:user])",
            "dataset" : "events",
            "environment": "prod",
            "eventTypes": ["default", "error"],
            "query": "is:unresolved",
            "queryType": 0,
            "timeWindow": 3600
        }
    ]

Throughput Metric Monitor

    [
        {
            "aggregate":"count(span.duration)",
            "dataset":"events_analytics_platform",
            "environment":"prod",
            "eventTypes":["trace_item_span"],
            "query":"",
            "queryType":1,
            "timeWindow":3600,
            "extrapolationMode":"unknown"
        }
    ]

Duration Metric Monitor

    [
        {
            "aggregate":"p95(span.duration)",
            "dataset":"events_analytics_platform",
            "environment":"prod",
            "eventTypes":["trace_item_span"],
            "query":"",
            "queryType":1,
            "timeWindow":3600,
            "extrapolationMode":"unknown"
        }
    ]

Failure Rate Metric Monitor

    [
        {
            "aggregate":"failure_rate()",
            "dataset":"events_analytics_platform",
            "environment":"prod",
            "eventTypes":["trace_item_span"],
            "query":"",
            "queryType":1,
            "timeWindow":3600,
            "extrapolationMode":"unknown"
        }
    ]

Largest Contentful Paint Metric Monitor

  • dataset: Use events_analytics_platform. To query transaction spans, add is_transaction:true to query.
  • aggregate: Valid values are avg(measurements.lcp), p50(measurements.lcp), p75(measurements.lcp), p95(measurements.lcp), p99(measurements.lcp), and p100(measurements.lcp).
    [
        {
            "aggregate":"p95(measurements.lcp)",
            "dataset":"events_analytics_platform",
            "environment":"prod",
            "eventTypes":["trace_item_span"],
            "query":"is_transaction:true",
            "queryType":1,
            "timeWindow":3600,
            "extrapolationMode":"unknown"
        }
    ]

Custom Metric Monitor

  • dataset: Use events_analytics_platform. To query transaction spans, add is_transaction:true to query.
  • aggregate: Valid values are: avg(x), where x is transaction.duration, measurements.cls, measurements.fcp, measurements.fid, measurements.fp, measurements.lcp, measurements.ttfb, or measurements.ttfb.requesttime. p50(x), where x is transaction.duration, measurements.cls, measurements.fcp, measurements.fid, measurements.fp, measurements.lcp, measurements.ttfb, or measurements.ttfb.requesttime. p75(x), where x is transaction.duration, measurements.cls, measurements.fcp, measurements.fid, measurements.fp, measurements.lcp, measurements.ttfb, or measurements.ttfb.requesttime. p95(x), where x is transaction.duration, measurements.cls, measurements.fcp, measurements.fid, measurements.fp, measurements.lcp, measurements.ttfb, or measurements.ttfb.requesttime. p99(x), where x is transaction.duration, measurements.cls, measurements.fcp, measurements.fid, measurements.fp, measurements.lcp, measurements.ttfb, or measurements.ttfb.requesttime. p100(x), where x is transaction.duration, measurements.cls, measurements.fcp, measurements.fid, measurements.fp, measurements.lcp, measurements.ttfb, or measurements.ttfb.requesttime. failure_rate() apdex(x), where x is the value of the Apdex score. count()
[
    {
        "aggregate": "p75(measurements.ttfb)",
        "dataset": "events_analytics_platform",
        "environment": "prod",
        "queryType": 1,
        "eventTypes": ["trace_item_span"],
        "query": "is_transaction:true",
        "timeWindow": 3600,
        "extrapolationMode": "unknown"
    }
]
config (object)

The issue detection type configuration.

  • detectionType
    • static: Threshold based monitor
    • percent: Change based monitor
    • dynamic: Dynamic monitor
  • comparisonDelta: If selecting a change detection type, the comparison delta is the time period, in seconds, at which to compare against historical data. For example, a value of 3600 compares the metric tracked against data 1 hour ago.
    • 300: 5 minutes
    • 900: 15 minutes
    • 3600: 1 hour
    • 86400: 1 day
    • 604800: 1 week
    • 2592000: 1 month

Threshold

{
    "detectionType": "static"
}

Change

{
    "detectionType": "percent",
    "comparisonDelta": 3600
}

Dynamic

{
    "detectionType": "dynamic"
}
conditionGroup

Issue detection configuration for when to create an issue and at what priority level.

  • logicType: any

  • type: Any of gt (greater than), gte (greater than or equal), lt (less than), lte (less than or equal), or anomaly_detection (dynamic)

  • comparison: Any positive integer. This is threshold that must be crossed for the monitor to create an issue, e.g. "Create a metric issue when there are more than 5 unresolved error events".

    • If creating a change monitor, comparison is the current value as a percentage of the value comparisonDelta seconds earlier, not the size of the change. For example, use 120 with gt for 20% higher, or 70 with lt for 30% lower.
    • If creating a dynamic monitor, see the options below.
      • seasonality: auto
      • sensitivity: Level of responsiveness. Options are one of low, medium, or high
      • thresholdType: If you want to be alerted to anomalies that are moving above, below, or in both directions in relation to your threshold.
        • 0: Above
        • 1: Below
        • 2: Above and below
  • conditionResult: The issue state change when the threshold is crossed.

    • 75: High priority
    • 50: Low priority
    • 0: Resolved

Threshold Monitor

    "logicType": "any",
    "conditions": [
        {
            "type": "gt",
            "comparison": 10,
            "conditionResult": 75
        },
        {
            "type": "lte",
            "comparison": 10,
            "conditionResult": 0
        }
    ],
    "actions": []

Change Monitor (20% higher than comparisonDelta seconds earlier)

    "logicType": "any",
    "conditions": [
        {
            "type": "gt",
            "comparison": 120,
            "conditionResult": 75
        },
        {
            "type": "lte",
            "comparison": 120,
            "conditionResult": 0
        }
    ],
    "actions": []

Threshold Monitor with Medium Priority

    "logicType": "any",
    "conditions": [
        {
            type: "gt",
            comparison: 5,
            conditionResult: 75
        },
        {
            type: "gt",
            comparison: 2,
            conditionResult: 50
        },
        {
            type: "lte",
            comparison: 2,
            conditionResult: 0
        }
    ],
    "actions": []

Dynamic Monitor

    "logicType": "any",
    "conditions": [
        {
            "type": "anomaly_detection",
            "comparison": {
                "seasonality": "auto",
                "sensitivity": "medium",
                "thresholdType": 2
            },
            "conditionResult": 75
        }
    ],
    "actions": []
owner (string)

The ID user or team who owns the monitor or alert prefaced by the string 'user' or 'team'.

User

    "user:123456"

Team

    "team:456789"
description (string)

A description of the monitor. Will be used in the resulting issue.

enabled (boolean)

Set to False if you want to disable the monitor.

Scopes

<auth_token> requires one of the following scopes:
  • alerts:write
  • org:admin
  • org:read
  • org:write
curl https://sentry.io/api/0/organizations/{organization_id_or_slug}/detectors/{detector_id}/ \
 -H 'Authorization: Bearer <auth_token>' \
 -X PUT \
 -H 'Content-Type: application/json' \
 -d '{}'
RESPONSESCHEMA
Copied
{ "id": "12345", "projectId": "1", "name": "Updated monitor", "description": null, "type": "metric_issue", "workflowIds": [], "owner": { "type": "user", "id": "4567", "name": "Jane Doe", "email": "jane@example.io" }, "createdBy": "45678", "dateCreated": "2026-01-09T18:47:41.596427Z", "dateUpdated": "2026-01-12T21:30:07.354861Z", "dataSources": [ { "id": "2345", "organizationId": "1", "type": "snuba_query_subscription", "sourceId": "1234", "queryObj": { "id": "3456", "status": 0, "subscription": "55/abc123def456ghi789", "snubaQuery": { "id": "56789", "dataset": "events_analytics_platform", "query": "", "aggregate": "p95(measurements.lcp)", "timeWindow": 3600, "environment": null, "eventTypes": [ "trace_item_span" ], "extrapolationMode": "unknown" } } } ], "conditionGroup": { "id": "12345678", "organizationId": "1", "logicType": "any", "conditions": [ { "id": "234567", "type": "gt", "comparison": 5, "conditionResult": 75 }, { "id": "234568", "type": "lte", "comparison": 5, "conditionResult": 0 } ], "actions": [] }, "config": { "detectionType": "static" }, "enabled": true, "latestGroup": { "id": "123456789", "title": "Test monitor", "culprit": "", "shortId": "SENTRY-1A2B", "level": "error", "status": "resolved", "substatus": null, "platform": "python", "project": { "id": "1", "name": "Backend", "slug": "sentry", "platform": "python" }, "type": "generic", "issueType": "metric_issue", "issueCategory": "metric", "metadata": { "title": "Test monitor", "value": "Critical: Number of events in the last hour above 5", "initial_priority": 75 }, "numComments": 0, "firstSeen": "2026-01-09T18:48:15.250134Z", "lastSeen": "2026-01-09T18:48:15.250134Z" } }
Was this helpful?