# Monitors



## POST /api/monitors/list

> List Monitors

OpenAPI:

```json
{"openapi":"3.1.1","info":{"title":"Groundcover API.","version":"1.0.0"},"servers":[{"url":"https://api.groundcover.com"}],"security":[{"Bearer":["[]"]}],"components":{"securitySchemes":{"Bearer":{"in":"header","name":"Authorization","type":"apiKey"}}},"paths":{"/api/monitors/list":{"post":{"description":"List Monitors","operationId":"listMonitors","responses":{"200":{"description":"MonitorListResponseWrapper defines the response structure for listing monitors.","schema":{"properties":{"monitors":{"description":"List of monitors matching the criteria.","items":{"properties":{"title":{"description":"Title of the monitor.","type":"string"},"type":{"description":"Type of the monitor.","type":"string"},"uuid":{"description":"Unique identifier for the monitor.\nFormat: uuid","format":"uuid","type":"string"}},"type":"object"},"type":"array"}},"type":"object"}},"400":{"description":"ErrorResponse defines a common error response structure.","schema":{"properties":{"message":{"type":"string"}},"type":"object"}},"500":{"description":"ErrorResponse defines a common error response structure.","schema":{"$ref":"#/paths/~1api~1monitors~1list/post/responses/400/schema"}}},"tags":["monitors"],"requestBody":{"content":{"application/json":{"schema":{"properties":{"conditions":{"description":"Search conditions to filter monitors.","items":{"properties":{"additionalFilter":{"type":"string"},"autoComplete":{"type":"boolean"},"filterKeys":{"items":{"type":"string"},"type":"array"},"filters":{"items":{"properties":{"op":{"type":"string"},"value":{}},"title":"Filter represents an operation and value for a condition.","type":"object"},"type":"array"},"isNullable":{"type":"boolean"},"key":{"type":"string"},"origin":{"type":"string"},"type":{"type":"string"}},"title":"Condition specifies a search condition based on a column and filters.","type":"object"},"type":"array"},"limit":{"default":1000,"description":"Maximum number of monitors to return.","format":"int64","type":"integer"}},"type":"object"}}},"description":"Conditions to filter monitors and optional limit.","required":true}}}}}
```

## GET /api/monitors/{id}

> Get Monitor Definition (YAML)

OpenAPI:

```json
{"openapi":"3.1.1","info":{"title":"Groundcover API.","version":"1.0.0"},"servers":[{"url":"https://api.groundcover.com"}],"security":[{"Bearer":["[]"]}],"components":{"securitySchemes":{"Bearer":{"in":"header","name":"Authorization","type":"apiKey"}}},"paths":{"/api/monitors/{id}":{"get":{"description":"Get Monitor Definition (YAML)","operationId":"getMonitor","parameters":[{"schema":{"type":"string"},"description":"UUID of the monitor to retrieve","in":"path","name":"id","required":true}],"responses":{"200":{"description":"MonitorYamlResponse defines the response structure for getting a monitor's YAML.","schema":{"items":{"format":"uint8","type":"integer"},"type":"array"}},"400":{"description":"ErrorResponse defines a common error response structure.","schema":{"properties":{"message":{"type":"string"}},"type":"object"}},"404":{"description":"ErrorResponse defines a common error response structure.","schema":{"$ref":"#/paths/~1api~1monitors~1{id}/get/responses/400/schema"}},"500":{"description":"ErrorResponse defines a common error response structure.","schema":{"$ref":"#/paths/~1api~1monitors~1{id}/get/responses/400/schema"}}},"tags":["monitors"]}}}}
```

## POST /api/monitors

> Create Monitor

OpenAPI:

