Conversation comments API
Comment threads anchored to a conversation message (or to the whole conversation), with
@mention of participants and resolve/unresolve. All endpoints require an authenticated
admin session and are nested under a conversation:
GET /admin/v1/conversations/<CID>/commentsPOST /admin/v1/conversations/<CID>/commentsPATCH /admin/v1/conversations/<CID>/comments/<ID>DELETE /admin/v1/conversations/<CID>/comments/<ID>
Access model (trust boundary)
<CID> is the authorization anchor. Every request first resolves the caller's read
access to the conversation — the caller must be the conversation owner or have access to
the project a conversation is shared into (shared_in_project) — as a direct member, or through a
group, organisation or department grant. This is tenant-scoped
for free (a conversation carries no tenant column; tenant derives from its owner), so a user
from another tenant is neither owner nor member and is refused. There is no platform-admin
bypass: an admin who is neither owner nor project member cannot read a conversation's
comments.
All four endpoints are refused while impersonating: 403 { "error": "impersonation_forbidden", "code": "impersonation_forbidden" }, before any access check.
Failure is closed and does not leak existence: no read access, no such conversation, or a
comment whose conversation_id does not match <CID> all return 404 ({ "error": "not_found" }).
Comment bodies and @mention targets are user-authored conversation content and are stored
in the clear, consistent with the platform's documented at-rest posture for conversation
content (PII masking protects the upstream provider, not at-rest storage of a user's own
conversation). Comments are deleted with their conversation by the conversation retention
Löschfrist (tenant, project or user scope) and by GDPR user-erase (via database cascade; an erased user's authored comments
are additionally counted in the deletion record).
List comments
GET /admin/v1/conversations/<CID>/comments
Returns the conversation's non-deleted comments (oldest first) as a JSON array ([] when
there are none). A database error returns 503 { "error": "temporarily unavailable; retry later" } (retry) — never an empty array — so an outage is never
mistaken for an empty thread. The same 503 answers a failed read on every comment route (the
comment lookup of a resolve or delete, the anchor and participant lookups of a create); a failed
write (create, resolve, delete) answers the sanitised 500 { "error": "internal error",
"request_id": "…" } unless nothing was written. The database's own error text is never returned (see
Storage faults). Each element:
| Field | Type | Description |
|---|---|---|
id |
string | Comment identifier. |
conversation_id |
string | Parent conversation. |
message_id |
string | null | Anchored message; null = conversation-level (or the anchored message was hard-deleted). |
anchor_start |
integer | null | Inline text-range start (codepoint offset). |
anchor_end |
integer | null | Inline text-range end (codepoint offset). |
author_id |
string | Comment author. |
body |
string | Comment text. |
mention_user_ids |
string[] | Validated mentioned user ids (always an array). |
resolved_at |
unix seconds | null | null = open thread. |
resolved_by |
string | null | Who resolved it. |
created_at |
unix seconds | Creation time. |
updated_at |
unix seconds | Last update time. |
Creating a comment
POST /admin/v1/conversations/<CID>/comments
Required role: authenticated with read access to <CID> (else 404).
Accepted body:
| Field | Type | Required | Rules |
|---|---|---|---|
body |
string | yes | Valid UTF-8, ≤ 4000 codepoints, with something a reader can see. A body with nothing visible is rejected: only whitespace, including Unicode spaces such as no-break space U+00A0, U+2000–U+200A, U+202F, U+205F, ideographic space U+3000 and the line/paragraph separators U+2028/U+2029, or only invisible characters such as control characters, zero-width space U+200B, zero-width joiner, word joiner, soft hyphen, byte-order mark U+FEFF and braille blank U+2800 (examples of the gateway's shared "nothing visible" rule, not a complete list). A visible body is stored with only ASCII whitespace trimmed from its ends; Unicode spaces around or inside the text are kept. |
message_id |
string | no | Must be a live (non-deleted) message of <CID>. |
anchor_start, anchor_end |
integer | no | Both-or-neither; require message_id; 0 ≤ start ≤ end; end ≤ the message's codepoint length. |
mention_user_ids |
string[] | no | A JSON array of strings; ≤ 20 distinct entries after deduplication; each must be a conversation participant (see below). |
On success returns 201 with { "id": "<comment id>" }.
Rejected inputs (all 400 unless noted):
| Condition | Status |
|---|---|
body missing or null |
400 comment_body_required |
body present but not a string |
400 invalid_comment_body (formerly comment_body_required) |
body is not valid UTF-8 |
400 invalid_comment_body (formerly comment_body_invalid_utf8) |
body empty, whitespace only or invisible characters only |
400 comment_body_required (formerly comment_body_empty) |
body longer than 4000 codepoints |
400 |
message_id not a string, or not a live message of this conversation |
400 |
anchor offsets present without message_id |
400 |
only one of anchor_start / anchor_end present |
400 |
anchor offsets not numbers, or start < 0, end < start, or end beyond the message length |
400 |
mention_user_ids not an array (including a JSON object) |
400 |
a mention_user_ids entry is not a string |
400 |
| more than 20 distinct mentions | 400 |
| a mentioned id is not a participant of this conversation | 400 |
no read access to <CID> |
404 |
A JSON null for message_id, anchor_start, anchor_end or mention_user_ids counts as absent. Anchor offsets are floored to integers.
@mention targets are validated against the conversation's participant set: the owner plus,
for a conversation shared in its project, each direct member of that project (the project must
not be deleted) whose account is live and belongs to the project's tenant (platform admins are
exempt from the tenant check). The owner and every member are targets only while their account
is active: a disabled or deleted account is not a target, and re-enabling it restores it. A
stale member row of another tenant is not a target. A
non-participant id, including such a stale row or a disabled account, is rejected with the same 400 as a non-existent
id, byte for byte, so the endpoint is not a cross-tenant / cross-project user-existence oracle.
Members that come only through a group, organization or department grant are not mention
targets. (GET /projects/<ID> still lists stale member rows to project members so they can be
removed; each such row has effective: false, and the mention picker in the web app offers only members with effective: true and account_blocked: false.) Mentions are deduplicated and stored as a JSON array;
an empty list is stored as SQL NULL. Delivery of mention notifications is out of scope for
this endpoint (a future capability).
Resolve / unresolve a comment
PATCH /admin/v1/conversations/<CID>/comments/<ID>
Body: { "resolved": true | false } (a non-boolean is 400). Allowed for the comment
author or the conversation owner; anyone else with read access gets 403
({ "error": "forbidden" }), checked before the body is read. Returns the
updated comment row (so a client can reconcile to the server's resolved_by / resolved_at).
A comment id not under <CID>, or an already-deleted comment, returns 404. A database fault in the comment lookup answers 503 { "error": "temporarily unavailable; retry later" } (nothing written; retry); a fault in the write or the re-read after it answers the sanitised 500 { "error": "internal error", "request_id": "…" } — never the database's own error text (it goes to the server log under the same request_id); the conversation access check keeps its own answers.
Deleting a comment
DELETE /admin/v1/conversations/<CID>/comments/<ID>
Soft-deletes the comment. Allowed for the comment author or the conversation owner (owner
moderation); anyone else with read access gets 403. A missing or already-deleted comment,
or one not under <CID>, returns 404. On success returns 200 { "ok": true }.