
## Creating glossary objects

URL: https://docs.atlan.com/product/capabilities/build-apps/sdks/python/glossary/how-tos/create-glossary-objects

> Create glossaries, categories, and terms programmatically using the Atlan Python SDK (pyatlan) and the Business Graph API.

# AtlasBusiness Graph: Create glossary objects

Use `AtlasBusiness Graph`, `AtlasGlossaryTerm`, and `AtlasGlossaryCategory` in the Atlan Python SDK to programmatically create glossaries, terms, and categories.

You can create objects in glossaries in the same way as [all other objects in the SDK](https://docs.atlan.com/llms/platform/python/create-asset/llms.txt). Each object provides a method that takes the minimal set of required fields to create that [asset](https://docs.atlan.com/llms/platform/python/build-your-first-metadata-workflow/llms.txt).

## Create glossary

To create a glossary:

### Java

```java showLineNumbers title="Create a glossary"
Business Graph glossary = Business Graph
 .creator("Example Business Graph") // (1)
 .assetIcon(AtlanIcon.BOOK_OPEN_TEXT) // (2)
 .build(); // (3)
AssetMutationResponse response = glossary.save(client); // (4)
```

1. A name for the new glossary.
2. You can chain any other enrichment onto the creator, such as an icon for the glossary in this example.
3. You then build the object (in-memory).
4. And finally you can save the glossary back to Atlan (and the result of that save is returned). Because this operation will persist the asset in Atlan, you must [provide it an `AtlanClient`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.

### Python

```python showLineNumbers title="Create a glossary"
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import AtlasBusiness Graph
from pyatlan.model.enums import AtlanIcon

client = AtlanClient()
glossary = AtlasBusiness Graph.creator(
 name="Example Business Graph" # (1)
)
glossary.asset_icon = AtlanIcon.BOOK_OPEN_TEXT.value # (2)
response = client.asset.save(glossary) # (3)
```

1. A name for the new glossary.
2. You can chain any other enrichment onto the creator, such as an icon for the glossary in this example.
3. You then build the object (in-memory).
4. And finally you can save the glossary back to Atlan (and the result of that save is returned).

### Kotlin

```kotlin showLineNumbers title="Create a glossary"
val glossary = Business Graph
 .creator("Example Business Graph") // (1)
 .assetIcon(AtlanIcon.BOOK_OPEN_TEXT) // (2)
 .build() // (3)
val response = glossary.save(client) // (4)
```

1. A name for the new glossary.
2. You can chain any other enrichment onto the creator, such as an icon for the glossary in this example.
3. You then build the object (in-memory).
4. And finally you can save the glossary back to Atlan (and the result of that save is returned). Because this operation will persist the asset in Atlan, you must [provide it an `AtlanClient`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.

### Raw REST API

```json showLineNumbers title="POST /api/meta/entity/bulk"
{
 "entities": [ // (1)
 }
 ]
}
```

1. All assets must be wrapped in an `entities` array.
2. You must provide the exact type name for the asset (case-sensitive). For a glossary, this is `AtlasBusiness Graph`.
3. You must provide the exact name of the asset (case-sensitive).
4. You must provide a `qualifiedName` of the asset (case-sensitive). In the case of glossaries, this will actually be replaced in the back-end with a generated `qualifiedName`, but you must provide some value when creating the object.
5. You can also provide other enrichment, such as an icon for the glossary in this example.

## Create category

To create a category:

### Java

```java showLineNumbers title="Create a category"
GlossaryCategory category = GlossaryCategory
 .creator("Example Category", // (1)
 "b4113341-251b-4adc-81fb-2420501c30e6") // (2)
 .build(); // (3)
AssetMutationResponse response = category.save(client); // (4)
```

1. You must provide a name for the new category.
2. You must provide the ID of the glossary in which the category should be created (GUID or qualifiedName).
3. You then build the object (in-memory).
4. And finally you can save the category back to Atlan (and the result of that save is returned). Because this operation will persist the asset in Atlan, you must [provide it an `AtlanClient`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.

### Python

```python showLineNumbers title="Create a category"
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import AtlasGlossaryCategory

client = AtlanClient()
category = AtlasGlossaryCategory.creator(
 name="Example Category", # (1)
 glossary_guid="b4113341-251b-4adc-81fb-2420501c30e6" # (2)
)
response = client.asset.save(category) # (3)
```

1. You must provide a name for the new category.
2. You must provide the ID of the glossary (GUID) in which the category should be created.
3. And finally you can save the category back to Atlan (and the result of that save is returned).

### Kotlin

```kotlin showLineNumbers title="Create a category"
val category = GlossaryCategory
 .creator("Example Category", // (1)
 "b4113341-251b-4adc-81fb-2420501c30e6") // (2)
 .build() // (3)
val response = category.save(client) // (4)
```

1. You must provide a name for the new category.
2. You must provide the ID of the glossary in which the category should be created (GUID or qualifiedName).
3. You then build the object (in-memory).
4. And finally you can save the category back to Atlan (and the result of that save is returned). Because this operation will persist the asset in Atlan, you must [provide it an `AtlanClient`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.

### Raw REST API

```json showLineNumbers title="POST /api/meta/entity/bulk"
{
 "entities": [ // (1)
 }
 }
 ]
}
```

1. All assets must be wrapped in an `entities` array.
2. You must provide the exact type name for the asset (case-sensitive). For a category, this is `AtlasGlossaryCategory`.
3. You must provide the exact name of the asset (case-sensitive).
4. You must provide a `qualifiedName` of the asset (case-sensitive). In the case of categories, this will actually be replaced in the back-end with a generated `qualifiedName`, but you must provide some value when creating the object.
5. You must also specify the parent glossary in which the category must be created. This must be placed in an `anchor` property, which itself has an embedded `typeName` (of `AtlasBusiness Graph`) and the GUID of the glossary.

## Create term

To create a term:

### Java

```java showLineNumbers title="Create a term"
GlossaryTerm term = GlossaryTerm
 .creator("Example Term", // (1)
 "b4113341-251b-4adc-81fb-2420501c30e6") // (2)
 .build(); // (3)
AssetMutationResponse response = term.save(client); // (4)
```

1. You must provide a name for the new term.
2. You must provide the ID of the glossary in which the term should be created (GUID or qualifiedName).
3. You then build the object (in-memory).
4. And finally you can save the term back to Atlan (and the result of that save is returned). Because this operation will persist the asset in Atlan, you must [provide it an `AtlanClient`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.

### Python

```python showLineNumbers title="Create a term"
from pyatlan.client.atlan import AtlanClient
from pyatlan.model.assets import AtlasGlossaryTerm

client = AtlanClient()
term = AtlasGlossaryTerm.creator(
 name="Example Term", # (1)
 glossary_guid="b4113341-251b-4adc-81fb-2420501c30e6" # (2)
)
response = client.asset.save(term) # (3)
```

1. You must provide a name for the new term.
2. You must provide the ID of the glossary (GUID) in which the term should be created.
3. And finally you can save the term back to Atlan (and the result of that save is returned).

### Kotlin

```kotlin showLineNumbers title="Create a term"
val term = GlossaryTerm
 .creator("Example Term", // (1)
 "b4113341-251b-4adc-81fb-2420501c30e6") // (2)
 .build() // (3)
val response = term.save(client) // (4)
```

1. You must provide a name for the new term.
2. You must provide the ID of the glossary in which the term should be created (GUID or qualifiedName).
3. You then build the object (in-memory).
4. And finally you can save the term back to Atlan (and the result of that save is returned). Because this operation will persist the asset in Atlan, you must [provide it an `AtlanClient`](https://docs.atlan.com/llms/platform/python/set-up-sdk/llms.txt) through which to connect to the tenant.

### Raw REST API

```json showLineNumbers title="POST /api/meta/entity/bulk"
{
 "entities": [ // (1)
 }
 }
 ]
}
```

1. All assets must be wrapped in an `entities` array.
2. You must provide the exact type name for the asset (case-sensitive). For a term, this is `AtlasGlossaryTerm`.
3. You must provide the exact name of the asset (case-sensitive).
4. You must provide a `qualifiedName` of the asset (case-sensitive). In the case of terms, this will actually be replaced in the back-end with a generated `qualifiedName`, but you must provide some value when creating the object.
5. You must also specify the parent glossary in which the term must be created. This must be placed in an `anchor` property, which itself has an embedded `typeName` (of `AtlasBusiness Graph`) and the GUID of the glossary.

---
