{"openapi":"3.0.3","info":{"title":"UpTime Watch External REST API","version":"1.0.0","description":"External REST API for managing monitors and fetching checks + derived incident timelines. Authentication uses scoped bearer API tokens."},"servers":[{"url":"/external/api/v1","description":"External API base path"}],"tags":[{"name":"Monitors"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API token","description":"Paste your API token value. Use the format: `Bearer <token>` in the Authorization header."}},"schemas":{"ErrorResponse":{"type":"object","additionalProperties":true},"MonitorTypeInput":{"type":"string","enum":["http_ok","response_time","response_contains_text","ssl_expiry","domain_expiry","screenshot_diff","dns","heartbeat","analysis"]},"MonitorType":{"type":"string","enum":["HTTP_OK","RESPONSE_TIME","RESPONSE_CONTAINS_TEXT","SSL_EXPIRY","DOMAIN_EXPIRY","SCREENSHOT_DIFF","DNS","HEARTBEAT","ANALYSIS"]},"Monitor":{"type":"object","required":["id","name","url","type","intervalMin","active","region","regions","createdAt","lastCheckedAt","lastHeartbeatAt"],"properties":{"id":{"type":"string","description":"Monitor id (cuid)"},"name":{"type":"string"},"url":{"type":"string"},"type":{"$ref":"#/components/schemas/MonitorType"},"intervalMin":{"type":"integer","minimum":1,"maximum":1440},"active":{"type":"boolean"},"region":{"type":"string","description":"Legacy primary region"},"regions":{"type":"array","items":{"type":"string"},"minItems":1},"createdAt":{"type":"string","format":"date-time"},"lastCheckedAt":{"type":"string","format":"date-time","nullable":true},"lastHeartbeatAt":{"type":"string","format":"date-time","nullable":true}}},"ListMonitorsResponse":{"type":"object","required":["data","nextCursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Monitor"}},"nextCursor":{"type":"string","nullable":true}}},"CreateMonitorRequest":{"type":"object","required":["name","url"],"properties":{"name":{"type":"string","minLength":1,"maxLength":100},"url":{"type":"string","minLength":1,"maxLength":2048},"type":{"$ref":"#/components/schemas/MonitorTypeInput"},"intervalMin":{"type":"integer","minimum":1,"maximum":1440},"active":{"type":"boolean"},"region":{"type":"string","description":"Legacy alias for regions[0]"},"regions":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":10}},"additionalProperties":false},"UpdateMonitorRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"url":{"type":"string","minLength":1,"maxLength":2048},"type":{"$ref":"#/components/schemas/MonitorTypeInput"},"intervalMin":{"type":"integer","minimum":1,"maximum":1440},"active":{"type":"boolean"},"region":{"type":"string","description":"Legacy alias for regions[0]"},"regions":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":10}},"additionalProperties":false},"Incident":{"type":"object","required":["start","end","failedCheckCount"],"properties":{"start":{"type":"string","format":"date-time"},"end":{"type":"string","format":"date-time","nullable":true},"failedCheckCount":{"type":"integer","minimum":0}}},"Check":{"type":"object","additionalProperties":true},"MonitorChecksResponse":{"type":"object","required":["from","to","page","pageSize","totalCount","totalPages","uptimePct","checks","incidents"],"properties":{"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"},"page":{"type":"integer","minimum":1},"pageSize":{"type":"integer","minimum":1},"totalCount":{"type":"integer","minimum":0},"totalPages":{"type":"integer","minimum":1},"uptimePct":{"type":"string","nullable":true,"description":"Percentage with one decimal place"},"checks":{"type":"array","items":{"$ref":"#/components/schemas/Check"}},"incidents":{"type":"array","items":{"$ref":"#/components/schemas/Incident"}}}}}},"security":[{"bearerAuth":[]}],"paths":{"/monitors":{"get":{"tags":["Monitors"],"summary":"List monitors","operationId":"listMonitors","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListMonitorsResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"tags":["Monitors"],"summary":"Create a monitor","operationId":"createMonitor","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateMonitorRequest"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Monitor"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/monitors/{id}":{"patch":{"tags":["Monitors"],"summary":"Update a monitor","operationId":"updateMonitor","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMonitorRequest"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Monitor"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"delete":{"tags":["Monitors"],"summary":"Delete a monitor","operationId":"deleteMonitor","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"No content"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/monitors/{id}/checks":{"get":{"tags":["Monitors"],"summary":"Fetch checks + derived incidents for a monitor","operationId":"getMonitorChecks","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"from","in":"query","required":true,"schema":{"type":"string","format":"date-time"}},{"name":"to","in":"query","required":true,"schema":{"type":"string","format":"date-time"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonitorChecksResponse"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}