```json
{"openapi":"3.1.1","info":{"title":"Groundcover API.","version":"1.0.0"},"servers":[{"url":"https://api.groundcover.com"}],"security":[{"Bearer":["[]"]}],"components":{"securitySchemes":{"Bearer":{"in":"header","name":"Authorization","type":"apiKey"}}},"paths":{"/api/monitors":{"post":{"description":"Create Monitor","operationId":"createMonitor","responses":{"200":{"description":"CreateMonitorResponseWrapper defines the response structure for creating a monitor.","schema":{"properties":{"monitorId":{"description":"The UUID of the newly created monitor.","type":"string"}},"type":"object"}},"400":{"description":"ErrorResponse defines a common error response structure.","schema":{"properties":{"message":{"type":"string"}},"type":"object"}},"403":{"description":"ErrorResponse defines a common error response structure.","schema":{"$ref":"#/paths/~1api~1monitors/post/responses/400/schema"}},"409":{"description":"ErrorResponse defines a common error response structure.","schema":{"$ref":"#/paths/~1api~1monitors/post/responses/400/schema"}},"500":{"description":""}},"tags":["monitors"],"requestBody":{"content":{"application/json":{"schema":{"allOf":[{"properties":{"annotations":{"additionalProperties":{"type":"string"},"description":"Annotations to attach to the alert.","type":"object"},"autoResolve":{"description":"Whether the alert should auto-resolve.","type":"boolean"},"catalog":{"properties":{"category":{"type":"string"},"id":{"type":"string"},"tags":{"items":{"type":"string"},"type":"array"},"version":{"format":"int64","type":"integer"}},"title":"CatalogModel holds metadata if the monitor originated from a catalog.","type":"object"},"category":{"description":"Category of the monitor.","type":"string"},"display":{"properties":{"contextHeaderLabels":{"items":{"type":"string"},"type":"array"},"description":{"type":"string"},"header":{"type":"string"},"resourceHeaderLabels":{"items":{"type":"string"},"type":"array"}},"title":"DisplayModel controls how the monitor is presented.","type":"object"},"evaluationInterval":{"properties":{"interval":{"format":"duration","type":"string"},"pendingFor":{"format":"duration","type":"string"}},"title":"EvaluationInterval defines the evaluation frequency and pending duration.","type":"object"},"executionErrorState":{"description":"State to enter if execution fails.","enum":["OK"," Error"," Alerting"],"type":"string"},"isPaused":{"description":"Whether the monitor is paused.","type":"boolean"},"labels":{"additionalProperties":{"type":"string"},"description":"Labels to attach to the monitor/alert.","type":"object"},"measurementType":{"description":"Type of measurement (state or event).","enum":["state"," event"],"type":"string"},"model":{"properties":{"queries":{"description":"List of queries defining the data sources for the monitor.","items":{"properties":{"conditions":{"items":{"properties":{"additionalFilter":{"type":"string"},"autoComplete":{"type":"boolean"},"filterKeys":{"items":{"type":"string"},"type":"array"},"filters":{"items":{"properties":{"op":{"type":"string"},"value":{}},"title":"Filter represents an operation and value for a condition.","type":"object"},"type":"array"},"isNullable":{"type":"boolean"},"key":{"type":"string"},"origin":{"type":"string"},"type":{"type":"string"}},"title":"Condition specifies a search condition based on a column and filters.","type":"object"},"type":"array"},"dataType":{"type":"string"},"datasourceID":{"type":"string"},"datasourceType":{"type":"string"},"expression":{"type":"string"},"filters":{"type":"string"},"instantRollup":{"type":"string"},"name":{"type":"string"},"pipeline":{"properties":{"conditions":{"items":{"properties":{"$ref":"#/paths/~1api~1monitors/post/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/conditions/items/properties"},"title":"Condition specifies a search condition based on a column and filters.","type":"object"},"type":"array"},"function":{"properties":{"args":{"items":{"type":"string"},"type":"array"},"name":{"type":"string"},"pipelines":{"items":{"properties":{"$ref":"#/paths/~1api~1monitors/post/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/pipeline/properties"},"title":"PromqlPipeline represents a segment of a PromQL query, which can be a metric with conditions, a function, or a template.","type":"object"},"type":"array"}},"title":"PromqlFunction represents a function call in a PromQL query.","type":"object"},"metric":{"description":"Pipeline can either have a metric OR a function OR a template","type":"string"},"template":{"type":"string"}},"title":"PromqlPipeline represents a segment of a PromQL query, which can be a metric with conditions, a function, or a template.","type":"object"},"queryType":{"type":"string"},"relativeTimerange":{"properties":{"from":{"description":"Start of the range relative to now (e.g., \"-5m\", \"-1h\").","format":"duration","type":"string"},"to":{"description":"End of the range relative to now (e.g., \"-1m\", \"now\").","format":"duration","type":"string"}},"title":"RelativeTimerange defines a time range relative to the evaluation time.","type":"object"},"rollup":{"properties":{"function":{"type":"string"},"time":{"description":"Duration wraps time.Duration. It is used to parse the custom duration format\nfrom YAML.\nThis type should not propagate beyond the scope of input/output processing.","format":"int64","type":"integer"}},"type":"object"},"sqlPipeline":{"properties":{"except":{"items":{"properties":{"additionalFilter":{"type":"string"},"alias":{"type":"string"},"autoComplete":{"type":"boolean"},"filterKeys":{"items":{"type":"string"},"type":"array"},"isNullable":{"type":"boolean"},"key":{"type":"string"},"origin":{"type":"string"},"processors":{"items":{"properties":{"args":{"items":{"type":"string"},"type":"array"},"op":{"type":"string"}},"type":"object"},"type":"array"},"type":{"type":"string"}},"type":"object"},"type":"array"},"filters":{"properties":{"conditions":{"items":{"properties":{"$ref":"#/paths/~1api~1monitors/post/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/conditions/items/properties"},"title":"Condition specifies a search condition based on a column and filters.","type":"object"},"type":"array"},"disabled":{"type":"boolean"},"groups":{"items":{"properties":{"$ref":"#/paths/~1api~1monitors/post/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/sqlPipeline/properties/filters/properties"},"type":"object"},"type":"array"},"operator":{"type":"string"}},"type":"object"},"from":{"properties":{"$ref":"#/paths/~1api~1monitors/post/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/sqlPipeline/properties"},"title":"SqlPipeline defines a pipeline for search queries.","type":"object"},"groupBy":{"items":{"properties":{"$ref":"#/paths/~1api~1monitors/post/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/sqlPipeline/properties/except/items/properties"},"type":"object"},"type":"array"},"having":{"properties":{"$ref":"#/paths/~1api~1monitors/post/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/sqlPipeline/properties/filters/properties"},"type":"object"},"limit":{"format":"uint64","type":"integer"},"offset":{"format":"uint64","type":"integer"},"orderBy":{"items":{"properties":{"direction":{"type":"string"},"selector":{"properties":{"$ref":"#/paths/~1api~1monitors/post/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/sqlPipeline/properties/except/items/properties"},"type":"object"}},"title":"SearchOrderBy defines the order for a search pipeline.","type":"object"},"type":"array"},"selectors":{"items":{"properties":{"$ref":"#/paths/~1api~1monitors/post/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/sqlPipeline/properties/except/items/properties"},"type":"object"},"type":"array"}},"title":"SqlPipeline defines a pipeline for search queries.","type":"object"}},"title":"BaseQuery is the base struct for different query types.","type":"object"},"type":"array"},"reducers":{"description":"List of reducers to aggregate or transform query results.","items":{"properties":{"expression":{"description":"Math expression (if type is 'math').","type":"string"},"inputName":{"description":"Name of the query or reducer output to use as input.","type":"string"},"name":{"description":"Name of the reducer output.","type":"string"},"relativeTimerange":{"properties":{"$ref":"#/paths/~1api~1monitors/post/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/relativeTimerange/properties"},"title":"RelativeTimerange defines a time range relative to the evaluation time.","type":"object"},"type":{"description":"Type of the reducer (e.g., last, min, max, mean, sum, count, math).","type":"string"}},"required":["type"],"title":"ReducerModel defines how to aggregate or transform query results.","type":"object"},"type":"array"},"thresholds":{"description":"List of thresholds to evaluate against the final reduced value.","items":{"properties":{"inputName":{"description":"Name of the reducer output this threshold applies to.","type":"string"},"name":{"description":"Name of the threshold.","type":"string"},"operator":{"description":"Comparison operator.","enum":["gt"," lt"," within_range"," outside_range"],"type":"string"},"relativeTimerange":{"properties":{"$ref":"#/paths/~1api~1monitors/post/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/relativeTimerange/properties"},"title":"RelativeTimerange defines a time range relative to the evaluation time.","type":"object"},"values":{"description":"Values to compare against (one for gt/lt, two for range operators).","items":{"format":"double","type":"number"},"type":"array"}},"required":["name","inputName","operator","values"],"title":"Threshold defines a condition to evaluate against a reduced value.","type":"object"},"type":"array"}},"required":["queries"],"title":"Model holds the core query/reducer/threshold definitions.","type":"object"},"noDataState":{"description":"State to enter if no data is returned.","enum":["OK"," NoData"," Alerting"],"type":"string"},"routing":{"description":"Routing information.","items":{"type":"string"},"type":"array"},"severity":{"description":"Severity level (e.g., critical, warning, info).","type":"string"},"team":{"description":"Team associated with the monitor.","type":"string"},"title":{"description":"Title of the monitor.","type":"string"}},"required":["title"],"type":"object"}]}}},"description":"Monitor definition based on MonitorModel","required":true}}}}}
```

