---
title: "Citation commands"
description: "Create, approve, restore, or remove citations through editor commands."
canonical_url: "https://tiptap.dev/docs/citations/api-reference/commands"
---

# Citation commands

Create, approve, restore, or remove citations through editor commands.

Run these commands on a [configured editor](https://tiptap.dev/docs/citations/getting-started/install.md). Commands return `true` on success. Expected failures leave the document unchanged, return `false`, and call `onError` if configured. Use `editor.can()` to validate without editing the document or calling `onError`. See [error codes](https://tiptap.dev/docs/citations/api-reference/errors.md) for recovery steps.

## createCitation

Attach a source to selected text, a selected node, or a node at an explicit position. The command records the initial confirmed reference and the creator.

```ts
editor.commands.createCitation({ sourceId: 'manual' })
```

| Field in `CreateCitationOptions` | Type     | Description                                                                                    |
| -------------------------------- | -------- | ---------------------------------------------------------------------------------------------- |
| `sourceId`                       | `string` | Required. An ID in the configured source collection.                                           |
| `position`                       | `number` | Optional. The ProseMirror position immediately before a node. Overrides the current selection. |

Returns `false` for an unknown source, unsupported selection or position, schema restriction, or invalid user.

## approveCitation

Confirm the current text and source revision and record the approver. Pass a citation ID from a [query](https://tiptap.dev/docs/citations/api-reference/queries.md), such as the `id` of the item selected in your review UI.

```ts
editor.commands.approveCitation(citation.id)
```

Returns `false` for an unknown citation, missing source, or invalid user.

## revertCitation

Restore the last confirmed text of an inline citation and reevaluate affected citations. The confirmed source revision stays the same.

```ts
editor.commands.revertCitation(citation.id)
```

Returns `false` for an unknown citation, node citation, unsupported restoration, schema restriction, or invalid user. A change that only affects hard breaks and triggers `textChanged` also returns `false`. Edit the breaks directly before reviewing again.

## removeCitation

Remove one citation and keep the cited content, source, and other citations.

```ts
editor.commands.removeCitation(citation.id)
```

Returns `false` if the citation no longer exists.
