---
title: "Collaborate with citations"
description: "Set up Smart Citations with Yjs and persist collaborative citation data."
canonical_url: "https://tiptap.dev/docs/citations/guides/collaboration"
---

# Collaborate with citations

Set up Smart Citations with Yjs and persist collaborative citation data.

Save the document with its `citation` marks and `smartCitations` node attributes. Store source records separately and reload them with the same IDs and revision strategy. Smart Citations derives status and positions when you open the document.

Collaboration is optional. For a shared editor, follow the [Tiptap Collaboration setup](https://tiptap.dev/docs/collaboration/getting-started/install.md#integrate-yjs-and-the-collaboration-extension) and reuse the `sources` collection from [Smart Citations setup](https://tiptap.dev/docs/citations/getting-started/install.md). Use the Yjs document connected to your provider as `ydoc`. Disable StarterKit history so Collaboration handles undo and redo.

```ts
import Collaboration from '@tiptap/extension-collaboration'
import StarterKit from '@tiptap/starter-kit'
import { SmartCitations } from '@tiptap-pro/extension-smart-citations'

const field = 'default'

const extensions = [
  StarterKit.configure({ undoRedo: false }),
  Collaboration.configure({ document: ydoc, field }),
  SmartCitations.configure({ sources, user: { id: 'author' } }),
]
```

- **Citations.** Yjs syncs inline marks and merges concurrent node citation changes by citation ID. Save the full Yjs document to persist those records. A mounted editor includes merged node citations in `getCitations`, `editor.getJSON()`, and `editor.getHTML()`. For [server-side JSON](https://tiptap.dev/docs/citations/api-reference/queries.md#export-collaborative-json), export the fragment for the same `field`.
- **Sources.** Each client checks validity against its local collection. To share sources, sync them in your app through an API or a Yjs map.
- **Attribution.** Remote edits keep the originating user's attribution when available. Undo and redo restore text and citation metadata.
- **Concurrent review.** Approval confirms what the reviewer saw. Unseen edits can leave the merged citation invalid. Removal applies to the marks the reviewer saw, so a concurrent attributed edit can survive.