## PUT /api/monitors/{id}

> Update Monitor

OpenAPI:

```json
{"openapi":"3.1.1","info":{"title":"Groundcover API.","version":"1.0.0"},"servers":[{"url":"https://api.groundcover.com"}],"security":[{"Bearer":["[]"]}],"components":{"securitySchemes":{"Bearer":{"in":"header","name":"Authorization","type":"apiKey"}}},"paths":{"/api/monitors/{id}":{"put":{"description":"Update Monitor","operationId":"updateMonitor","parameters":[{"schema":{"type":"string"},"description":"UUID of the monitor to update","in":"path","name":"id","required":true}],"responses":{"202":{"description":""},"400":{"description":"ErrorResponse defines a common error response structure.","schema":{"properties":{"message":{"type":"string"}},"type":"object"}},"404":{"description":"ErrorResponse defines a common error response structure.","schema":{"$ref":"#/paths/~1api~1monitors~1{id}/put/responses/400/schema"}},"409":{"description":"ErrorResponse defines a common error response structure.","schema":{"$ref":"#/paths/~1api~1monitors~1{id}/put/responses/400/schema"}},"500":{"description":"ErrorResponse defines a common error response structure.","schema":{"$ref":"#/paths/~1api~1monitors~1{id}/put/responses/400/schema"}}},"tags":["monitors"],"requestBody":{"content":{"application/json":{"schema":{"allOf":[{"properties":{"annotations":{"additionalProperties":{"type":"string"},"description":"Annotations to attach to the alert.","type":"object"},"autoResolve":{"description":"Whether the alert should auto-resolve.","type":"boolean"},"catalog":{"properties":{"category":{"type":"string"},"id":{"type":"string"},"tags":{"items":{"type":"string"},"type":"array"},"version":{"format":"int64","type":"integer"}},"title":"CatalogModel holds metadata if the monitor originated from a catalog.","type":"object"},"category":{"description":"Category of the monitor.","type":"string"},"display":{"properties":{"contextHeaderLabels":{"items":{"type":"string"},"type":"array"},"description":{"type":"string"},"header":{"type":"string"},"resourceHeaderLabels":{"items":{"type":"string"},"type":"array"}},"title":"DisplayModel controls how the monitor is presented.","type":"object"},"evaluationInterval":{"properties":{"interval":{"format":"duration","type":"string"},"pendingFor":{"format":"duration","type":"string"}},"title":"EvaluationInterval defines the evaluation frequency and pending duration.","type":"object"},"executionErrorState":{"description":"State to enter if execution fails.","enum":["OK"," Error"," Alerting"],"type":"string"},"isPaused":{"description":"Whether the monitor is paused.","type":"boolean"},"labels":{"additionalProperties":{"type":"string"},"description":"Labels to attach to the monitor/alert.","type":"object"},"measurementType":{"description":"Type of measurement (state or event).","enum":["state"," event"],"type":"string"},"model":{"properties":{"queries":{"description":"List of queries defining the data sources for the monitor.","items":{"properties":{"conditions":{"items":{"properties":{"additionalFilter":{"type":"string"},"autoComplete":{"type":"boolean"},"filterKeys":{"items":{"type":"string"},"type":"array"},"filters":{"items":{"properties":{"op":{"type":"string"},"value":{}},"title":"Filter represents an operation and value for a condition.","type":"object"},"type":"array"},"isNullable":{"type":"boolean"},"key":{"type":"string"},"origin":{"type":"string"},"type":{"type":"string"}},"title":"Condition specifies a search condition based on a column and filters.","type":"object"},"type":"array"},"dataType":{"type":"string"},"datasourceID":{"type":"string"},"datasourceType":{"type":"string"},"expression":{"type":"string"},"filters":{"type":"string"},"instantRollup":{"type":"string"},"name":{"type":"string"},"pipeline":{"properties":{"conditions":{"items":{"properties":{"$ref":"#/paths/~1api~1monitors~1{id}/put/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/conditions/items/properties"},"title":"Condition specifies a search condition based on a column and filters.","type":"object"},"type":"array"},"function":{"properties":{"args":{"items":{"type":"string"},"type":"array"},"name":{"type":"string"},"pipelines":{"items":{"properties":{"$ref":"#/paths/~1api~1monitors~1{id}/put/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/pipeline/properties"},"title":"PromqlPipeline represents a segment of a PromQL query, which can be a metric with conditions, a function, or a template.","type":"object"},"type":"array"}},"title":"PromqlFunction represents a function call in a PromQL query.","type":"object"},"metric":{"description":"Pipeline can either have a metric OR a function OR a template","type":"string"},"template":{"type":"string"}},"title":"PromqlPipeline represents a segment of a PromQL query, which can be a metric with conditions, a function, or a template.","type":"object"},"queryType":{"type":"string"},"relativeTimerange":{"properties":{"from":{"description":"Start of the range relative to now (e.g., \"-5m\", \"-1h\").","format":"duration","type":"string"},"to":{"description":"End of the range relative to now (e.g., \"-1m\", \"now\").","format":"duration","type":"string"}},"title":"RelativeTimerange defines a time range relative to the evaluation time.","type":"object"},"rollup":{"properties":{"function":{"type":"string"},"time":{"description":"Duration wraps time.Duration. It is used to parse the custom duration format\nfrom YAML.\nThis type should not propagate beyond the scope of input/output processing.","format":"int64","type":"integer"}},"type":"object"},"sqlPipeline":{"properties":{"except":{"items":{"properties":{"additionalFilter":{"type":"string"},"alias":{"type":"string"},"autoComplete":{"type":"boolean"},"filterKeys":{"items":{"type":"string"},"type":"array"},"isNullable":{"type":"boolean"},"key":{"type":"string"},"origin":{"type":"string"},"processors":{"items":{"properties":{"args":{"items":{"type":"string"},"type":"array"},"op":{"type":"string"}},"type":"object"},"type":"array"},"type":{"type":"string"}},"type":"object"},"type":"array"},"filters":{"properties":{"conditions":{"items":{"properties":{"$ref":"#/paths/~1api~1monitors~1{id}/put/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/conditions/items/properties"},"title":"Condition specifies a search condition based on a column and filters.","type":"object"},"type":"array"},"disabled":{"type":"boolean"},"groups":{"items":{"properties":{"$ref":"#/paths/~1api~1monitors~1{id}/put/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/sqlPipeline/properties/filters/properties"},"type":"object"},"type":"array"},"operator":{"type":"string"}},"type":"object"},"from":{"properties":{"$ref":"#/paths/~1api~1monitors~1{id}/put/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/sqlPipeline/properties"},"title":"SqlPipeline defines a pipeline for search queries.","type":"object"},"groupBy":{"items":{"properties":{"$ref":"#/paths/~1api~1monitors~1{id}/put/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/sqlPipeline/properties/except/items/properties"},"type":"object"},"type":"array"},"having":{"properties":{"$ref":"#/paths/~1api~1monitors~1{id}/put/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/sqlPipeline/properties/filters/properties"},"type":"object"},"limit":{"format":"uint64","type":"integer"},"offset":{"format":"uint64","type":"integer"},"orderBy":{"items":{"properties":{"direction":{"type":"string"},"selector":{"properties":{"$ref":"#/paths/~1api~1monitors~1{id}/put/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/sqlPipeline/properties/except/items/properties"},"type":"object"}},"title":"SearchOrderBy defines the order for a search pipeline.","type":"object"},"type":"array"},"selectors":{"items":{"properties":{"$ref":"#/paths/~1api~1monitors~1{id}/put/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/sqlPipeline/properties/except/items/properties"},"type":"object"},"type":"array"}},"title":"SqlPipeline defines a pipeline for search queries.","type":"object"}},"title":"BaseQuery is the base struct for different query types.","type":"object"},"type":"array"},"reducers":{"description":"List of reducers to aggregate or transform query results.","items":{"properties":{"expression":{"description":"Math expression (if type is 'math').","type":"string"},"inputName":{"description":"Name of the query or reducer output to use as input.","type":"string"},"name":{"description":"Name of the reducer output.","type":"string"},"relativeTimerange":{"properties":{"$ref":"#/paths/~1api~1monitors~1{id}/put/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/relativeTimerange/properties"},"title":"RelativeTimerange defines a time range relative to the evaluation time.","type":"object"},"type":{"description":"Type of the reducer (e.g., last, min, max, mean, sum, count, math).","type":"string"}},"required":["type"],"title":"ReducerModel defines how to aggregate or transform query results.","type":"object"},"type":"array"},"thresholds":{"description":"List of thresholds to evaluate against the final reduced value.","items":{"properties":{"inputName":{"description":"Name of the reducer output this threshold applies to.","type":"string"},"name":{"description":"Name of the threshold.","type":"string"},"operator":{"description":"Comparison operator.","enum":["gt"," lt"," within_range"," outside_range"],"type":"string"},"relativeTimerange":{"properties":{"$ref":"#/paths/~1api~1monitors~1{id}/put/requestBody/content/application~1json/schema/allOf/0/properties/model/properties/queries/items/properties/relativeTimerange/properties"},"title":"RelativeTimerange defines a time range relative to the evaluation time.","type":"object"},"values":{"description":"Values to compare against (one for gt/lt, two for range operators).","items":{"format":"double","type":"number"},"type":"array"}},"required":["name","inputName","operator","values"],"title":"Threshold defines a condition to evaluate against a reduced value.","type":"object"},"type":"array"}},"required":["queries"],"title":"Model holds the core query/reducer/threshold definitions.","type":"object"},"noDataState":{"description":"State to enter if no data is returned.","enum":["OK"," NoData"," Alerting"],"type":"string"},"routing":{"description":"Routing information.","items":{"type":"string"},"type":"array"},"severity":{"description":"Severity level (e.g., critical, warning, info).","type":"string"},"team":{"description":"Team associated with the monitor.","type":"string"},"title":{"description":"Title of the monitor.","type":"string"}},"required":["title"],"type":"object"}]}}},"description":"Updated monitor definition","required":true}}}}}
```

