# Use Cases

## Use Cases

A Use Case groups Vision Events that share a common purpose and custom metadata structure. Every event belongs to exactly one Use Case. Events in the same Use Case typically share the same metadata fields, making it easy to filter and compare data across different sources.

### When to Use One vs. Multiple Use Cases

**Put events in the same Use Case** when they share similar custom metadata fields even if they come from different locations, cameras, or devices. For example, a "Defect Detection" Use Case might receive events from multiple factories, but all events include `line_id`, `shift`, and `part_number`.

**Create separate Use Cases** when the metadata structure is fundamentally different. For example:

* **Assembly Line QA** — tracks `line_id`, `shift`, `part_number`
* **Warehouse Inventory** — tracks `aisle`, `shelf`, `item_type`
* **Construction Site Safety** — tracks `zone`, `alert_type`, `contractor`

### Create a Use Case

#### In the Dashboard

1. Navigate to **Vision Events** in the left sidebar of your workspace
2. Click **+ Create Use Case**
3. Enter a name for the Use Case

<figure><img src="https://662926385-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M6S9nPJhEX9FYH6clfW%2Fuploads%2FHeINTZfy9moBciMlrQpZ%2Fimage.png?alt=media&#x26;token=75581e01-5e61-46b4-958d-654ffb7014ac" alt="" width="375"><figcaption></figcaption></figure>

### View Use Cases

#### In the Dashboard

The Vision Events page displays a table of all your Use Cases, showing:

* Use Case name
* Total event count
* Last event timestamp
* Event types in use

#### Via the API

Retrieve all Use Cases in your workspace:

```bash
curl -X GET "https://api.roboflow.com/vision-events/use-cases" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

See the [Vision Events API Reference](https://docs.roboflow.com/developer/rest-api/vision-events) for the full response format.

### Archive a Use Case

Use Cases can be archived from the dashboard when they are no longer needed. Archived Use Cases and their events remain accessible but are hidden from the default view. Click **View archived use cases** at the bottom of the Use Cases table to see them.\ <br>

<figure><img src="https://662926385-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M6S9nPJhEX9FYH6clfW%2Fuploads%2F71mElYpzCyYcZ3Fupy3A%2FDashboard%20view%20for%20solution%20nine%20status.png?alt=media&#x26;token=46dd10e0-d93b-45c3-8c71-5cf4884e10d2" alt=""><figcaption></figcaption></figure>

### Custom Metadata Schema

After events are sent to a Use Case, the system infers a metadata schema based on the fields and value types observed. You can retrieve the inferred schema for a Use Case to understand what keys and value types are in use:

```bash
curl -X GET "https://api.roboflow.com/vision-events/custom-metadata-schema/assembly-line-qa" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

**Example response:**

```json
{
  "useCaseId": "assembly-line-qa",
  "fields": {
    "line_id": { "types": ["string"] },
    "shift": { "types": ["string"] },
    "temperature": { "types": ["number"] },
    "is_priority": { "types": ["boolean"] }
  }
}
```

See the [Vision Events API Reference](https://docs.roboflow.com/developer/rest-api/vision-events) for full details.
