Comment on selected document text or reply to a comment thread

POST/v1/knowledge/{libraryId}/documents/{documentId}/comments

Requires knowledge write permission and the library documents-manage capability. The authenticated principal is always the author. New threads require an anchor for the current saved revision; replies inherit their root comment's anchor. Repeating an identical id and payload is idempotent; reusing an id with different content returns 409. Comments do not change document content or create library versions. Mentions are stored references; this operation does not launch agent runs.

How to call this endpoint

Every ACP API request uses bearer authentication. The examples here show the actual request path, auth header, and body shape that the platform expects.

Path, query, and header parameters

These parameters control which ACP object the endpoint acts on and how the request is processed.

Path parameters
NameLocationTypeRequiredDescription
libraryIdpathstringYesKnowledge library ID
documentIdpathstringYesStable Knowledge document ID
Query parameters
None.

Body schema

Content type: application/json · Required

None.

What the API returns

Each response code below includes the documented payload shape for the ACP API.

201Saved comment, including an identical retryapplication/json
FieldTypeRequiredDescription
commentobjectYes
comment.idstringYesUnique identifier.
comment.libraryIdstringYes
comment.documentIdstringYesDocument ID.
comment.threadIdstringYesRoot comment id; equal to id on root comments.
comment.authorUserIdstringYes
comment.authorobjectYes
comment.author.idstringYesUnique identifier.
comment.author.namestringYesHuman-readable name.
comment.author.emailstringYes
comment.author.avatarUrlstringYes
comment.bodystringYes
comment.anchorobjectYes
comment.anchor.revisionIdstringYes
comment.anchor.startintegerYesUTF-16 offset into rendered text with one newline between text blocks.
comment.anchor.endintegerYesExclusive UTF-16 offset; end minus start equals quote length.
comment.anchor.quotestringYes
comment.anchor.prefixstringYes
comment.anchor.suffixstringYes
comment.mentionsobject[]Yes
comment.mentions[].kindhuman | agentYes
comment.mentions[].idstringYesUnique identifier.
comment.mentions[].labelstringYes
comment.createdAtstringYesISO 8601 timestamp.
400Invalid comment or anchor; knowledge_comment_invalid
None.
401Authentication required
None.
403Knowledge write permission required
None.
404Document
None.
409Stale anchor revision (knowledge_revision_conflict) or reused comment id (knowledge_comment_conflict)
None.
Comment on selected document text or reply to a comment thread
Loading...
Response 201
Loading...
See the ACP quickstart and SDK flow