# Update a client template — API reference

> Replaces a Client template's name, description or stored spec.

Source: https://upfour.io/docs/api/client-templates/update-a-client-template

[Developers](https://upfour.io/docs/api.md)/[Client templates](https://upfour.io/docs/api/client-templates.md)

Replaces a Client template's name, description or stored spec.

PUT https://app.upfour.io/v1/client-templates/{templateID}

scope client.write stable returns 200

## Parameters

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

## Body

`application/json` required 3 fields

namestring (required)

All other fields31 fields

descriptionstring

specTemplateSpec

Replaces the stored spec. Omitted stores an empty template.

Nested fields 29 fields

| Field | Type | Description |
| --- | --- | --- |
| `escalation_policies` optional | TemplateEscalationPolicy[] | |
| Each item · 7 fields FieldTypeDescription `description` optional string `name` optional string `steps` optional TemplateEscalationStep[] Each item · 4 fields FieldTypeDescription `after_seconds` optional integer Seconds after the incident starts, not negative. `channel` optional string one of`""` `email` email notifies through the company-wide default email channel; set either channel or targets, not both. `targets` optional uuid[] Ids of alert channels that belong to the whole company, not to one client. `urgency` optional string one of`""` `sms` `voice` `high` `low` | | |
| `monitors` optional | TemplateMonitor[] | |
| Each item · 12 fields FieldTypeDescription `alert_type` optional string one of`status` `keyword` `keyword_absence` `expected_status_code` Omitted means status. `dns_query` optional string `dns_type` optional string one of`A` `AAAA` `MX` `CNAME` `TXT` `NS` Omitted means A. `host_from` optional string Host of a tcp or ping monitor, used when tcp_host is empty; takes the same placeholders. `http_method` optional string Omitted means HEAD. `interval` optional integer Check interval in seconds; 0 or omitted means 180. `kind` optional string one of`http` `tcp` `ping` `dns` `name` optional string `name_from` optional string Monitor name, used when name is empty. Placeholders {{domain}}, {{client_name}}, {{contact_email}} and {{client_slug}} are filled when the template is applied. `tcp_host` optional string `tcp_port` optional integer `url` optional string Address to check; takes the same placeholders as name_from. | | |
| `status_pages` optional | TemplateStatusPage[] | |
| Each item · 7 fields FieldTypeDescription `apply_design_assets` optional boolean Also copies the design's brand images; needs design_template_id. `apply_design_css` optional boolean Also copies the design's custom CSS; needs design_template_id. `design_template_id` optional uuid  · nullable A status page design of the company the page starts from. `include_all_monitors` optional boolean `name` optional string Page name with placeholders; empty becomes the client name followed by status. `subdomain` optional string Address of the page; a taken one gets a numeric suffix. Empty uses subdomain_from, then the client slug. `subdomain_from` optional string Same as subdomain, with the placeholders of name_from. | | |

## Returns

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

Response fields 1 top-level fields

| Field | Type | Description |
| --- | --- | --- |
| `data` | ClientTemplateView | |
| ClientTemplateView · 15 fields FieldTypeDescription `created_at` string (date-time) `description` string `design_templates` object[]  · nullable The status page designs the spec refers to. Each item · 7 fields FieldTypeDescription `id` uuid `asset_kinds` string[] `includes_css` boolean `layout` string `missing` boolean True, with only id present, when the design no longer exists. `name` string `revision` integer `id` uuid `name` string `organization_id` uuid `spec` any The spec as stored: the monitors, escalation_policies and status_pages lists described in the request, each optional. `updated_at` string (date-time) | | |

## 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 | [design_template_not_found](https://upfour.io/docs/api/errors#code-design_template_not_found) | The design template does not exist or is not visible to the caller. **When:** A design template id in the path or body that is unknown or not visible to the caller. **Fix:** List design templates and use an id from the list. |
| 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. |

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

[PreviousGet a client template](https://upfour.io/docs/api/client-templates/get-a-client-template.md) [NextDelete a client template](https://upfour.io/docs/api/client-templates/delete-a-client-template.md)

## Request

### cURL

```bash
curl -s -X PUT "https://app.upfour.io/v1/client-templates/00000000-0000-4000-8000-000000000001" \
  -H "Authorization: Bearer $UP4_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "One website monitor per client, checked every 3 minutes.",
    "name": "Website starter",
    "spec": {
      "monitors": [
        {
          "interval": 180,
          "kind": "http",
          "name_from": "{{domain}}",
          "url": "https://{{domain}}"
        }
      ]
    }
  }'
```

### JavaScript

```javascript
const res = await fetch("https://app.upfour.io/v1/client-templates/00000000-0000-4000-8000-000000000001", {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.UP4_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    description: "One website monitor per client, checked every 3 minutes.",
    name: "Website starter",
    spec: {
      monitors: [
        {
          interval: 180,
          kind: "http",
          name_from: "{{domain}}",
          url: "https://{{domain}}",
        },
      ],
    },
  }),
});
console.log(res.status, await res.json());
```

### Python

```python
import os
import requests

res = requests.put(
    "https://app.upfour.io/v1/client-templates/00000000-0000-4000-8000-000000000001",
    headers={"Authorization": f"Bearer {os.environ['UP4_API_KEY']}"},
    json={
        "description": "One website monitor per client, checked every 3 minutes.",
        "name": "Website starter",
        "spec": {
            "monitors": [
                {
                    "interval": 180,
                    "kind": "http",
                    "name_from": "{{domain}}",
                    "url": "https://{{domain}}",
                },
            ],
        },
    },
)
print(res.status_code, res.json())
```

### Go

```go
package main

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

func main() {
	payload := strings.NewReader(`{
  "description": "One website monitor per client, checked every 3 minutes.",
  "name": "Website starter",
  "spec": {
    "monitors": [
      {
        "interval": 180,
        "kind": "http",
        "name_from": "{{domain}}",
        "url": "https://{{domain}}"
      }
    ]
  }
}`)
	req, _ := http.NewRequest("PUT", "https://app.upfour.io/v1/client-templates/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'
{
  "description": "One website monitor per client, checked every 3 minutes.",
  "name": "Website starter",
  "spec": {
    "monitors": [
      {
        "interval": 180,
        "kind": "http",
        "name_from": "{{domain}}",
        "url": "https://{{domain}}"
      }
    ]
  }
}
JSON;

$ch = curl_init("https://app.upfour.io/v1/client-templates/00000000-0000-4000-8000-000000000001");
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => "PUT",
    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": {
    "created_at": "2026-10-27T09:00:00Z",
    "description": "One website monitor per client, checked every 3 minutes.",
    "design_templates": [],
    "id": "00000000-0000-4000-8000-000000000001",
    "name": "Website starter",
    "organization_id": "00000000-0000-4000-8000-000000000002",
    "spec": {
      "monitors": [
        {
          "interval": 180,
          "kind": "http",
          "name_from": "{{domain}}",
          "url": "https://{{domain}}"
        }
      ]
    },
    "updated_at": "2026-10-27T09:00:00Z"
  }
}
```

### 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": "design_template_not_found",
    "message": "The design template does not exist or is not visible to the caller.",
    "request_id": "req_…"
  }
}
```
