> ## Documentation Index
> Fetch the complete documentation index at: https://docs.velt.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Broadcast Event

Use this API to broadcast live state events to any document. Use it with the [Live State](/realtime-collaboration/live-state-sync/setup#get-live-data) feature.

# Endpoint

`POST https://api.velt.dev/v1/livestate/broadcast`

# Headers

<ParamField header="x-velt-api-key" type="string" required>
  Your API key.
</ParamField>

<ParamField header="x-velt-auth-token" type="string" required>
  Your [Auth Token](/security/auth-tokens).
</ParamField>

# Body Parameters

<ParamField body="data" type="object" required>
  <Expandable title="properties">
    <ParamField body="organizationId" type="string" required>
      Organization ID where the document belongs
    </ParamField>

    <ParamField body="documentId" type="string" required>
      Document ID to broadcast the event to
    </ParamField>

    <ParamField body="liveStateDataId" type="string" required>
      Unique identifier for the live state data
    </ParamField>

    <ParamField body="data" type="Object" required>
      The data to broadcast. Can be any valid serializable JSON object.
    </ParamField>

    <ParamField body="merge" type="boolean" default="false">
      If true, merges the new data with existing data instead of replacing it
    </ParamField>
  </Expandable>
</ParamField>

## Example Request

```JSON theme={null}
{
  "organizationId": "YOUR_ORGANIZATION_ID",
  "documentId": "YOUR_DOCUMENT_ID",
  "liveStateDataId": "sample_live_state_data_id",
  "data": {
    "status": "active",
    "message": "Hello World",
    "customField": "custom value"
  },
  "merge": true
}
```

# Response

## Success Response

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "Event broadcasted successfully.",
    "data": {
      "success": true
    }
  }
}
```

## Error Response

```JSON theme={null}
{
  "error": {
    "message": "ERROR_MESSAGE",
    "status": "ERROR_CODE"
  }
}
```

<ResponseExample>
  ```json theme={null}
  {
    "result": {
      "status": "success",
      "message": "Event broadcasted successfully.",
      "data": {
        "success": true
      }
    }
  }
  ```
</ResponseExample>
