> ## 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.

# Get taxonomy term

## Taxonomy term API object

In Opigno Enterprise API, taxonomy term is represented by a `Term` object with the following parameters:

| Parameter    | Type     | Description                                                      |
| :----------- | :------- | :--------------------------------------------------------------- |
| `id`         | `ID`     | Required. The taxonomy term ID.                                  |
| `name`       | `String` | Required. The term name (label).                                 |
| `weight`     | `Int`    | Required. Determines the order or priority of the taxonomy term. |
| `parent`     | `Term`   | Optional. The parent term, if it's set.                          |
| `vocabulary` | `String` | A machine name of the corresponding taxonomy vocabulary.         |

Opigno Enterprise API provides two options to get a single taxonomy term data.

## Get term by ID

If you know the exact ID of the term, you can call `getTaxonomyTerm` query to retrieve the  information about the taxonomy term.

**Access policy:**

* The API user context should have permission to view the taxonomy term with the given ID.

The only argument that is used in the mutation is `termId` (required).

If the term with the given ID exists, it will be returned.

<CodeGroup>
  ```filename GraphQL [expandable] theme={null}
  query getTaxonomyTerm {
    getTaxonomyTerm(termId: "9") {
      id
      name
      parent {
        id
        name
      }
      vocabulary
      weight
    }
  }
  ```

  ```File Query result [expandable] theme={null}
  {
    "data": {
      "getTaxonomyTerm": {
        "id": "9",
        "name": "Onboarding",
        "parent": null,
        "vocabulary": "lp_domain",
        "weight": 1
      }
    }
  }
  ```
</CodeGroup>

## Get term by name

If you don't know an ID of the needed term, it can be found by the name.

<Note>
  **Note:** query condition is "=" not "LIKE". It means that it will search for
  the list of terms with exactly the same name that is provided in the request.
</Note>

Query arguments:

| Argument     | Type     | Description                                                                |
| :----------- | :------- | :------------------------------------------------------------------------- |
| `name`       | `String` | Required. The term name (label) to search by.                              |
| `vocabulary` | `ID`     | A machine name of the vocabulary. Can be used to limit the search results. |

The query will return the list of terms which name is exactly the same as provided.

<CodeGroup>
  ```filename GraphQL [expandable] theme={null}
  query getTaxonomyTermByName {
    getTaxonomyTermByName(name: "Onboarding", vocabulary: "lp_domain") {
      id
      name
      parent {
        id
        name
      }
      vocabulary
      weight
    }
  }
  ```

  ```File Query result [expandable] theme={null}
  {
    "data": {
      "getTaxonomyTermByName": [
        {
          "id": "9",
          "name": "Onboarding",
          "parent": null,
          "vocabulary": "lp_domain",
          "weight": 1
        }
      ]
    }
  }
  ```
</CodeGroup>
