Skip to main content
POST
https://api.velt.dev
/
v2
/
crdt
/
update
Update CRDT Data
curl --request POST \
  --url https://api.velt.dev/v2/crdt/update \
  --header 'Content-Type: application/json' \
  --header 'x-velt-api-key: <x-velt-api-key>' \
  --header 'x-velt-auth-token: <x-velt-auth-token>' \
  --data '
{
  "data": {
    "organizationId": "<string>",
    "documentId": "<string>",
    "editorId": "<string>",
    "data": {},
    "type": "<string>",
    "contentKey": "<string>"
  }
}
'
{
  "result": {
    "status": "success",
    "message": "CRDT data updated successfully."
  }
}
Use this API to replace existing CRDT editor data on the backend. The update creates proper CRDT operations on the existing document state so connected clients can pick up the change. Use it with the Multiplayer Editing (Yjs) feature.

Endpoint

POST https://api.velt.dev/v2/crdt/update

Headers

x-velt-api-key
string
required
Your API key.
x-velt-auth-token
string
required

Body Parameters

data
object
required

Example Requests

Text (e.g., CodeMirror):
{
  "data": {
    "organizationId": "YOUR_ORGANIZATION_ID",
    "documentId": "YOUR_DOCUMENT_ID",
    "editorId": "my-collab-note",
    "data": "Updated collaborative content!",
    "type": "text"
  }
}
Map (e.g., ReactFlow):
{
  "data": {
    "organizationId": "YOUR_ORGANIZATION_ID",
    "documentId": "YOUR_DOCUMENT_ID",
    "editorId": "my-flow-editor",
    "data": { "nodes": { "node-1": { "label": "Updated" } }, "edges": {} },
    "type": "map"
  }
}
Array:
{
  "data": {
    "organizationId": "YOUR_ORGANIZATION_ID",
    "documentId": "YOUR_DOCUMENT_ID",
    "editorId": "my-list-editor",
    "data": [{ "id": "1", "text": "Updated Item 1" }, { "id": "3", "text": "New Item 3" }],
    "type": "array"
  }
}
XML (e.g., TipTap):
{
  "data": {
    "organizationId": "YOUR_ORGANIZATION_ID",
    "documentId": "YOUR_DOCUMENT_ID",
    "editorId": "my-rich-text-editor",
    "data": "<paragraph>Updated content</paragraph><heading level=\"2\">New heading</heading>",
    "type": "xml",
    "contentKey": "default"
  }
}

Response

Success Response

{
  "result": {
    "status": "success",
    "message": "CRDT data updated successfully."
  }
}

Error Responses

No CRDT data found for the given editor ID:
{
  "error": {
    "message": "No CRDT data found for this editor ID.",
    "status": "NOT_FOUND"
  }
}
Invalid arguments:
{
  "error": {
    "message": "Data must be a string for type text.",
    "status": "INVALID_ARGUMENT"
  }
}
{
  "result": {
    "status": "success",
    "message": "CRDT data updated successfully."
  }
}