# Update status page resource

Update an existing status page resource. Send only the parameters you wish to change (e.g. `public_name`), and note that `resource_id` and `resource_type` should be sent together.

[endpoint]
base_url = "https://uptime.betterstack.com"
path = "/api/v2/status-pages/{status_page_id}/resources/{resource_id}"
method = "PATCH"

[[path_param]]
name = "status_page_id"
description = "The ID of your status page"
required = true
type = "string"

[[path_param]]
name = "resource_id"
description = "The resource you want to update"
required = true
type = "string"

[[body_param]]
name = "status_page_section_id"
description = "The ID of the section which should contain this resource. When omitted, defaults to the first section on the status page."
required = false
type = "integer"

[[body_param]]
name = "widget_type"
description = "What widget to display for this resource. Available values:\n\n- `plain` - Only display status.\n- `history` - Display historical status.\n- `intraday_history` - Display detailed historical status.\n- `response_times` - Add a response times chart. Only for `Monitor` or `LogsChart`.\n- `chart_only` - Shows just the chart. Only for `LogsChart`.\n\nThis takes preference over `history` when both parameters are present."
required = false
type = "string"

[[body_param]]
name = "resource_id"
description = "The ID of the resource you are adding. Omit or set to `null` when `resource_type` is `ManuallyTrackedItem`."
required = false
type = "string"

[[body_param]]
name = "resource_type"
description = "The type of the resource you are adding. Available values: `ManuallyTrackedItem`, `Monitor`, `MonitorGroup`, `Heartbeat`, `HeartbeatGroup`, `WebhookIntegration`, `EmailIntegration`, `IncomingWebhook`, `ResourceGroup`, `LogsChart`, `CatalogReference`"
required = false
type = "string"

[[body_param]]
name = "public_name"
description = "The resource name displayed publicly on your status page."
required = false
type = "string"

[[body_param]]
name = "explanation"
description = "A detailed text displayed as a help icon."
required = false
type = "string"

[[body_param]]
name = "position"
description = "The position of this resource on your status page, indexed from zero. If you don't specify a `position`, we add the resource to the end of the status page. When you specify a `position` of an existing resource, we add the resource to this position and shift resources below to accommodate."
required = false
type = "integer"

[[body_param]]
name = "mark_as_down_for"
description = "How the resource status is affected when an incident occurs. Possible values: `any_incident`, `no_incident`, `incident_matching_metadata`. Defaults to `any_incident`."
required = false
type = "string"

[[body_param]]
name = "mark_as_down_metadata_rule"
description = '''A rule to match incident metadata. Required when `mark_as_down_for` is `incident_matching_metadata`. The rule is a JSON object with `key` and `values` fields. See the [metadata API response params](https://betterstack.com/docs/uptime/api/metadata-api-response-params/) for details about metadata value attributes.'''
required = false
type = "object"

[[body_param]]
name = "mark_as_degraded_for"
description = "How the resource status is affected when an incident occurs. Possible values: `any_incident`, `no_incident`, `incident_matching_metadata`. Defaults to `no_incident`."
required = false
type = "string"

[[body_param]]
name = "mark_as_degraded_metadata_rule"
description = '''A rule to match incident metadata. Required when `mark_as_degraded_for` is `incident_matching_metadata`. The rule is a JSON object with `key` and `values` fields. See the [metadata API response params](https://betterstack.com/docs/uptime/api/metadata-api-response-params/) for details about metadata value attributes.'''
required = false
type = "object"

[[body_param]]
name = "fixed_position"
description = "If set to `true`, position reorders will be prevented."
required = false
type = "boolean"

[[header]]
name = "Authorization"
description = "Bearer `$TOKEN`"
required = true
type = "string"

[[header]]
name = "Content_Type"
description = "application/json"
required = false
type = "string"
[/endpoint]

[responses]
[[response]]
status = 200
description = ''''''
body = '''{
  "data": {
    "id": "12345",
    "type": "status_page_resource",
    "attributes": {
      "status_page_section_id": 456789,
      "resource_id": 112233,
      "resource_type": "Monitor",
      "history": true,
      "widget_type": "history",
      "public_name": "https://uptime.betterstack.com/",
      "explanation": "",
      "position": 0,
      "mark_as_down_for": "incident_matching_metadata",
      "mark_as_down_metadata_rule": {
        "key": "Default escalation policy",
        "values": [
          {
            "type": "Policy",
            "item_id": "102683",
            "name": "Primary policy"
          }
        ]
      },
      "mark_as_degraded_for": "any_incident",
      "availability": 0.99963,
      "status": "operational",
      "status_history": [
        {
          "day": "2022-01-01",
          "status": "operational",
          "downtime_duration": 0,
          "maintenance_duration": 0
        },
        {
          "day": "2022-01-02",
          "status": "downtime",
          "downtime_duration": 120.0,
          "maintenance_duration": 0
        }
      ]
    }
  }
}'''
[/responses]

#### Example cURL 

[code-tabs]
```shell
[label Example]
curl --request PATCH \
  --url https://uptime.betterstack.com/api/v2/status-pages/123456789/resources/12345 \
  --header "Authorization: Bearer $TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
  	"public_name": "My great monitor, updated"
  }'
```
```shell
[label Metadata rules]
curl --request PATCH \
  --url https://uptime.betterstack.com/api/v2/status-pages/123456789/resources/12345 \
  --header "Authorization: Bearer $TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
  	"mark_as_down_for": "incident_matching_metadata",
  	"mark_as_down_metadata_rule": {
      "key": "Severity",
      "values": [{ "value": "high" }]
    }
  	"mark_as_degraded_for": "all_incidents",
  }'
```
```shell
[label Metadata using email]
curl --request PATCH \
  --url https://uptime.betterstack.com/api/v2/status-pages/123456789/resources/12345 \
  --header "Authorization: Bearer $TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
  	"mark_as_down_for": "incident_matching_metadata",
  	"mark_as_down_metadata_rule": {
      "key": "Responsible team member",
      "values": [{ "email": 12345, "type": "User" }]
    }
  }'
```
[/code-tabs]

[info]
#### Looking for the details of a specific parameter?
Explore [the list of all status page resources API parameters](https://betterstack.com/docs/uptime/api/status-page-resources-api-response-params/)
[/info]
