# Update a connected machine — API reference

> Renames a machine or changes its event selection, suspicion events or offline alarm.

Source: https://upfour.io/docs/api/runners/update-a-connected-machine

[Developers](https://upfour.io/docs/api.md)/[Connected machines](https://upfour.io/docs/api/runners.md)

Renames a machine or changes its event selection, suspicion events or offline alarm.

PATCH https://app.upfour.io/v1/runners/{runnerID}

scope api_key.write stable [Idempotency-Key supported](https://upfour.io/docs/api/idempotency.md) returns 200

## Parameters

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

## Body

`application/json` optional 4 fields

All other fields6 fields

event_typesstring[]

null for every confirmed type, or a non-empty list of names from the webhook catalogue.

In the app: **Events**

namestring · nullable

New display name, 1 to 64 printable characters. Also renames the scheduled job of the offline alarm.

In the app: **Machine name**

offline_alertRunnerOfflineAlertInput · nullable

Switch the offline alarm on or off and set its grace_seconds.

Nested fields 2 fields

| Field | Type | Description |
| --- | --- | --- |
| `enabled` optional | boolean  · nullable | In the app: **Alert when the machine is offline** |
| `grace_seconds` optional | integer  · nullable | In the app: **Alert after** |

suspicion_enabledboolean · nullable

In the app: **Suspected outages**

## Returns

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

Response fields 1 top-level fields

| Field | Type | Description |
| --- | --- | --- |
| `data` | RunnerView | |
| RunnerView · 41 fields FieldTypeDescription `arch` string `cli_version` string `connected_since` string (date-time)  · nullable Start of the oldest open stream. Null while offline. `delivery` RunnerDeliveryView Delivery time from confirmation to the machine over the last 7 days. Suspicion events are measured apart. RunnerDeliveryView · 8 fields FieldTypeDescription `last_event_at` string (date-time)  · nullable `p50_ms` integer  · nullable Null without samples. `p95_ms` integer  · nullable Null without samples. `samples` integer `suspicion` RunnerLatencyView RunnerLatencyView · 3 fields FieldTypeDescription `p50_ms` integer  · nullable Null without samples. `p95_ms` integer  · nullable Null without samples. `samples` integer `event_types` string[]  · nullable Confirmed event types the machine receives. Null receives every type of the webhook catalogue except webhook.test. `first_seen_at` string (date-time) `host` string Host name the CLI reports with X-Up4-Runner-Host. Display only. `id` uuid `key` RunnerKeyView  · nullable The API key the machine used last. Null when that key was deleted. RunnerKeyView · 4 fields FieldTypeDescription `allowed_clients` uuid[]  · nullable Clients the key is limited to. Empty: the key reaches the company and every client. `id` uuid `name` string `scopes` string[]  · nullable Permission scopes the key carries, for example runner.stream.read. `last_deferred` RunnerDeferralView  · nullable The latest action the machine left to another machine because that one held the lock. Null without one. RunnerDeferralView · 4 fields FieldTypeDescription `at` string (date-time) `handler` string `runner_id` uuid The machine that held the lock. `runner_name` string `last_run` RunnerLastRunView  · nullable The latest handler run the machine reported, started or finished. Null without one, or when its client is outside your access. RunnerLastRunView · 6 fields FieldTypeDescription `at` string (date-time) When upfour received the latest report of the run. `client_id` uuid  · nullable The incident's client. Null at company level. `handler` string `incident_id` uuid `kind` string `outcome` string  · nullable one of`succeeded` `failed` `timeout` `unknown` Null while the run is in progress. unknown: the machine stopped reporting mid-run and its lock expired; no other machine repeated the action. `last_seen_at` string (date-time) `name` string Display name. Taken from X-Up4-Runner-Name on the first connection; a rename here sticks across later connections. `offline_alert` RunnerOfflineAlertView The offline alarm. While enabled, upfour keeps a scheduled job for the machine that turns down after grace_seconds without a connection, with the alerts of a scheduled job. RunnerOfflineAlertView · 2 fields FieldTypeDescription `enabled` boolean `grace_seconds` integer Seconds without a connection before the alarm. `online` boolean True while at least one stream of the machine is open on any instance. `os` string `suspicion_enabled` boolean Whether the machine also receives monitor.suspected and monitor.suspicion_cleared, the unconfirmed early warnings. | | |

## 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. |
| 403 | [permission_denied](https://upfour.io/docs/api/errors#code-permission_denied) | The credentials do not permit this action. |
| 503 | [service_unavailable](https://upfour.io/docs/api/errors#code-service_unavailable) | The service or a required dependency is temporarily unavailable. |
| 400 | documented response | An unknown field, an event type outside the webhook catalogue, an empty event_types list, an invalid name or a grace_seconds outside the allowed range. |
| 404 | documented response | No machine with this ID in the Company, or it was removed. |

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 connected machines](https://upfour.io/docs/api/runners/list-connected-machines.md) [NextRemove a connected machine](https://upfour.io/docs/api/runners/remove-a-connected-machine.md)

## Request

### cURL

```bash
curl -s -X PATCH "https://app.upfour.io/v1/runners/00000000-0000-4000-8000-000000000001" \
  -H "Authorization: Bearer $UP4_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "event_types": [
      "incident.opened",
      "incident.resolved"
    ],
    "offline_alert": {
      "enabled": true,
      "grace_seconds": 300
    }
  }'
```

### JavaScript

```javascript
const res = await fetch("https://app.upfour.io/v1/runners/00000000-0000-4000-8000-000000000001", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.UP4_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    event_types: ["incident.opened", "incident.resolved"],
    offline_alert: {
      enabled: true,
      grace_seconds: 300,
    },
  }),
});
console.log(res.status, await res.json());
```

### Python

```python
import os
import requests

res = requests.patch(
    "https://app.upfour.io/v1/runners/00000000-0000-4000-8000-000000000001",
    headers={"Authorization": f"Bearer {os.environ['UP4_API_KEY']}"},
    json={
        "event_types": ["incident.opened", "incident.resolved"],
        "offline_alert": {
            "enabled": True,
            "grace_seconds": 300,
        },
    },
)
print(res.status_code, res.json())
```

### Go

```go
package main

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

func main() {
	payload := strings.NewReader(`{
  "event_types": [
    "incident.opened",
    "incident.resolved"
  ],
  "offline_alert": {
    "enabled": true,
    "grace_seconds": 300
  }
}`)
	req, _ := http.NewRequest("PATCH", "https://app.upfour.io/v1/runners/00000000-0000-4000-8000-000000000001", payload)
	req.Header.Set("Authorization", "Bearer "+os.Getenv("UP4_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	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
$payload = <<<'JSON'
{
  "event_types": [
    "incident.opened",
    "incident.resolved"
  ],
  "offline_alert": {
    "enabled": true,
    "grace_seconds": 300
  }
}
JSON;

$ch = curl_init("https://app.upfour.io/v1/runners/00000000-0000-4000-8000-000000000001");
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => "PATCH",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("UP4_API_KEY"),
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), " ", $response, "\n";
curl_close($ch);
```

## Response

### 200

```json
{
  "data": {
    "arch": "amd64",
    "cli_version": "1.0.0",
    "connected_since": "2026-11-19T08:00:00Z",
    "delivery": {
      "last_event_at": "2026-11-19T08:42:10Z",
      "p50_ms": 180,
      "p95_ms": 420,
      "samples": 128,
      "suspicion": {
        "p50_ms": null,
        "p95_ms": null,
        "samples": 0
      }
    },
    "event_types": [
      "incident.opened",
      "incident.resolved"
    ],
    "first_seen_at": "2026-11-12T09:30:00Z",
    "host": "build-01.internal",
    "id": "00000000-0000-4000-8000-000000000001",
    "key": {
      "allowed_clients": [],
      "id": "00000000-0000-4000-8000-000000000002",
      "name": "Build server",
      "scopes": [
        "runner.stream.read",
        "incident.read",
        "runner.report.write"
      ]
    },
    "last_deferred": null,
    "last_run": {
      "at": "2026-11-19T08:42:14Z",
      "client_id": null,
      "handler": "restart-php-fpm",
      "incident_id": "00000000-0000-4000-8000-000000000003",
      "kind": "exec",
      "outcome": "succeeded"
    },
    "last_seen_at": "2026-11-19T09:00:00Z",
    "name": "build-01",
    "offline_alert": {
      "enabled": true,
      "grace_seconds": 300
    },
    "online": true,
    "os": "linux",
    "suspicion_enabled": false
  }
}
```

### 400

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

### 403

```json
{
  "error": {
    "code": "permission_denied",
    "message": "The credentials do not permit this action.",
    "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_…"
  }
}
```

### 503

```json
{
  "error": {
    "code": "service_unavailable",
    "message": "The service or a required dependency is temporarily unavailable.",
    "request_id": "req_…"
  }
}
```
