> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opigno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a hierarchy level

<Warning>
  Only users with the <b>ADMINISTRATOR</b> scope in the current context can update hierarchy levels. Make sure your API token grants administrator privileges.
  See [Understanding Scopes](/OpignoEnterpriseAPI/UserContextManagement#understanding-scopes) for more information.
</Warning>

Use the `updateHierarchyLevel` mutation to modify an existing hierarchy level. This mutation uses partial update (PATCH-like) semantics: only the fields you provide are updated; omitted fields remain unchanged.

**Access policy:**

* The API user context must have permission to update hierarchy levels.
* A hierarchy level with the provided `id` must exist.
* If `parentId` is provided and is not `0`, a hierarchy level with this ID must exist.

The mutation accepts the following arguments:

| Argument         | Type     | Description                                     | Default |
| :--------------- | :------- | :---------------------------------------------- | :------ |
| `id`             | `ID`     | Required. ID of the hierarchy level to update.  | —       |
| `hierarchyLevel` | `Object` | Required. Fields to update, as described below. | —       |

| Argument   | Type     | Description                                                                                              |
| :--------- | :------- | :------------------------------------------------------------------------------------------------------- |
| `label`    | `String` | Updated display name of the hierarchy level.                                                             |
| `parentId` | `ID`     | New parent hierarchy level ID. Set to `0` to move the level to the top level. Omit to keep it unchanged. |

<Note>
  To keep the current parent, omit `parentId`. To move a level to the top, set `parentId` to `0`.
</Note>

<CodeGroup>
  ```filename GraphQL [expandable] theme={null}
  mutation updateHierarchyLevel {
    updateHierarchyLevel(
      id: "27",
      hierarchyLevel: {
        label: "Regional Management"
      }
    ){
      errors
      response{
        id
        label
        parent {
          id
        }
      }
    }
  }
  ```

  ```File Query result [expandable] theme={null}
  {
    "data": {
      "updateHierarchyLevel": {
        "errors": [],
        "response": {
          "id": "27",
          "label": "Regional Management",
          "parent": {
            "id": "12"
          }
        }
      }
    }
  }
  ```
</CodeGroup>
