> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/deployment/monitoring-and-analytics/vision-events/get-custom-metadata-schema.md).

# Get Custom Metadata Schema

Retrieve the custom metadata fields and types used across Vision Events in a Use Case.

## About

This endpoint returns the custom metadata fields that have been used across the [Vision Events](https://docs.roboflow.com/deployment/monitoring-and-analytics/vision-events.md) in a given [Use Case](https://docs.roboflow.com/deployment/monitoring-and-analytics/vision-events/use-cases.md). Because custom metadata is defined per event rather than by a fixed schema, use this to discover which fields exist and their types before building [event queries](https://docs.roboflow.com/deployment/monitoring-and-analytics/vision-events/query-events.md) or dashboard filters.

## HTTP API

Retrieve the schema of custom metadata fields that have been used in events for a given use case. This is useful for discovering what metadata fields are available for filtering in [query requests](https://docs.roboflow.com/deployment/monitoring-and-analytics/vision-events/query-events.md#http-api).

**Required scope:** `vision-events:read` or `device:read`

{% openapi src="/files/sCDP9kVopV4JkkRK7GDd" path="/vision-events/custom-metadata-schema/{useCaseId}" method="get" %}
[openapi.yaml](https://1583372177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoksNmwps1HmYr8TqHDnX%2Fuploads%2Fgit-blob-0988c6c6c600d725f72d1ecfe0cbeba9b717363f%2Fopenapi.yaml?alt=media)
{% endopenapi %}

## Python SDK

Discover the custom metadata fields that have been used in events for a given use case. This is useful for building queries with `customMetadataFilters`.

```python
import roboflow

roboflow.login()

rf = roboflow.Roboflow()
ws = rf.workspace()

schema = ws.get_vision_event_metadata_schema("a1b3c8e1")

for field, info in schema["fields"].items():
    print(f"{field}: {info['types']}")
```

The response contains a `fields` dict mapping each discovered field name to its observed types (e.g., `["string"]`, `["number"]`). You can use this information to construct typed filters when [querying events](https://docs.roboflow.com/deployment/monitoring-and-analytics/vision-events/query-events.md#python-sdk):

```python
page = ws.query_vision_events(
    "a1b3c8e1",
    customMetadataFilters=[
        {"field": "temperature", "operator": "gt", "value": 70, "type": "number"}
    ],
)
```

For more details, see the [REST API reference](#http-api).

## MCP Server

Connect your AI agent to the [MCP Server](https://docs.roboflow.com/agents/mcp-server) and it can read the custom metadata schema with these tools:

<table data-search="false"><thead><tr><th width="290">Tool</th><th>Description</th></tr></thead><tbody><tr><td><code>vision_events_custom_metadata_schema_get</code></td><td>Get the custom metadata schema discovered for a use case.</td></tr></tbody></table>