## DELETE /api/monitors/{id}

> Delete Monitor

OpenAPI:

```json
{"openapi":"3.1.1","info":{"title":"Groundcover API.","version":"1.0.0"},"servers":[{"url":"https://api.groundcover.com"}],"security":[{"Bearer":["[]"]}],"components":{"securitySchemes":{"Bearer":{"in":"header","name":"Authorization","type":"apiKey"}}},"paths":{"/api/monitors/{id}":{"delete":{"description":"Delete Monitor","operationId":"deleteMonitor","parameters":[{"schema":{"type":"string"},"description":"UUID of the monitor to delete","in":"path","name":"id","required":true}],"responses":{"200":{"description":""},"400":{"description":"ErrorResponse defines a common error response structure.","schema":{"properties":{"message":{"type":"string"}},"type":"object"}},"404":{"description":"ErrorResponse defines a common error response structure.","schema":{"$ref":"#/paths/~1api~1monitors~1{id}/delete/responses/400/schema"}},"500":{"description":"ErrorResponse defines a common error response structure.","schema":{"$ref":"#/paths/~1api~1monitors~1{id}/delete/responses/400/schema"}}},"tags":["monitors"]}}}}
```

## Get All Silences

> Retrieves all silences with optional filtering.

OpenAPI:

```json
{"openapi":"3.1.1","info":{"title":"Groundcover API.","version":"1.0.0"},"servers":[{"url":"https://api.groundcover.com"}],"security":[{"Bearer":["[]"]}],"components":{"securitySchemes":{"Bearer":{"in":"header","name":"Authorization","type":"apiKey"}}},"paths":{"/api/monitors/silences":{"get":{"description":"Retrieves all silences with optional filtering.","operationId":"getAllSilences","parameters":[{"schema":{"type":"boolean"},"description":"Filter to show only active silences","in":"query","name":"active"},{"schema":{"type":"integer","format":"int64"},"description":"Maximum number of silences to return","in":"query","name":"limit"},{"schema":{"type":"integer","format":"int64"},"description":"Number of silences to skip","in":"query","name":"skip"}],"responses":{"200":{"description":"","schema":{"items":{"properties":{"active":{"type":"boolean"},"comment":{"type":"string"},"createdBy":{"type":"string"},"createdByEmail":{"type":"string"},"endsAt":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"matchers":{"description":"Matchers is a slice of Matchers that is sortable, implements Stringer, and\nprovides a Matches method to match a LabelSet against all Matchers in the\nslice. Note that some users of Matchers might require it to be sorted.","items":{"properties":{"Name":{"type":"string"},"Type":{"format":"int64","title":"MatchType is an enum for label matching types.","type":"integer"},"Value":{"type":"string"}},"title":"Matcher models the matching of a label.","type":"object"},"type":"array"},"startsAt":{"format":"date-time","type":"string"}},"type":"object"},"type":"array"}},"400":{"description":"ErrorResponse defines a common error response structure.","schema":{"properties":{"message":{"type":"string"}},"type":"object"}},"500":{"description":"ErrorResponse defines a common error response structure.","schema":{"$ref":"#/paths/~1api~1monitors~1silences/get/responses/400/schema"}}},"summary":"Get All Silences","tags":["monitors"]}}}}
```

