Create a Monitor for a Project
Create a Monitor for a project
Path Parameters
organization_id_or_slug(string)REQUIREDThe ID or slug of the organization the resource belongs to.
project_id_or_slug(string)REQUIREDThe ID or slug of the project the resource belongs to. Project slugs are unique within each organization.
Body Parameters
name(string)REQUIREDName of the monitor.
type(string)REQUIREDThe type of monitor -
metric_issue.workflow_ids(array(integer))The IDs of the alerts to connect this monitor to. Use the 'Fetch Alerts' endpoint to find the IDs.
data_sources(array(undefined))The data sources for the metric monitor to use based on what you want to measure.
timeWindowis 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 oferrorordefault.
Copied[ { "aggregate": "count()", "dataset" : "events", "environment": "prod", "eventTypes": ["default", "error"], "query": "is:unresolved", "queryType": 0, "timeWindow": 3600 } ][ { "aggregate": "count()", "dataset" : "events", "environment": "prod", "eventTypes": ["default", "error"], "query": "is:unresolved", "queryType": 0, "timeWindow": 3600 } ]Users Experiencing Errors Metric Monitor
eventTypes: Any oferrorordefault.
Copied[ { "aggregate": "count_unique(tags[sentry:user])", "dataset" : "events", "environment": "prod", "eventTypes": ["default", "error"], "query": "is:unresolved", "queryType": 0, "timeWindow": 3600 } ][ { "aggregate": "count_unique(tags[sentry:user])", "dataset" : "events", "environment": "prod", "eventTypes": ["default", "error"], "query": "is:unresolved", "queryType": 0, "timeWindow": 3600 } ]Throughput Metric Monitor
Copied[ { "aggregate":"count(span.duration)", "dataset":"events_analytics_platform", "environment":"prod", "eventTypes":["trace_item_span"], "query":"", "queryType":1, "timeWindow":3600, "extrapolationMode":"unknown" } ][ { "aggregate":"count(span.duration)", "dataset":"events_analytics_platform", "environment":"prod", "eventTypes":["trace_item_span"], "query":"", "queryType":1, "timeWindow":3600, "extrapolationMode":"unknown" } ]Duration Metric Monitor
Copied[ { "aggregate":"p95(span.duration)", "dataset":"events_analytics_platform", "environment":"prod", "eventTypes":["trace_item_span"], "query":"", "queryType":1, "timeWindow":3600, "extrapolationMode":"unknown" } ][ { "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
Copied[ { "aggregate":"failure_rate()", "dataset":"events_analytics_platform", "environment":"prod", "eventTypes":["trace_item_span"], "query":"", "queryType":1, "timeWindow":3600, "extrapolationMode":"unknown" } ][ { "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: Useevents_analytics_platform. To query transaction spans, addis_transaction:truetoquery.aggregate: Valid values areavg(measurements.lcp),p50(measurements.lcp),p75(measurements.lcp),p95(measurements.lcp),p99(measurements.lcp),p100(measurements.lcp), andpercentile(measurements.lcp,x), wherexis your custom percentile.
Copied[ { "aggregate":"p95(measurements.lcp)", "dataset":"events_analytics_platform", "environment":"prod", "eventTypes":["trace_item_span"], "query":"is_transaction:true", "queryType":1, "timeWindow":3600, "extrapolationMode":"unknown" } ][ { "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: Useevents_analytics_platform. To query transaction spans, addis_transaction:truetoquery.aggregate: Valid values are:avg(x), wherexistransaction.duration,measurements.cls,measurements.fcp,measurements.fid,measurements.fp,measurements.lcp,measurements.ttfb, ormeasurements.ttfb.requesttime.p50(x), wherexistransaction.duration,measurements.cls,measurements.fcp,measurements.fid,measurements.fp,measurements.lcp,measurements.ttfb, ormeasurements.ttfb.requesttime.p75(x), where x istransaction.duration,measurements.cls,measurements.fcp,measurements.fid,measurements.fp,measurements.lcp,measurements.ttfb, ormeasurements.ttfb.requesttime.p95(x), where x istransaction.duration,measurements.cls,measurements.fcp,measurements.fid,measurements.fp,measurements.lcp,measurements.ttfb, ormeasurements.ttfb.requesttime.p99(x), where x istransaction.duration,measurements.cls,measurements.fcp,measurements.fid,measurements.fp,measurements.lcp,measurements.ttfb, ormeasurements.ttfb.requesttime.p100(x), wherexistransaction.duration,measurements.cls,measurements.fcp,measurements.fid,measurements.fp,measurements.lcp,measurements.ttfb, ormeasurements.ttfb.requesttime.percentile(x,y), wherexistransaction.duration,measurements.cls,measurements.fcp,measurements.fid,measurements.fp,measurements.lcp,measurements.ttfb, ormeasurements.ttfb.requesttime, andyis the custom percentile.failure_rate()apdex(x), wherexis the value of the Apdex score.count()
Copied[ { "aggregate": "p75(measurements.ttfb)", "dataset": "events_analytics_platform", "environment": "prod", "queryType": 1, "eventTypes": ["trace_item_span"], "query": "is_transaction:true", "timeWindow": 3600, "extrapolationMode": "unknown" } ][ { "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.
detectionTypestatic: Threshold based monitorpercent: Change based monitordynamic: 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 minutes900: 15 minutes3600: 1 hour86400: 1 day604800: 1 week2592000: 1 month
Threshold
Copied{ "detectionType": "static" }{ "detectionType": "static" }Change
Copied{ "detectionType": "percent", "comparisonDelta": 3600 }{ "detectionType": "percent", "comparisonDelta": 3600 }Dynamic
Copied{ "detectionType": "dynamic" }{ "detectionType": "dynamic" }condition_groupIssue detection configuration for when to create an issue and at what priority level.
-
logicType:any -
type: Any ofgt(greater than),lte(less than or equal), oranomaly_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 dynamic monitor, see the options below.
seasonality:autosensitivity: Level of responsiveness. Options are one oflow,medium, orhighthresholdType: If you want to be alerted to anomalies that are moving above, below, or in both directions in relation to your threshold.0: Above1: Below2: Above and below
- If creating a dynamic monitor, see the options below.
-
conditionResult: The issue state change when the threshold is crossed.75: High priority50: Low priority0: Resolved
Threshold and Change Monitor
Copied"logicType": "any", "conditions": [ { "type": "gt", "comparison": 10, "conditionResult": 75 }, { "type": "lte", "comparison": 10, "conditionResult": 0 } ], "actions": []"logicType": "any", "conditions": [ { "type": "gt", "comparison": 10, "conditionResult": 75 }, { "type": "lte", "comparison": 10, "conditionResult": 0 } ], "actions": []Threshold Monitor with Medium Priority
Copied"logicType": "any", "conditions": [ { type: "gt", comparison: 5, conditionResult: 75 }, { type: "gt", comparison: 2, conditionResult: 50 }, { type: "lte", comparison: 2, conditionResult: 0 } ], "actions": []"logicType": "any", "conditions": [ { type: "gt", comparison: 5, conditionResult: 75 }, { type: "gt", comparison: 2, conditionResult: 50 }, { type: "lte", comparison: 2, conditionResult: 0 } ], "actions": []Dynamic Monitor
Copied"logicType": "any", "conditions": [ { "type": "anomaly_detection", "comparison": { "seasonality": "auto", "sensitivity": "medium", "thresholdType": 2 }, "conditionResult": 75 } ], "actions": []"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
Copied"user:123456""user:123456"Team
Copied"team:456789""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:writeproject:adminproject:write
curl https://sentry.io/api/0/organizations/{organization_id_or_slug}/projects/{project_id_or_slug}/detectors/ \ -H 'Authorization: Bearer <auth_token>' \ -H 'Content-Type: application/json' \ -d '{}'
Copied{ "id": "12345", "projectId": "1", "name": "Example metric monitor", "description": "Example description", "type": "metric_issue", "workflowIds": [], "owner": { "type": "user", "id": "12345", "name": "Jane Doe", "email": "jane@sentry.io" }, "createdBy": "12345", "dateCreated": "2026-01-08T23:45:13.235259Z", "dateUpdated": "2026-01-08T23:45:13.235243Z", "dataSources": [ { "id": "123456", "organizationId": "1", "type": "snuba_query_subscription", "sourceId": "12345", "queryObj": { "id": "23456", "status": 1, "subscription": null, "snubaQuery": { "id": "45678", "dataset": "events", "query": "is:unresolved", "aggregate": "count()", "timeWindow": 3600, "environment": null, "eventTypes": [ "error", "default" ], "extrapolationMode": "unknown" } } } ], "conditionGroup": { "id": "1234567", "organizationId": "1", "logicType": "any", "conditions": [ { "id": "2345677", "type": "gt", "comparison": 10, "conditionResult": 75 }, { "id": "567891", "type": "lte", "comparison": 10, "conditionResult": 0 } ], "actions": [] }, "config": { "detectionType": "static" }, "enabled": true, "latestGroup": null }