> ## Documentation Index
> Fetch the complete documentation index at: https://velt.dev/docs/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](https://velt.dev/docs/realtime-collaboration/live-state-sync/setup.md#get-live-data) feature.

# Endpoint

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

# Headers

**x-velt-api-key** `string` *required*

Your API key.

**x-velt-auth-token** `string` *required*

Your [Auth Token](https://velt.dev/docs/security/auth-tokens.md).

# Body Parameters

**data** `object` *required*

**properties**

**organizationId** `string` *required*

Organization ID where the document belongs

**documentId** `string` *required*

Document ID to broadcast the event to

**liveStateDataId** `string` *required*

Unique identifier for the live state data

**data** `Object` *required*

The data to broadcast. Can be any valid serializable JSON object.

**merge** `boolean` (default: false)

If true, merges the new data with existing data instead of replacing it

## 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"
  }
}
```

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


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.