## Create Silence

> Creates a new silence for monitoring alerts.

OpenAPI:

```json
{"openapi":"3.1.1","info":{"title":"Groundcover API.","version":"1.0.0"},"servers":[{"url":"https://api.groundcover.com"}],"security":[{"Bearer":["[]"]}],"components":{"securitySchemes":{"Bearer":{"in":"header","name":"Authorization","type":"apiKey"}}},"paths":{"/api/monitors/silences":{"post":{"description":"Creates a new silence for monitoring alerts.","operationId":"createSilence","responses":{"200":{"description":"","schema":{"properties":{"active":{"type":"boolean"},"comment":{"type":"string"},"createdBy":{"type":"string"},"createdByEmail":{"type":"string"},"endsAt":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"matchers":{"description":"Matchers is a slice of Matchers that is sortable, implements Stringer, and\nprovides a Matches method to match a LabelSet against all Matchers in the\nslice. Note that some users of Matchers might require it to be sorted.","items":{"properties":{"Name":{"type":"string"},"Type":{"format":"int64","title":"MatchType is an enum for label matching types.","type":"integer"},"Value":{"type":"string"}},"title":"Matcher models the matching of a label.","type":"object"},"type":"array"},"startsAt":{"format":"date-time","type":"string"}},"type":"object"}},"400":{"description":"ErrorResponse defines a common error response structure.","schema":{"properties":{"message":{"type":"string"}},"type":"object"}},"500":{"description":"ErrorResponse defines a common error response structure.","schema":{"$ref":"#/paths/~1api~1monitors~1silences/post/responses/400/schema"}}},"summary":"Create Silence","tags":["monitors"],"requestBody":{"content":{"application/json":{"schema":{"properties":{"BackendID":{"type":"string"},"ClientID":{"type":"string"},"comment":{"description":"Optional comment for the silence","type":"string"},"endsAt":{"description":"End time for the silence (must be after StartsAt)","format":"date-time","type":"string"},"matchers":{"description":"Matchers is a slice of Matchers that is sortable, implements Stringer, and\nprovides a Matches method to match a LabelSet against all Matchers in the\nslice. Note that some users of Matchers might require it to be sorted.","items":{"$ref":"#/paths/~1api~1monitors~1silences/post/responses/200/schema/properties/matchers/items"},"type":"array"},"startsAt":{"description":"Start time for the silence","format":"date-time","type":"string"}},"required":["startsAt","endsAt","matchers"],"type":"object"}}},"description":"Silence creation information","required":true}}}}}
```

