Create a Vision Event

Create a single vision event to record an observation from your computer vision deployment.

import roboflow

roboflow.login()

rf = roboflow.Roboflow()
ws = rf.workspace()

ws.write_vision_event({
    "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,
    },
})

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): Globally unique identifier. Use a UUID (v4).

  • eventType (string): One of quality_check, inventory_count, safety_alert, custom, or operator_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.

  • customMetadata (dict): Up to 100 key-value pairs of custom metadata.

For the full event schema, event data structures per type, and image annotation formats, see the REST API reference.

Last updated

Was this helpful?