# Create a Vision Event

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

```python
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](/developer/python-sdk/vision-events/upload-a-vision-event-image.md).
* **`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](/developer/rest-api/vision-events/create-a-vision-event.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.roboflow.com/developer/python-sdk/vision-events/create-a-vision-event.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
