> ## Documentation Index
> Fetch the complete documentation index at: https://docs.transluce.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Collection Metadata

> Read and write metadata on collections

Collections support arbitrary key-value metadata. Updates use deep merge — nested dictionaries
are merged recursively, preserving existing keys.

See [Metadata](/concepts/metadata) for more on how metadata works in Docent.

## Get Metadata

```python theme={null}
from docent import Docent

client = Docent()

metadata = client.get_collection_metadata("my-collection-id")
print(metadata)  # {"team": "support", "model": "gpt-4"}
```

### Parameters

<ParamField body="collection_id" type="str" required>
  ID of the collection.
</ParamField>

### Returns

<ResponseField name="metadata" type="dict">
  The collection's metadata dictionary.
</ResponseField>

***

## Update Metadata

Updates are deep-merged into existing metadata. Existing keys not in the update are preserved.

```python theme={null}
# Existing metadata: {"team": "support", "config": {"model": "gpt-4"}}

client.update_collection_metadata("my-collection-id", {
    "config": {"temperature": 0.7},
    "version": "v2",
})

# Result: {"team": "support", "config": {"model": "gpt-4", "temperature": 0.7}, "version": "v2"}
```

### Parameters

<ParamField body="collection_id" type="str" required>
  ID of the collection.
</ParamField>

<ParamField body="metadata" type="dict" required>
  Metadata to merge into the existing metadata.
</ParamField>

### Returns

<ResponseField name="metadata" type="dict">
  The full merged metadata dictionary after the update.
</ResponseField>

***

## Delete Metadata Keys

Remove specific keys from metadata. Supports dot-delimited paths for nested deletion.

```python theme={null}
# Existing metadata: {"team": "support", "config": {"model": "gpt-4", "temperature": 0.7}}

metadata, not_found = client.delete_collection_metadata_keys(
    "my-collection-id",
    keys=["config.temperature", "nonexistent_key"],
)

print(metadata)    # {"team": "support", "config": {"model": "gpt-4"}}
print(not_found)   # ["nonexistent_key"]
```

### Parameters

<ParamField body="collection_id" type="str" required>
  ID of the collection.
</ParamField>

<ParamField body="keys" type="list[str]" required>
  Keys to remove. Use dot notation for nested keys (e.g., `"config.model"`).
</ParamField>

### Returns

Returns a tuple of two values:

<ResponseField name="metadata" type="dict">
  The metadata dictionary after deletion.
</ResponseField>

<ResponseField name="not_found" type="list[str]">
  Keys that were not found in the metadata.
</ResponseField>
