> 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/deployment/monitoring-and-analytics/vision-events/batch-create-vision-events.md).

# Batch Create Vision Events

Record up to 100 Vision Events in a single request to ingest many observations at once.

## About

This endpoint records multiple [Vision Events](https://docs.roboflow.com/deployment/monitoring-and-analytics/vision-events.md) in a single request, up to 100 at a time. Use it when a deployment needs to ingest many observations at once, which is more efficient than creating events individually. To record a single event, see [Create a Vision Event](https://docs.roboflow.com/deployment/monitoring-and-analytics/vision-events/create-a-vision-event.md).

## HTTP API

Create up to 100 vision events in a single request. This is more efficient than creating events individually when you need to ingest multiple events at once.

**Required scope:** `vision-events:write` or `device:update`

{% openapi src="/files/sCDP9kVopV4JkkRK7GDd" path="/vision-events/batch" method="post" %}
[openapi.yaml](https://1583372177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoksNmwps1HmYr8TqHDnX%2Fuploads%2Fgit-blob-0988c6c6c600d725f72d1ecfe0cbeba9b717363f%2Fopenapi.yaml?alt=media)
{% endopenapi %}

{% hint style="info" %}
To include images in your events, first upload each image using the [Upload a Vision Event Image](https://docs.roboflow.com/deployment/monitoring-and-analytics/vision-events/upload-a-vision-event-image.md#http-api) endpoint, then reference the returned `sourceId` in the image object. Videos work the same way: upload each one with [Upload a Vision Event Video](https://docs.roboflow.com/deployment/monitoring-and-analytics/vision-events/upload-a-vision-event-video.md#http-api). [Create a Vision Event](https://docs.roboflow.com/deployment/monitoring-and-analytics/vision-events/create-a-vision-event.md#http-api) lists the fields of image and video objects.
{% endhint %}

Each event is validated the same way as a single event. See [Validation and Warnings](https://docs.roboflow.com/deployment/monitoring-and-analytics/vision-events/create-a-vision-event.md#validation-and-warnings).

## Python SDK

Create multiple vision events in a single request. The server allows up to 100 events per batch.

```python
import roboflow

roboflow.login()

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

result = ws.write_vision_events_batch([
    {
        "eventId": "e5f6a7b8-c3d4-4e5f-a0b1-c2d3e4f5a6b7",
        "eventType": "quality_check",
        "useCaseId": "a1b3c8e1",
        "timestamp": "2024-01-15T10:00:00Z",
        "eventData": {"result": "pass"},
    },
    {
        "eventId": "f6a7b8c9-d4e5-4f6a-b1c2-d3e4f5a6b7c8",
        "eventType": "quality_check",
        "useCaseId": "a1b3c8e1",
        "timestamp": "2024-01-15T10:01:00Z",
        "eventData": {"result": "fail"},
        "customMetadata": {"line": "A1"},
    },
])

print(result["created"])    # Number of events created
print(result["eventIds"])   # List of created event IDs
```

Each event in the list follows the same schema as a [single event](https://docs.roboflow.com/deployment/monitoring-and-analytics/vision-events/create-a-vision-event.md#python-sdk). For full details on event schemas and validation behavior, see the [REST API reference](#http-api).
