> 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

## About

This endpoint returns the custom metadata fields that have been used across the [Vision Events](/deployment/monitoring-and-analytics/vision-events.md) in a given [Use Case](/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](/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](/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-dfdc1702ad3d1a62ad0a661e9609f6bbe2fc8d4c%2Fopenapi.yaml?alt=media)
{% endopenapi %}

### Path Parameters

* **`:useCaseId`** (string, required): The use case ID.

### Example Request

```bash
curl "https://api.roboflow.com/vision-events/custom-metadata-schema/a1b3c8e1" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

### Example Response

{% tabs %}
{% tab title="200" %}

```json
{
  "fields": {
    "production_line": {
      "types": ["string"]
    },
    "temperature": {
      "types": ["number"]
    },
    "is_overtime": {
      "types": ["boolean"]
    }
  }
}
```

Each field in the `fields` object includes:

* **`types`** (array of strings): The data types observed for this field, each one of `string`, `number`, or `boolean`. A field may have multiple types if different events used different types for the same key.
  {% endtab %}

{% tab title="403" %}

```json
{
  "error": "Insufficient permissions for this resource."
}
```

{% endtab %}
{% endtabs %}

## 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](/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).
