Skip to main content
POST
/
v2
/
crdt
/
add
Add CRDT Data
curl --request POST \
  --url https://api.velt.dev/v2/crdt/add \
  --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 added successfully."
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.velt.dev/docs/llms.txt

Use this file to discover all available pages before exploring further.

Use this API to create new CRDT editor data on the backend. Use it with the Multiplayer Editing (Yjs) feature.

Endpoint

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

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": "Hello, collaborative world!",
    "type": "text"
  }
}
Map (e.g., ReactFlow):
{
  "data": {
    "organizationId": "YOUR_ORGANIZATION_ID",
    "documentId": "YOUR_DOCUMENT_ID",
    "editorId": "my-flow-editor",
    "data": { "nodes": {}, "edges": {} },
    "type": "map"
  }
}
Array:
{
  "data": {
    "organizationId": "YOUR_ORGANIZATION_ID",
    "documentId": "YOUR_DOCUMENT_ID",
    "editorId": "my-list-editor",
    "data": [{ "id": "1", "text": "Item 1" }, { "id": "2", "text": "Item 2" }],
    "type": "array"
  }
}
XML (e.g., TipTap):
{
  "data": {
    "organizationId": "YOUR_ORGANIZATION_ID",
    "documentId": "YOUR_DOCUMENT_ID",
    "editorId": "my-rich-text-editor",
    "data": "<paragraph>Hello World</paragraph>",
    "type": "xml",
    "contentKey": "default"
  }
}

Response

Success Response

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

Error Responses

CRDT data already exists for the given editor ID:
{
  "error": {
    "message": "CRDT data already exists for this editor ID.",
    "status": "ALREADY_EXISTS"
  }
}
Invalid arguments:
{
  "error": {
    "message": "Editor ID is required.",
    "status": "INVALID_ARGUMENT"
  }
}
{
  "result": {
    "status": "success",
    "message": "CRDT data added successfully."
  }
}