---
title: "Update Host Label Rule"
method: PUT
path: "/host-label-rule/{id}"
tags: ["Host Label Rule"]
---

# Update Host Label Rule

`PUT /host-label-rule/{id}`

## Request

- Base URL: `https://oneuptime.com/api`
- URL: `https://oneuptime.com/api/host-label-rule/{id}`
- Auth: API key in header `APIKey`
- TypeScript: <https://skmtc.dev/oneuptime/apis/oneuptime-openapi-specification/docs/host-label-rule/:id/put.ts> (a function with typed inputs; its response is checked against the schema)

Endpoint to update an existing Host Label Rule

## Path parameters

- `id` string, uuid, required

## Request body

- object
  - `data` HostLabelRuleUpdateSchema, required: Update schema for HostLabelRule model. Update
    - `criteria` object: Versioned conditions that determine whether this rule matches a resource. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
    - `name` string: Name of this host label rule. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
    - `description` string: Description of this host label rule. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
    - `isEnabled` boolean: Whether this rule is enabled. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
    - `hostLabels` object[]: Only trigger for hosts that already have at least one of these labels. Leave empty to match regardless of labels. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
      - `id` string
    - `hostNamePattern` string: Regex (case-insensitive) matched against the host name. Leave empty to match any name. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
    - `hostDescriptionPattern` string: Regex (case-insensitive) matched against the host description. Leave empty to match any description. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
    - `labelsToAdd` object[]: Labels to attach to the host when this rule matches. Already-attached labels are not duplicated. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
      - `id` string

## Response `200`

Updated successfully

- object
  - `data` HostLabelRuleReadSchema: Read schema for HostLabelRule model. Read
    - `_id` string, uuid: ID of this object. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
    - `createdAt` object: Date and Time when the object was created. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
    - `updatedAt` object: Date and Time when the object was updated. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
    - `deletedAt` object: Date and Time when the object was deleted. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
    - `criteria` object: Versioned conditions that determine whether this rule matches a resource. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
    - `projectId` string, uuid: ID of your OneUptime Project in which this object belongs. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [No access - you don't have permission for this operation]
    - `name` string, required: Name of this host label rule. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
    - `description` string: Description of this host label rule. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
    - `isEnabled` boolean: Whether this rule is enabled. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
    - `hostLabels` object[]: Only trigger for hosts that already have at least one of these labels. Leave empty to match regardless of labels. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
      - `id` string
    - `hostNamePattern` string: Regex (case-insensitive) matched against the host name. Leave empty to match any name. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
    - `hostDescriptionPattern` string: Regex (case-insensitive) matched against the host description. Leave empty to match any description. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
    - `labelsToAdd` object[]: Labels to attach to the host when this rule matches. Already-attached labels are not duplicated. Permissions - Create: [Project Owner, Project Admin, Create Host Label Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [Project Owner, Project Admin, Edit Host Label Rule]
      - `id` string
    - `createdByUserId` string, uuid: User ID who created this object (if this object was created by a User). Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer, Read Host Label Rule], Update: [No access - you don't have permission for this operation]

## Other responses

- `400`: Bad request. This response indicates that the request was malformed or contained invalid data.
- `401`: Unauthorized. This response indicates that the request requires user authentication.
- `402`: Payment Required. This response indicates that the request requires payment or a valid subscription.
- `403`: Forbidden. This response indicates that the server understood the request, but refuses to authorize it.
- `404`: Not found. The record does not exist, belongs to another project, or is one you may not read - the same answer for each.
- `405`: Project not found. This response indicates that the requested project does not exist or is not accessible.
- `408`: Request Timeout. This response indicates that the server timed out waiting for the request.
- `415`: Unable to reach server. This response indicates that the server is currently unreachable or down.
- `422`: Not authorized. This response indicates that the user does not have permission to access the requested resource.
- `500`: Internal Server Error. This response indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

---

[API](https://skmtc.dev/oneuptime/apis/oneuptime-openapi-specification.md) - [All operations](https://skmtc.dev/oneuptime/apis/oneuptime-openapi-specification/llms.txt) - [OpenAPI document](https://skmtc.dev/oneuptime/apis/oneuptime-openapi-specification/revisions/ba3307d00304?raw)
