# Get the outage pattern — API reference

> Tells whether the monitor's unstable phases of the last 14 days keep starting around the same time of day, and in which window.

Source: https://upfour.io/docs/api/monitors/get-outage-pattern

[Developers](https://upfour.io/docs/api.md)/[Monitors](https://upfour.io/docs/api/monitors.md)

Tells whether the monitor's unstable phases of the last 14 days keep starting around the same time of day, and in which window.

GET https://app.upfour.io/v1/monitors/{monitorID}/patterns

scope monitor.read stable returns 200

## Parameters

| Field | Type | Description |
| --- | --- | --- |
| `monitorID` required | uuid | path parameter |

## Returns

A successful request returns `200` with application/json.

Response fields 1 top-level fields

| Field | Type | Description |
| --- | --- | --- |
| `data` | MonitorPattern | |
| MonitorPattern · 27 fields FieldTypeDescription `consecutive_days` integer Days in a row with a matching phase, ending with the newest one. `detected` boolean True when at least 3 unstable phases (alert episodes with measured downtime) of the last 14 days started on different local days within 7 days and inside one 90-minute window of the time of day. Computed when read, in the Company time zone. `night` boolean True when the whole window lies between 22:00 and 06:00 local time. `phases` MonitorPatternPhase[]  · nullable Each item · 5 fields FieldTypeDescription `down_seconds` number `episode_id` uuid `local_date` string `local_time` string `started_at` string (date-time) `phases_considered` integer `rules` MonitorPatternRules MonitorPatternRules · 4 fields FieldTypeDescription `lookback_days` integer `min_phases` integer `span_days` integer `window_minutes` integer `timezone` string `drift` MonitorPatternDrift MonitorPatternDrift · 2 fields FieldTypeDescription `direction` string `minutes_per_day` number Average minutes the start moves per day; only present when every day moves the same way by a roughly constant amount. `newest` MonitorPatternPhase MonitorPatternPhase · 5 fields FieldTypeDescription `down_seconds` number `episode_id` uuid `local_date` string `local_time` string `started_at` string (date-time) `window_end` string Latest local time of day (HH:MM) of the matching phases. `window_start` string Earliest local time of day (HH:MM) of the matching phases. The window can cross midnight. | | |

## Errors

Only the errors this operation can return. Every error uses the [same envelope](https://upfour.io/docs/api/responses.md).

| Status | Code | Meaning |
| --- | --- | --- |
| 400 | [bad_request](https://upfour.io/docs/api/errors#code-bad_request) | The request is malformed or fails validation. |
| 404 | [not_found](https://upfour.io/docs/api/errors#code-not_found) | The requested resource does not exist or is outside the caller's scope. |

Every call can also return `unauthorized` (401), `rate_limit_exceeded` (429) or `internal_error` (500 / 502). See [Responses and errors](https://upfour.io/docs/api/responses.md).

[PreviousList regions](https://upfour.io/docs/api/monitors/list-regions.md) [NextGet the summary](https://upfour.io/docs/api/monitors/get-the-summary.md)

## Request

### cURL

```bash
curl -s "https://app.upfour.io/v1/monitors/3f6c1a52-8b1e-4f0d-9a43-2c5d7e8f1a90/patterns" \
  -H "Authorization: Bearer $UP4_API_KEY"
```

### JavaScript

```javascript
const res = await fetch("https://app.upfour.io/v1/monitors/3f6c1a52-8b1e-4f0d-9a43-2c5d7e8f1a90/patterns", {
  headers: {
    Authorization: `Bearer ${process.env.UP4_API_KEY}`,
  },
});
console.log(res.status, await res.json());
```

### Python

```python
import os
import requests

res = requests.get(
    "https://app.upfour.io/v1/monitors/3f6c1a52-8b1e-4f0d-9a43-2c5d7e8f1a90/patterns",
    headers={"Authorization": f"Bearer {os.environ['UP4_API_KEY']}"},
)
print(res.status_code, res.json())
```

### Go

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	req, _ := http.NewRequest("GET", "https://app.upfour.io/v1/monitors/3f6c1a52-8b1e-4f0d-9a43-2c5d7e8f1a90/patterns", nil)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("UP4_API_KEY"))
	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	out, _ := io.ReadAll(res.Body)
	fmt.Println(res.StatusCode, string(out))
}
```

### PHP

```php
<?php
$ch = curl_init("https://app.upfour.io/v1/monitors/3f6c1a52-8b1e-4f0d-9a43-2c5d7e8f1a90/patterns");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("UP4_API_KEY"),
    ],
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), " ", $response, "\n";
curl_close($ch);
```

## Response

### 200

```json
{
  "data": {
    "consecutive_days": 1,
    "detected": false,
    "night": false,
    "phases": [
      {
        "down_seconds": 1,
        "episode_id": "3f6c1a52-8b1e-4f0d-9a43-2c5d7e8f1a90",
        "local_date": "example",
        "local_time": "example",
        "started_at": "2026-01-15T09:30:00Z"
      }
    ],
    "phases_considered": 1,
    "rules": {
      "lookback_days": 1,
      "min_phases": 1,
      "span_days": 1,
      "window_minutes": 1
    },
    "timezone": "example"
  }
}
```

### 400

```json
{
  "error": {
    "code": "bad_request",
    "message": "The request is malformed or fails validation.",
    "request_id": "req_…"
  }
}
```

### 404

```json
{
  "error": {
    "code": "not_found",
    "message": "The requested resource does not exist or is outside the caller's scope.",
    "request_id": "req_…"
  }
}
```
