
## Retrieve custom metadata

URL: https://docs.atlan.com/product/capabilities/build-apps/sdks/python/custom-metadata/how-tos/retrieve-custom-metadata

> Retrieve custom metadata structures programmatically using the Atlan Python SDK (pyatlan). Use CustomMetadataDef to access metadata definitions and attributes.

# CustomMetadataDef: retrieve custom metadata

Use `CustomMetadataDef` in the Atlan Python SDK to programmatically retrieve custom metadata type definitions and their attributes.

You can retrieve an existing custom metadata structure:

### Java

```java showLineNumbers title="Retrieve existing custom metadata structure"
CustomMetadataDef existing = client
 .getCustomMetadataCache()
 .getCustomMetadataDef("RACI"); // (1)
```

1. You can retrieve the current custom metadata definition using the custom metadata cache from any client. In most cases you can simply use the default client (`Atlan.getDefaultClient()`). Pass the human-readable name of the custom metadata structure to the cache.

### Python

```python showLineNumbers title="Retrieve existing custom metadata structure"
from pyatlan.client.atlan import AtlanClient

client = AtlanClient()
existing = client.custom_metadata_cache.get_custom_metadata_def(name="RACI") # (1)
```

1. You can retrieve the current custom metadata definition using the `client.custom_metadata_cache.get_custom_metadata_def()` method and passing the human-readable name of the custom metadata structure.

### Kotlin

```kotlin showLineNumbers title="Retrieve existing custom metadata structure"
val existing = client
 .customMetadataCache
 .getCustomMetadataDef("RACI") // (1)
```

1. You can retrieve the current custom metadata definition using the custom metadata cache from any client. In most cases you can simply use the default client (`Atlan.getDefaultClient()`). Pass the human-readable name of the custom metadata structure to the cache.

### Raw REST API

```json showLineNumbers title="GET /api/meta/types/typedefs?type=BUSINESS_METADATA"
{
 "businessMetadataDefs": [ // (1)
 }
 ],
 "createdBy": "jsmith",
 "updatedBy": "jsmith",
 "createTime": 1648852296555,
 "updateTime": 1649172284333,
 "version": 2
 }
 ]
}
```

1. Each custom metadata structure will be wrapped in the top-level `businessMetadataDefs` array.
2. Each custom metadata structure object will have a `category` of `BUSINESS_METADATA`.
3. The `name` of a custom metadata structure is a unique hashed-string, but isn't human-readable. This is how the custom metadata is uniquely referred to through the raw APIs.
4. The `displayName` of a custom metadata structure is the human-readable name you see in the UI.
5. Each property defined within the custom metadata structure is nested within an `attributeDefs` array.
6. As with the overall custom metadata structure, each attribute has a unique hashed-string `name` that'sn't human-readable. This is how the custom metadata property is uniquely referred to through the raw APIs.
7. As with the overall custom metadata structure, each attribute also has a `displayName` that's the human-readable name you see in the UI.
8. The type of the custom metadata property is its simple type, but doesn't include custom types like SQL, users, groups and so on.
9. For the precise type, you also need to look at the `customType` within the `options`, within the attribute definition.

---
