> ## 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 taxonomy term

To edit a taxonomy term data, `editTaxonomyTerm` mutation should be used.
A `PATCH` method is used for editing. It means that only not empty properties will be updated.
If a parent should be set, an appropriate term can be found with [`getTaxonomyTermByName` query](/OpignoEnterpriseAPI/Taxonomy/GetTaxonomyTerm)

**Access policy:**

* The API user context should have permission to update the given taxonomy term.
* A term with the given ID should exist on the site.
* If parent ID is set and is not equals to 0, a term with this ID should exist.

The following arguments should be used in the mutation, both required:

* `termId` - ID of the taxonomy term that should be updated;
* `termData` - the object with the following properties:

| Argument   | Type     | Description                                                                                                |
| :--------- | :------- | :--------------------------------------------------------------------------------------------------------- |
| `name`     | `String` | An updated name (label) of the taxonomy term.                                                              |
| `parentId` | `ID`     | The parent term ID. Set to 0 to reset the level. Set to null or to the current level to keep it unchanged. |

Now let's update the term that was created in the previous step (see [Create a taxonomy term](/OpignoEnterpriseAPI/Taxonomy/CreateTaxonomyTerm) for more details).
We will remove the parent and update the term title.

<CodeGroup>
  ```filename GraphQL [expandable] theme={null}
  mutation editTaxonomyTerm {
    editTaxonomyTerm(
      termId: "11",
      termData: {
      name: "API domain updated",
      parentId: "0"
    }) {
      errors
      response {
        id
        name
        parent {
          id
          name
        }
        vocabulary
        weight
      }
    }
  }
  ```

  ```File Query result [expandable] theme={null}
  {
    "data": {
      "editTaxonomyTerm": {
        "errors": [],
        "response": {
          "id": "11",
          "name": "API domain updated",
          "parent": null,
          "vocabulary": "lp_domain",
          "weight": 0
        }
      }
    }
  }
  ```
</CodeGroup>

Here is a result of the mutation execution:

<img style={{ borderRadius:"0.3rem" }} src="https://mintcdn.com/connect-i/duHonZHPe3F63_yi/images/after-term-editing.png?fit=max&auto=format&n=duHonZHPe3F63_yi&q=85&s=eeb3764d69957c02fed5c910db8709f2" alt="After term editing" title="After term editing" width="2434" height="1105" data-path="images/after-term-editing.png" />