## Get Silence by ID

> Retrieves a specific silence by its UUID.

OpenAPI:

```json
{"openapi":"3.1.1","info":{"title":"Groundcover API.","version":"1.0.0"},"servers":[{"url":"https://api.groundcover.com"}],"security":[{"Bearer":["[]"]}],"components":{"securitySchemes":{"Bearer":{"in":"header","name":"Authorization","type":"apiKey"}}},"paths":{"/api/monitors/silences/{id}":{"get":{"description":"Retrieves a specific silence by its UUID.","operationId":"getSilence","parameters":[{"schema":{"type":"string"},"description":"UUID of the silence to retrieve","in":"path","name":"id","required":true}],"responses":{"200":{"description":"","schema":{"properties":{"active":{"type":"boolean"},"comment":{"type":"string"},"createdBy":{"type":"string"},"createdByEmail":{"type":"string"},"endsAt":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"matchers":{"description":"Matchers is a slice of Matchers that is sortable, implements Stringer, and\nprovides a Matches method to match a LabelSet against all Matchers in the\nslice. Note that some users of Matchers might require it to be sorted.","items":{"properties":{"Name":{"type":"string"},"Type":{"format":"int64","title":"MatchType is an enum for label matching types.","type":"integer"},"Value":{"type":"string"}},"title":"Matcher models the matching of a label.","type":"object"},"type":"array"},"startsAt":{"format":"date-time","type":"string"}},"type":"object"}},"400":{"description":"ErrorResponse defines a common error response structure.","schema":{"properties":{"message":{"type":"string"}},"type":"object"}},"404":{"description":"ErrorResponse defines a common error response structure.","schema":{"$ref":"#/paths/~1api~1monitors~1silences~1{id}/get/responses/400/schema"}},"500":{"description":"ErrorResponse defines a common error response structure.","schema":{"$ref":"#/paths/~1api~1monitors~1silences~1{id}/get/responses/400/schema"}}},"summary":"Get Silence by ID","tags":["monitors"]}}}}
```

