Create a Vision Event
Record a single Vision Event via the HTTP API to log an observation from your deployed model.
About
A Vision Event is a timestamped record of something your deployed computer vision model observed - for example a detected defect or an inventory count - along with optional images, predictions, and custom metadata. This page shows how to record a single event so it becomes part of your searchable, filterable production history. To ingest many events at once, use Batch Create Vision Events. If your deployment has no route to the cloud, see Upload a Vision Event Bundle.
HTTP API
Create a single vision event to record an observation from your computer vision deployment.
Required scope: vision-events:write or device:update
Create a single vision event. Only eventId, eventType, useCaseId, and timestamp are strictly checked. Problems in other fields are returned as warnings, and the event is still stored. Sending an eventId that already exists replaces the earlier event. Requires the vision-events:write or device:update scope.
Roboflow API key passed as a Bearer token.
Globally unique identifier. Use a UUID (v4). An event sent with an eventId that already exists overwrites the earlier event.
The use case this event belongs to. An ID that matches no active use case in the workspace (ex: an archived one) still stores the event, with an entity_not_found warning.
ISO 8601 timestamp. A timestamp more than one year old or later than tomorrow is stored, but returns an invalid_value warning.
Identifier for the device that generated the event.
Identifier for the video stream.
Identifier for the workflow that generated the event.
Version of the workflow.
Index in images of the image to show as the main display image (ex: 0 for the first image, 1 for the second).
Set by Edge Device Backup when the device closed the event before its video finished uploading, so the video is missing.
Type-specific event data. Use the schema whose name matches eventType.
A note about the event. With operator_feedback, this holds the reviewer's note.
The event's money value in the smallest unit of the use case currency (ex: cents for USD). If omitted, the use case default applies. An invalid value is dropped with an ingestion warning. operator_feedback events never carry a value.
1999The currency of valueBaseUnits, taken from the use case. Returned on queried events that have a value. Events cannot set it.
USDEvent created successfully.
Deprecated field names used in the request.
eventId, eventType, useCaseId, or timestamp is missing or invalid, or useCaseId and a deprecated alias (solution, solutionId) disagree.
Insufficient permissions for this resource.
POST /vision-events HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 263
{
"eventId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"eventType": "quality_check",
"useCaseId": "a1b3c8e1",
"timestamp": "2024-01-15T10:30:00Z",
"eventData": {
"result": "fail",
"externalId": "batch-001"
},
"customMetadata": {
"line": "A1",
"operator": "John Doe",
"temperature": 72.5
}
}{
"eventId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"created": true,
"warnings": [
{
"type": "invalid_value",
"path": "eventData.result",
"value": "failed",
"valueType": "string"
}
]
}Image Metadata
Use metadata on an image object to record values that belong to that image alone, such as a pass/fail verdict, a serial number, or a camera angle. Values are shown with the image in the event detail view. To attach values that describe the whole event, use customMetadata instead.
Keys that break the metadata limits are dropped and reported in the warnings array. The rest of the image is still stored.
To see which keys your events use, call Get Image Metadata Schema. To filter events by these keys, use imageMetadataFilters in Query Events.
Validation and Warnings
The Vision Events API uses eager ingestion. Only the four required fields (eventId, eventType, useCaseId, timestamp) are strictly validated. If these pass, the event is always accepted and stored, even if other fields contain errors.
Any issues with non-required fields are returned as a warnings array in the response rather than causing a rejection. This includes:
Missing required fields within
eventData(ex:relatedEventIdforoperator_feedback)Invalid values for
eventDatafields (ex: a wrong enum value forseverity)Unrecognized fields that are not part of the schema
When warnings are present, the invalid eventData is stored as an empty object {}, but the event itself is still created.
The response may also include a deprecations array if deprecated field names were used.
Python SDK
Create a single vision event to record an observation from your computer vision deployment.
The event payload is passed directly to the server with no client-side validation, so new event types and fields work without an SDK update.
Required fields:
eventId(string, max 256 characters): Globally unique identifier. Use a UUID (v4).eventType(string): One ofquality_check,inventory_count,safety_alert,custom, oroperator_feedback.useCaseId(string): The use case this event belongs to.timestamp(string, ISO 8601): When the event occurred.
Optional fields:
eventData(dict): Type-specific event data.deviceId,streamId,workflowId(string): Context identifiers.images(list): Image objects with annotations. See Upload a Vision Event Image.videos(list): Video objects. Get eachsourceIdfrom Upload a Vision Event Video.customMetadata(dict): Up to 100 key-value pairs of custom metadata.comment(string): A note about the event, mainly used withoperator_feedback.
For the full event schema, event data structures per type, and image annotation formats, see the REST API reference.
Last updated
Was this helpful?