> 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/roboflow/roboflow-jp/deploy/vision-events/send-events.md).

# イベントを送信する

## イベントを送信

Vision Events は、Workflow block、REST API、または Edge Device Backup を使用して送信できます。

* [Workflow Block](#workflow-block) - Workflows ユーザーは、公式の Roboflow block を使うのが最も簡単でしょう
* [REST API](#rest-api) - Workflows 外でモデルをデプロイするユーザーは、REST API を使用できます
* [Edge Device Backup](#edge-device-backup) - Roboflow Edge devices をデプロイするユーザーは、デバイス上の local event store から自動バックアップを設定するのが最も便利でしょう

### Workflow Block

ほとんどのユーザーに推奨される方法です。次を追加します。 **Vision Event** block を任意の Roboflow Workflow に追加すると、推論結果からコード不要でイベントを自動作成できます。

{% hint style="info" %}
この [Roboflow Agent](broken://pages/c7f6dab8e6240bed4cbccd5a692b84ed25e256eb) これを設定できます。Agent にモデルを実行する Workflow の作成を依頼すると、Vision Events block が自動的に追加され、適切な対象に接続されます。 [Use Case](/roboflow/roboflow-jp/deploy/vision-events/use-cases.md).
{% endhint %}

#### セットアップ

{% stepper %}
{% step %}
**Workflow Editor を開く**

次に移動します **Workflows** Workspace で、イベントを追加したい Workflow を開きます。
{% endstep %}

{% step %}
**Vision Event Block を追加**

block catalog で「Vision Event」を検索し、Workflow に追加します。
{% endstep %}

{% step %}
**入力を接続**

画像入力とモデル予測の出力を Vision Event block に接続します。
{% endstep %}

{% step %}
**Use Case を設定**

Use Case 名を設定します（`useCaseId`）。上流の block からカスタム metadata をマッピングすることもできます。
{% endstep %}

{% step %}
**Workflow をデプロイ**

Workflow をデプロイまたは更新します。Workflow が実行されるたびに Events が自動的に作成されます。
{% endstep %}
{% endstepper %}

{% hint style="info" %}
Workflow block は、画像のアップロードとイベント作成を 1 ステップで処理します。
{% endhint %}

### REST API

Workflows を使用しないカスタム統合やパイプラインでは、REST API から直接イベントを送信できます。完全な request/response schema については、次を参照してください: [Vision Events API Reference](https://docs.roboflow.com/developer/rest-api/vision-events).

#### 認証

すべての write endpoint には、次を含む API key が必要です: `visionEvents.write` または `device.update` scope が必要です。API key は Bearer token として渡してください:

```
Authorization: Bearer YOUR_API_KEY
```

#### エンドツーエンドの例: 画像をアップロード + イベントを作成

{% hint style="warning" %}
イベントを送信する前に Use Case を作成する必要があります。Events は `useCaseId` 存在しないものは拒否されます。
{% endhint %}

API 経由でイベントを送信する場合は、まず画像をアップロードし、その後アップロードした画像を参照するイベントを作成します。

**ステップ 1: 画像をアップロード**

```bash
curl -X POST "https://api.roboflow.com/vision-events/upload" \
  -H "Authorization: Bearer YOUR_API_KEY" \\
  -F "file=@inspection_photo.jpg"
```

**レスポンス:**

```json
{
  "success": true,
  "sourceId": "abc123def456",
  "url": "https://storage.googleapis.com/your-workspace/abc123def456/original.jpg"
}
```

**ステップ 2: アップロードした画像を参照してイベントを作成**

```bash
curl -X POST "https://api.roboflow.com/vision-events" \
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer YOUR_API_KEY" \\
  -d '{
    "eventType": "quality_check",
    "useCaseId": "assembly-line-qa",
    "timestamp": "2026-03-30T14:30:00.000Z",
    "deviceId": "factory-cam-01",
    "streamId": "line-3",
    "images": [
      {
        "sourceId": "abc123def456",
        "objectDetections": [
          {
            "class": "defect",
            "x": 320,
            "y": 240,
            "width": 50,
            "height": 40,
            "confidence": 0.95
          }
        ]
      }
    ],
    "eventData": {
      "result": "fail"
    },
    "customMetadata": {
      "line_id": "line-3",
      "shift": "morning",
      "part_number": "PN-4421"
    }
  }'
```

**レスポンス:**

```json
{
  "eventId": "evt-789ghi",
  "created": true
}
```

#### Events を一括作成

batch endpoint を使用して、1 回のリクエストで最大 100 件の events を送信できます:

```bash
curl -X POST "https://api.roboflow.com/vision-events/batch" \
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer YOUR_API_KEY" \\
  -d '{
    "events": [
      {
        "eventType": "quality_check",
        "useCaseId": "alksjdflaalsf32",
        "eventData": { "result": "pass" },
        "customMetadata": { "line_id": "line-1" }
      },
      {
        "eventType": "quality_check",
        "useCaseId": "alksjdflaalsf32",
        "eventData": { "result": "fail" },
        "customMetadata": { "line_id": "line-2" }
      }
    ]
  }'
```

{% hint style="info" %}
batch request ごとに最大 100 events です。
{% endhint %}

### Edge Device Backup

接続が断続的になる可能性がある enterprise deployment では、edge device がイベントをローカルに保存し、接続が復旧すると Roboflow に同期します。

{% hint style="info" %}
Edge Device Backup には Deployment Manager が必要です。次を参照してください: [Deployment Manager documentation](/roboflow/roboflow-jp/deploy/device-manager.md) セットアップ手順について。
{% endhint %}

Vision Events backup を有効にするには:

1. 開く **Deployment Manager** Workspace で
2. 設定する device を選択
3. 有効にする **Vision Events Backup** device の Event Store 設定で
4. Events は device 上の local event store に書き込まれます
5. device が再接続すると、events は自動的に Roboflow に同期されます

同期が完了すると、Events は Vision Events dashboard に表示されます。

<figure><img src="/files/3b0e22e47e107d1820c244ed494a81e69fc04820" alt="" width="375"><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.roboflow.com/roboflow/roboflow-jp/deploy/vision-events/send-events.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