## Update Silence

> Updates an existing silence by its UUID.

OpenAPI:

```json
{"openapi":"3.1.1","info":{"title":"Groundcover API.","version":"1.0.0"},"servers":[{"url":"https://api.groundcover.com"}],"security":[{"Bearer":["[]"]}],"components":{"securitySchemes":{"Bearer":{"in":"header","name":"Authorization","type":"apiKey"}}},"paths":{"/api/monitors/silences/{id}":{"put":{"description":"Updates an existing silence by its UUID.","operationId":"updateSilence","parameters":[{"schema":{"type":"string"},"description":"UUID of the silence to update","in":"path","name":"id","required":true}],"responses":{"200":{"description":"","schema":{"properties":{"active":{"type":"boolean"},"comment":{"type":"string"},"createdBy":{"type":"string"},"createdByEmail":{"type":"string"},"endsAt":{"format":"date-time","type":"string"},"id":{"format":"uuid","type":"string"},"matchers":{"description":"Matchers is a slice of Matchers that is sortable, implements Stringer, and\nprovides a Matches method to match a LabelSet against all Matchers in the\nslice. Note that some users of Matchers might require it to be sorted.","items":{"properties":{"Name":{"type":"string"},"Type":{"format":"int64","title":"MatchType is an enum for label matching types.","type":"integer"},"Value":{"type":"string"}},"title":"Matcher models the matching of a label.","type":"object"},"type":"array"},"startsAt":{"format":"date-time","type":"string"}},"type":"object"}},"400":{"description":"ErrorResponse defines a common error response structure.","schema":{"properties":{"message":{"type":"string"}},"type":"object"}},"500":{"description":"ErrorResponse defines a common error response structure.","schema":{"$ref":"#/paths/~1api~1monitors~1silences~1{id}/put/responses/400/schema"}}},"summary":"Update Silence","tags":["monitors"],"requestBody":{"content":{"application/json":{"schema":{"properties":{"BackendID":{"type":"string"},"ClientID":{"type":"string"},"comment":{"description":"Optional comment for the silence","type":"string"},"endsAt":{"description":"End time for the silence (must be after StartsAt)","format":"date-time","type":"string"},"matchers":{"description":"Matchers is a slice of Matchers that is sortable, implements Stringer, and\nprovides a Matches method to match a LabelSet against all Matchers in the\nslice. Note that some users of Matchers might require it to be sorted.","items":{"$ref":"#/paths/~1api~1monitors~1silences~1{id}/put/responses/200/schema/properties/matchers/items"},"type":"array"},"startsAt":{"description":"Start time for the silence","format":"date-time","type":"string"}},"type":"object"}}},"description":"Silence update information","required":true}}}}}
```

