For the complete documentation index, see llms.txt. This page is also available as Markdown.

Use Cases

Group Vision Events by purpose using Use Cases.

About

A Use Case groups Vision Events that share a common purpose and custom metadata structure, and every event belongs to exactly one Use Case. Organizing events this way makes it easy to filter and compare data across cameras, devices, and locations that report the same fields.

Put events in the same Use Case when they share custom metadata fields, even if they come from different locations, cameras, or devices. For example, a "Defect Detection" Use Case might receive events from several factories, all with line_id, shift, and part_number. Create separate Use Cases when the metadata structure is different:

  • Assembly Line QA: line_id, shift, part_number

  • Warehouse Inventory: aisle, shelf, item_type

  • Construction Site Safety: zone, alert_type, contractor

After events arrive, Roboflow infers a custom metadata schema from the fields and value types it sees. To see it, call Get Custom Metadata Schema.

The Roboflow Agent creates a Use Case when it builds a Workflow with Vision Events. It reuses an existing Use Case if one fits. You can also ask it to set one up.

Archiving a Use Case hides it from the default view. Its events are kept, and you can unarchive it. Events sent to an archived Use Case are still stored, but each returns a warning.

Event Value

Give events a money value to track what a Use Case is worth (ex: the cost of each defect caught). Set a default value and currency on the Use Case. New events that don't send their own value get the default; events you already sent keep their value.

An event can also send its own value in valueBaseUnits (see Create a Vision Event). The value is always in the Use Case currency. Value totals update about every 5 minutes.

Web App

Open "Vision Events" in the left sidebar of your Workspace and click "+ Create Use Case".

The Use Cases table shows each Use Case's event count, last event time, event types, and all-time value. A Use Case's Overview shows its value in the "Value Created" tile.

To set a default event value, open a Use Case's menu, click "Update Settings", and fill in "Default Event Value" and "Currency".

You can archive a Use Case from the dashboard. Click "View archived use cases" at the bottom of the table to see archived ones.

HTTP API

Unrestricted Workspace API keys have the vision-events:manage scope by default.

Create a Use Case

Create a new use case in your workspace. Use cases help you organize vision events by deployment context (e.g., "Manufacturing Line 1", "Warehouse Inventory").

Required scope: vision-events:manage

Create a Use Case

post

Create a new use case in your workspace. It starts active. Requires the vision-events:manage scope.

Authorizations
AuthorizationstringRequired

Roboflow API key passed as a Bearer token.

Body
namestring · min: 1 · max: 256Required

A name for the use case. Leading and trailing spaces are trimmed. Must be unique within the workspace.

defaultValueBaseUnitsinteger · min: -10000000000 · max: 10000000000Optional

Value given to new events that don't send valueBaseUnits, in the smallest unit of the currency (ex: cents for USD).

Example: 5000
defaultValueCurrencystringOptional

Three-letter currency code for event values (ex: USD, EUR, JPY), in any case. Defaults to USD. An unsupported code returns 400.

Example: USD
Responses
201

Use case created successfully.

application/json
idstringOptional

Use this as useCaseId when you create events.

namestringOptional
post/vision-events/use-cases
POST /vision-events/use-cases HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 31

{
  "name": "Manufacturing Line 1"
}
{
  "id": "a1b3c8e1",
  "name": "Manufacturing Line 1"
}

Notes

  • New use cases are created with an active status by default.

  • After creating a use case, you can reference its id as the useCaseId when creating vision events.

Update a Use Case

Update the name, status, or default event value of an existing use case.

Required scope: vision-events:manage

Update a Use Case

put

Update the name, status, or default event value of an existing use case. A new default applies only to events created afterward. Requires the vision-events:manage scope.

Authorizations
AuthorizationstringRequired

Roboflow API key passed as a Bearer token.

Path parameters
useCaseIdstringRequired

The ID of the use case to update.

Body

Send at least one field.

namestring · min: 1 · max: 256Optional

A new name for the use case. Must be unique within the workspace.

statusstring · enumOptional

The new status for the use case.

Possible values:
defaultValueBaseUnitsinteger · min: -10000000000 · max: 10000000000 · nullableOptional

Value given to new events that don't send valueBaseUnits, in the smallest unit of the currency (ex: cents for USD). null removes the default.

Example: 5000
defaultValueCurrencystringOptional

Three-letter currency code for event values (ex: USD, EUR, JPY), in any case. Send defaultValueBaseUnits too when changing the currency of a use case that has a default value.

Example: USD
Responses
200

Use case updated successfully.

application/json
idstringOptional
namestringOptional
defaultValueBaseUnitsinteger · nullableOptional

