> 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/deploy/vision-events/use-cases.md).

# 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

#### Via the Agent

When the [Roboflow Agent](/agents/roboflow-agent.md) builds a Workflow with Vision Events, it confirms the Use Case with you before logging. For a new Workflow it defaults to creating a new Use Case, and reuses an existing one only when it clearly shares the same purpose or you name it. You can also ask the Agent directly to set up a new Use Case, or opt out of logging.

#### 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="/files/OuFPImXVQy9YEbs5Dnzw" alt="" width="375"><figcaption></figcaption></figure>

You can also create Use Cases via the REST API, see [Manage Use Cases Programmatically](#manage-use-cases-programmatically).

### 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.

### Manage Use Cases Programmatically

In addition to the dashboard, you can create, rename, archive, and unarchive Use Cases via the REST API. These endpoints require an API key with the `vision-events:manage` scope (unrestricted workspace API keys have access by default).

**Create a Use Case**

```bash
curl -X POST "https://api.roboflow.com/vision-events/use-cases" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{ "name": "assembly-line-qa" }'
```

**Rename a Use Case**

```bash
curl -X PUT "https://api.roboflow.com/vision-events/use-cases/USE_CASE_ID" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{ "name": "assembly-line-qa-v2" }'
```

**Archive or Unarchive a Use Case**

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

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

### 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="/files/S1cUe8hchEKoFiSdAJl7" 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.
