> ## 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.

# Get CRDT Data

Use this API to retrieve CRDT editor data from the backend. Use it with the [Multiplayer Editing (Yjs)](/realtime-collaboration/crdt/setup/core) feature.

# Endpoint

`POST https://api.velt.dev/v2/crdt/get`

# 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 containing the CRDT editor data
    </ParamField>

    <ParamField body="editorId" type="string">
      Optional unique identifier for the specific CRDT editor instance. If omitted, returns all CRDT data for the document.
    </ParamField>
  </Expandable>
</ParamField>

## Example Request

```JSON theme={null}
{
  "data": {
    "organizationId": "YOUR_ORGANIZATION_ID",
    "documentId": "YOUR_DOCUMENT_ID",
    "editorId": "my-collab-note"
  }
}
```

# Response

## Success Response

The response contains an array of CRDT data objects. Each object includes the editor data and metadata.

```JSON theme={null}
{
  "result": {
    "status": "success",
    "message": "CRDT data retrieved successfully.",
    "data": [
      {
        "data": "Hello, collaborative world!",
        "id": "my-collab-note",
        "lastUpdate": "2025-01-20T10:30:00.000Z",
        "lastUpdatedBy": "user-123",
        "sessionId": "session-abc-456"
      }
    ]
  }
}
```

### Response Fields

| Field           | Type                                | Description                                                                      |
| --------------- | ----------------------------------- | -------------------------------------------------------------------------------- |
| `data`          | `text` \| `map` \| `array` \| `xml` | The CRDT editor data. Type depends on the store type configured in the frontend. |
| `id`            | `string`                            | Store identifier (editorId)                                                      |
| `lastUpdate`    | `string`                            | ISO timestamp of last update                                                     |
| `lastUpdatedBy` | `string`                            | User ID who made the last update                                                 |
| `sessionId`     | `string \| null`                    | Session ID or null                                                               |

## Error Response

```JSON theme={null}
{
  "error": {
    "message": "Organization ID is required",
    "status": "INVALID_ARGUMENT"
  }
}
```

<ResponseExample>
  ```json theme={null}
  {
    "result": {
      "status": "success",
      "message": "CRDT data retrieved successfully.",
      "data": [
        {
          "data": "Hello, collaborative world!",
          "id": "my-collab-note",
          "lastUpdate": "2025-01-20T10:30:00.000Z",
          "lastUpdatedBy": "user-123",
          "sessionId": "session-abc-456"
        }
      ]
    }
  }
  ```
</ResponseExample>