The default event value after the update. null when unset.

defaultValueCurrencystringOptional

The currency after the update. USD when unset.

put/vision-events/use-cases/{useCaseId}
PUT /vision-events/use-cases/{useCaseId} HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 31

{
  "name": "Manufacturing Line 2"
}
{
  "id": "a1b3c8e1",
  "name": "Manufacturing Line 2",
  "defaultValueBaseUnits": 5000,
  "defaultValueCurrency": "USD"
}

List Use Cases

List the use cases in your workspace. To learn how to create and manage use cases, see the Use Cases documentation.

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

List Use Cases

get

List the use cases in your workspace with the given status, whether or not they have events. Requires the vision-events:read or device:read scope.

Authorizations
AuthorizationstringRequired

Roboflow API key passed as a Bearer token.

Query parameters
statusstring · enumOptional

Filter by use case status. Use inactive to list archived use cases.

Default: activePossible values:
Responses
200

List of use cases.

application/json
lookbackDaysintegerOptional

The workspace's retention window in days (14 by default).

get/vision-events/use-cases
GET /vision-events/use-cases HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "useCases": [
    {
      "id": "a1b3c8e1",
      "name": "Manufacturing Line 1",
      "status": "active",
      "workspaceId": "Xk2mP9qLr4TzW8vN1bYc",
      "automationsCount": 1,
      "defaultValueBaseUnits": 5000,
      "defaultValueCurrency": "USD",
      "createdAt": "2024-01-10T08:00:00.000Z",
      "updatedAt": "2024-01-15T10:30:00.000Z"
    },
    {
      "id": "d4e5f6a7",
      "name": "Warehouse Inventory",
      "status": "active",
      "workspaceId": "Xk2mP9qLr4TzW8vN1bYc",
      "automationsCount": 0,
      "defaultValueBaseUnits": null,
      "defaultValueCurrency": "USD",
      "createdAt": "2024-01-12T14:00:00.000Z",
      "updatedAt": "2024-01-15T09:00:00.000Z"
    }
  ],
  "lookbackDays": 14
}

Archive a Use Case

Archive a use case by setting its status to inactive. Archived use cases are hidden from listings by default. Events sent to an archived use case are still stored, with an entity_not_found warning.

Required scope: vision-events:manage

Archive a Use Case

post

Archive a use case by setting its status to inactive. Its events are kept. Events sent to it afterward are still stored, but each returns an entity_not_found warning. Archiving an archived use case succeeds. Requires the vision-events:manage scope.

Authorizations
AuthorizationstringRequired

Roboflow API key passed as a Bearer token.

Path parameters
useCaseIdstringRequired

The ID of the use case to archive.

Responses
200

Use case archived successfully.

application/json
successbooleanOptional
post/vision-events/use-cases/{useCaseId}/archive
POST /vision-events/use-cases/{useCaseId}/archive HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "success": true
}

Notes

  • Archiving is a soft delete. The use case and its events are preserved but hidden from active listings.

  • To view archived use cases, use the List Use Cases endpoint with status=inactive.

  • You can restore an archived use case using the Unarchive a Use Case endpoint.

Unarchive a Use Case

Restore a previously archived use case by setting its status back to active.

Required scope: vision-events:manage

Unarchive a Use Case

post

Restore a previously archived use case by setting its status back to active. Requires the vision-events:manage scope.

Authorizations
AuthorizationstringRequired

Roboflow API key passed as a Bearer token.

Path parameters
useCaseIdstringRequired

The ID of the use case to unarchive.

Responses
200

Use case unarchived successfully.

application/json
successbooleanOptional
post/vision-events/use-cases/{useCaseId}/unarchive
POST /vision-events/use-cases/{useCaseId}/unarchive HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "success": true
}

Notes

  • Only use cases with an inactive status can be unarchived.

  • Once unarchived, the use case appears in active listings again, and new events no longer return the warning.

Python SDK

Each vision event is associated with a use case. The Python SDK provides methods to create, list, rename, archive, and unarchive use cases.

List Use Cases

You can filter by status:

Create a Use Case

Rename a Use Case

Archive a Use Case

Unarchive a Use Case

For more details on use case management, see the REST API reference.

MCP Server

Connect your AI agent to the MCP Server and it can manage use cases with these tools:

Tool
Description

vision_events_use_cases_list

List the vision event use cases in the workspace.

vision_events_use_case_create

Create a new vision event use case.

vision_events_use_case_rename

Rename an existing use case.

vision_events_use_case_archive

Archive a use case.

vision_events_use_case_unarchive

Restore a previously archived use case.

Last updated

Was this helpful?