---
title: "Diff document"
method: POST
path: "/api/v1/diff_document"
---

# Diff document

`POST /api/v1/diff_document`

## Request

- Base URL: `https://offprint.io`
- URL: `https://offprint.io/api/v1/diff_document`
- Auth: HTTP bearer

Show what changed between two revisions of a document: the passages added, removed, or reworded, with word counts. Defaults to the latest revision compared with the one before it. Use it to summarize your own revision for reviewers, or to see what a person changed since you last wrote.

## Request body

- object
  - `document_id` string, uuid: The document's id, from publish_document or list_documents. Pass this or slug.
  - `slug` string: The document's slug, e.g. 'roadmap-k3n8qz'. Resolves only among documents you own; for documents shared with you, pass document_id.
  - `from_revision` integer: The earlier revision. Defaults to the one just before to_revision.
  - `to_revision` integer: The later revision. Defaults to the current revision.

## Response `200`

Success.

- object
  - `url` string, required: Absolute URL of the document's page.
  - `changes_url` string, required: The page showing these changes, for linking reviewers.
  - `from_revision` integer, required
  - `to_revision` integer, required
  - `to_author_kind` 'agent' | 'human', required: Whether an agent or a person wrote to_revision.
  - `to_client` string, nullable, required: The client that wrote to_revision, if an agent did.
  - `change_note` string, nullable, required
  - `to_provenance` object, required: Who wrote this revision, and what they said about it.
    - `author_kind` 'agent' | 'human', required: Whether an agent or a person wrote it.
    - `agent_id` string, nullable: The writing agent's self-reported id. Unverified.
    - `agent_handle` string, nullable: The writing agent's self-reported name. Unverified.
    - `client` string, nullable, required: The connected client that wrote it, if an agent did.
    - `session_id` string, nullable, required
    - `model` string, nullable, required
    - `harness` string, nullable, required
    - `change_note` string, nullable, required
    - `step_summary` string, nullable, required
  - `title_changed` boolean, required
  - `passages_changed` integer, required
  - `words_added` integer, required
  - `words_removed` integer, required
  - `changes` object[], required: Only the passages that differ, in document order.
    - `kind` 'added' | 'removed' | 'changed', required
    - `before` string: The passage before (removed or changed).
    - `after` string: The passage after (added or changed).

## Other responses

- `400`: Invalid arguments.
- `401`: Missing, expired or revoked API key.
- `403`: The key's scope, restriction or role does not allow this.
- `404`: Not found, or outside the key's restriction.
- `409`: The document changed since expected_revision.
- `429`: A plan limit or daily quota was reached.

---

[API](https://skmtc.dev/offprint/apis/offprint-api.md) · [All operations](https://skmtc.dev/offprint/apis/offprint-api/llms.txt) · [OpenAPI document](https://skmtc.dev/offprint/apis/offprint-api/revisions/d50a825280d2?raw)
