# Get the latest alert plan test run — API reference

> Returns the latest test run, or no content when the plan has not been tested.

Source: https://upfour.io/docs/api/escalation-policies/get-the-latest-alert-plan-test-run

[Developers](https://upfour.io/docs/api.md)/[Alert plans (escalation policies)](https://upfour.io/docs/api/escalation-policies.md)

Returns the latest test run, or no content when the plan has not been tested.

GET https://app.upfour.io/v1/escalation-policies/{policyID}/test-runs/latest

scope escalation_policy.read stable returns 200

## Parameters

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

## Returns

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

Response fields 1 top-level fields

| Field | Type | Description |
| --- | --- | --- |
| `data` | EscalationPolicyTestRun | |
| EscalationPolicyTestRun · 22 fields FieldTypeDescription `created_at` string (date-time) `id` uuid `mode` string one of`step` `full` `policy_id` uuid `status` string one of`scheduled` `in_progress` `delivered` `failed` `steps` EscalationPolicyTestStep[]  · nullable Each item · 16 fields FieldTypeDescription `position` integer Zero-based position of the step within the plan. `scheduled_at` string (date-time) `status` string one of`scheduled` `in_progress` `delivered` `failed` `targets` EscalationPolicyTestTarget[]  · nullable Each item · 10 fields FieldTypeDescription `attempts` integer `channel_id` uuid Nil UUID for a rotation that reached nobody. `channel_name` string `channel_type` string `status` string one of`scheduled` `in_progress` `delivered` `failed` `unresolved` `error` string `person_name` string Who was on call for the rotation when the test started. `reason` string one of`nobody_on_call` `no_alert_channel` `rotation_unavailable` `rotation_id` uuid The rotation this channel was reached through, if any. `rotation_name` string `urgency` string one of`high` `low` `sms` `voice` `wait_seconds` integer | | |

## 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).

[PreviousTest an alert plan](https://upfour.io/docs/api/escalation-policies/test-an-alert-plan.md) [NextGet an alert plan test run](https://upfour.io/docs/api/escalation-policies/get-an-alert-plan-test-run.md)

## Request

### cURL

```bash
curl -s "https://app.upfour.io/v1/escalation-policies/00000000-0000-4000-8000-000000000001/test-runs/latest" \
  -H "Authorization: Bearer $UP4_API_KEY"
```

### JavaScript

```javascript
const res = await fetch("https://app.upfour.io/v1/escalation-policies/00000000-0000-4000-8000-000000000001/test-runs/latest", {
  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/escalation-policies/00000000-0000-4000-8000-000000000001/test-runs/latest",
    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/escalation-policies/00000000-0000-4000-8000-000000000001/test-runs/latest", 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/escalation-policies/00000000-0000-4000-8000-000000000001/test-runs/latest");
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": {
    "created_at": "2026-10-27T09:00:00Z",
    "id": "00000000-0000-4000-8000-000000000002",
    "mode": "full",
    "policy_id": "00000000-0000-4000-8000-000000000001",
    "status": "scheduled",
    "steps": [
      {
        "position": 0,
        "scheduled_at": "2026-10-27T09:00:00Z",
        "status": "scheduled",
        "targets": [
          {
            "attempts": 0,
            "channel_id": "00000000-0000-4000-8000-000000000003",
            "channel_name": "On-call email",
            "channel_type": "email",
            "status": "scheduled"
          }
        ],
        "urgency": "high",
        "wait_seconds": 0
      }
    ]
  }
}
```

### 204

```
The policy has no test run yet.
```

### 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_…"
  }
}
```
