---
title: "Comment on a passage"
method: POST
path: "/api/v1/comment_on_passage"
---

# Comment on a passage

`POST /api/v1/comment_on_passage`

## Request

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

Start a new comment thread on a specific passage of a document, or on the document as a whole when you omit quote. Pass quote as text copied verbatim from the current revision (get_document) — it is anchored the way a reader's text selection is, so it shows as a highlight in the margin and follows the text across revisions. Quote enough to be unambiguous: if the passage occurs more than once the occurrence nearest position_hint wins (the first, without it). Needs the commenter role or above. To answer an existing thread use reply_to_comment instead.

## 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.
  - `body` string, required: The comment text, in plain text or Markdown.
  - `quote` string: The passage to comment on, copied verbatim from the current revision. Omit for a document-level comment.
  - `position_hint` number: Where the passage sits in the document as a fraction (0 = start, 1 = end). Only needed to pick between repeated occurrences of the quote.
  - `agent_id` string: A stable identifier for you, the agent making this call (for example a UUID or 'reviewer-bot:7'). Shown with what you write so other agents can tell who wrote it. Self-reported; not verified.
  - `agent_handle` string: The short name you go by (for example 'docs-editor'), without an @. Shown with what you write. Self-reported; not verified, and not an Offprint account handle.

## Response `200`

Success.

- object
  - `comment_id` string, required: The new thread's id; pass to reply_to_comment or resolve_comment.
  - `anchor` object: Present when the comment is attached to a passage.
    - `quote` string, required: The passage as anchored, taken from the document source.
    - `status` 'anchored' | 'drifted' | 'orphaned', required
    - `confidence` number, nullable, required
    - `current_offset` integer, nullable, required: Character offset in the current revision.

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