To create a new taxonomy term, createTaxonomyTerm mutation should be used. If a parent should be set, an appropriate term can be found with getTaxonomyTermByName query
Note: vocabulary will not be created with an API, it should be created on the site manually.
Access policy:
  • The API user context should have permission to create a taxonomy term in the given vocabulary. Otherwise, access denied response will be returned.
  • The given vocabulary should exist on the site.
  • If parent ID is not 0, a term with this ID should exist.
The only argument that can be used in this mutation is termData that is the object with the following properties:
ArgumentTypeDescriptionDefault
vocabularyStringRequired. Represents a machine name of the taxonomy vocabulary to create a term.
nameStringRequired. A name (label) of the taxonomy term that should be created.
parentIdIDThe parent term ID. By default the term will be created without a parent, as a first-level item.0
For example, let’s create a new term in LP Domain vocabulary under the “Onboarding” item.
mutation createTaxonomyTerm {
  createTaxonomyTerm(termData: {
    vocabulary: "lp_domain",
    name: "API domain",
    parentId: "9"
  }) {
    errors
    response {
      id
      name
      parent {
        id
        name
      }
      vocabulary
      weight
    }
  }
}
After the mutation execution, the term should be created in the given vocabulary. Before: Before term creation After: After term creation