## Delete Silence

> Deletes a silence by its UUID.

OpenAPI:

```json
{"openapi":"3.1.1","info":{"title":"Groundcover API.","version":"1.0.0"},"servers":[{"url":"https://api.groundcover.com"}],"security":[{"Bearer":["[]"]}],"components":{"securitySchemes":{"Bearer":{"in":"header","name":"Authorization","type":"apiKey"}}},"paths":{"/api/monitors/silences/{id}":{"delete":{"description":"Deletes a silence by its UUID.","operationId":"deleteSilence","parameters":[{"schema":{"type":"string"},"description":"UUID of the silence to delete","in":"path","name":"id","required":true}],"responses":{"200":{"description":""},"400":{"description":"ErrorResponse defines a common error response structure.","schema":{"properties":{"message":{"type":"string"}},"type":"object"}},"500":{"description":"ErrorResponse defines a common error response structure.","schema":{"$ref":"#/paths/~1api~1monitors~1silences~1{id}/delete/responses/400/schema"}}},"summary":"Delete Silence","tags":["monitors"]}}}}
```

## Execute Prometheus query.

> Executes a Prometheus query (instant or range) against the metrics server.\
> Accepts either a direct 'promql' string or components ('pipeline', 'filters', 'conditions', 'subPipelines') to build the query.

OpenAPI:

```json
{"openapi":"3.1.1","info":{"title":"Groundcover API.","version":"1.0.0"},"servers":[{"url":"https://api.groundcover.com"}],"security":[{"Bearer":["[]"]}],"components":{"securitySchemes":{"Bearer":{"in":"header","name":"Authorization","type":"apiKey"}}},"paths":{"/api/metrics/query":{"post":{"description":"Executes a Prometheus query (instant or range) against the metrics server.\nAccepts either a direct 'promql' string or components ('pipeline', 'filters', 'conditions', 'subPipelines') to build the query.","operationId":"metricsQuery","responses":{"200":{"description":"","schema":{}},"400":{"description":"ErrorResponse defines a common error response structure.","schema":{"properties":{"message":{"type":"string"}},"type":"object"}},"500":{"description":"ErrorResponse defines a common error response structure.","schema":{"$ref":"#/paths/~1api~1metrics~1query/post/responses/400/schema"}}},"summary":"Execute Prometheus query.","tags":["metrics"],"requestBody":{"content":{"application/json":{"schema":{"properties":{"Conditions":{"items":{"properties":{"additionalFilter":{"type":"string"},"autoComplete":{"type":"boolean"},"filterKeys":{"items":{"type":"string"},"type":"array"},"filters":{"items":{"properties":{"op":{"type":"string"},"value":{}},"title":"Filter represents an operation and value for a condition.","type":"object"},"type":"array"},"isNullable":{"type":"boolean"},"key":{"type":"string"},"origin":{"type":"string"},"type":{"type":"string"}},"title":"Condition specifies a search condition based on a column and filters.","type":"object"},"type":"array"},"End":{"format":"date-time","type":"string"},"Filters":{"type":"string"},"Pipeline":{"properties":{"conditions":{"items":{"properties":{"$ref":"#/paths/~1api~1metrics~1query/post/requestBody/content/application~1json/schema/properties/Conditions/items/properties"},"title":"Condition specifies a search condition based on a column and filters.","type":"object"},"type":"array"},"function":{"properties":{"args":{"items":{"type":"string"},"type":"array"},"name":{"type":"string"},"pipelines":{"items":{"properties":{"$ref":"#/paths/~1api~1metrics~1query/post/requestBody/content/application~1json/schema/properties/Pipeline/properties"},"title":"PromqlPipeline represents a segment of a PromQL query, which can be a metric with conditions, a function, or a template.","type":"object"},"type":"array"}},"title":"PromqlFunction represents a function call in a PromQL query.","type":"object"},"metric":{"description":"Pipeline can either have a metric OR a function OR a template","type":"string"},"template":{"type":"string"}},"title":"PromqlPipeline represents a segment of a PromQL query, which can be a metric with conditions, a function, or a template.","type":"object"},"Promql":{"type":"string"},"QueryType":{"enum":["range","instant"],"type":"string"},"Start":{"format":"date-time","type":"string"},"Step":{"type":"string"},"SubPipelines":{"additionalProperties":{"properties":{"$ref":"#/paths/~1api~1metrics~1query/post/requestBody/content/application~1json/schema/properties/Pipeline/properties"},"title":"PromqlPipeline represents a segment of a PromQL query, which can be a metric with conditions, a function, or a template.","type":"object"},"description":"KnownPipelines is a map of template names to pipeline templates\nWe need this separate model to prevent circular references in swagger generation","type":"object"}},"type":"object"}}},"description":"Query request parameters for executing Prometheus queries.\nContains fields like time range, step, query type, and either promql or components to build it.","required":true}}}}}
```
