GET /v1/documents/:id/comments retrieves the most recent 80 comments on a document. POST /v1/documents/:id/comments appends a new comment to the thread. Both endpoints require that the document belongs to your account.
The comment feature requires the Safeclose real-time service to be active. If the service is unavailable,
POST requests return 503 Service Unavailable. Contact your workspace administrator if comments are consistently unavailable.List comments
Request headers
Bearer token obtained from your Clerk session. Example:
Bearer eyJhbGc...Path parameters
The unique identifier of the document whose comments you want to retrieve.
Response
Array of comment objects. Returns at most 80 items, ordered from oldest to newest within that window.
Example
Post a comment
503 if the real-time service is unavailable.
Request headers
Bearer token obtained from your Clerk session.
Must be
application/json.Path parameters
The unique identifier of the document to comment on.
Request body
The comment text. Minimum 1 character, maximum 2000 characters.
Response
Returns201 Created with the newly created comment object.
The comment that was just appended to the thread.
Example
Error cases
| Status | Error message | Cause |
|---|---|---|
400 | Invalid body. | The text field is missing, empty, or exceeds 2000 characters. |
401 | Missing Authorization Bearer token. | No Authorization header was sent. |
401 | Invalid or expired token. | The Bearer token is malformed or has expired. |
404 | Not found. | No document with the given id exists, or it belongs to a different account. |
503 | Redis not configured. | The real-time service is not available. Comments cannot be written until the service is enabled. Applies to POST only. |
