Skip to main content

List Comments

Get all comments for a post.
// Authenticated user
const res = await client.comment.list.$get({ 
  postId: "post-123",
  surface: "workspace" // or "public"
})

// Anonymous user
const res = await client.comment.list.$get({ 
  postId: "post-123",
  fingerprint: "browser-fingerprint",
  surface: "public"
})

const { comments } = await res.json()
Type: Public Procedure
postId
string
required
Post ID
fingerprint
string
Browser fingerprint for anonymous vote status
surface
string
“public” or “workspace” - affects internal comment visibility
comments
array
Internal Comments:
  • Only visible to workspace members
  • Shown when surface: "workspace" and user has access
  • Useful for private team discussions

Create Comment

Add a new comment to a post.
const res = await client.comment.create.$post({
  postId: "post-123",
  content: "Great idea! This would be very useful.",
  parentId: "comment-456", // Optional: for replies
  isInternal: false,
  fingerprint: "browser-fingerprint" // For anonymous
})
const { comment } = await res.json()
Type: Public Procedure
postId
string
required
Post ID to comment on
content
string
required
Comment content
parentId
string
Parent comment ID for nested replies
isInternal
boolean
Mark as internal workspace note (requires membership)
fingerprint
string
Browser fingerprint for anonymous users
metadata
object
Additional metadata
Authentication:
  • Private boards: Requires workspace membership
  • Public boards: Authenticated or anonymous (if allowed)
  • Internal comments: Requires workspace membership
Automatic Actions:
  • Auto-upvoted by author
  • Updates parent’s reply count
  • Updates post’s comment count
  • Parses @mentions and creates notifications
  • Logs activity
Mentions:
const res = await client.comment.create.$post({
  postId: "post-123",
  content: "@John Smith can you take a look at this?"
})
// Automatically creates notification for John Smith

Update Comment

Edit an existing comment.
const res = await client.comment.update.$post({
  commentId: "comment-123",
  content: "Updated comment text"
})
const { comment } = await res.json()
Type: Private Procedure
commentId
string
required
Comment ID to update
content
string
required
New comment content
Permissions:
  • Only the comment author can edit their own comments
  • Sets isEdited: true and updates editedAt timestamp

Delete Comment

Permanently delete a comment.
const res = await client.comment.delete.$post({ 
  commentId: "comment-123" 
})
const { success } = await res.json()
Type: Private Procedure
commentId
string
required
Comment ID to delete
Permissions:
  • Comment author can delete their own comment
  • Workspace owner can delete any comment
Effects:
  • Hard deletes the comment
  • Updates parent reply count
  • Recalculates post comment count

Vote on Comment

Upvote or downvote a comment.
// Authenticated user
const res = await client.comment.vote.$post({
  commentId: "comment-123",
  voteType: "upvote" // or "downvote"
})

// Anonymous user
const res = await client.comment.vote.$post({
  commentId: "comment-123",
  voteType: "upvote",
  fingerprint: "browser-fingerprint"
})

const { upvotes, downvotes, userVote } = await res.json()
Type: Public Procedure
commentId
string
required
Comment ID to vote on
voteType
string
required
“upvote” or “downvote”
fingerprint
string
Required for anonymous users
upvotes
number
Updated upvote count
downvotes
number
Updated downvote count
userVote
string | null
User’s current vote (“upvote”, “downvote”, or null)
Behavior:
  • Same vote type: Removes vote (toggle off)
  • Different vote type: Changes vote
  • No existing vote: Adds vote

Report Comment

Report a comment for moderation.
const res = await client.comment.report.$post({
  commentId: "comment-123",
  reason: "offensive",
  description: "Contains inappropriate language"
})
Type: Private Procedure
commentId
string
required
Comment ID to report
reason
string
required
Reason (spam, offensive, harassment, other)
description
string
Additional details
Actions:
  • Creates report with “pending” status
  • Sends email to workspace owner
  • Logs activity with report count

Pin Comment

Pin or unpin a comment (workspace owner only).
const res = await client.comment.pin.$post({
  commentId: "comment-123",
  isPinned: true
})
Type: Private Procedure
commentId
string
required
Comment ID to pin/unpin
isPinned
boolean
required
Whether to pin or unpin
Permissions:
  • Only workspace owner can pin comments
Effect:
  • Pinned comments appear at the top of the comment list

Mention Notifications

List Mentions

Get mention notifications for current user.
const res = await client.comment.mentionsList.$get({ 
  limit: 50 
})
const { notifications } = await res.json()
Type: Private Procedure
limit
number
Maximum number to return (1-100, default: 50)
notifications
array

Count Unread Mentions

const res = await client.comment.mentionsCount.$get()
const { unread } = await res.json()
Type: Private Procedure

Mark Mention as Read

const res = await client.comment.mentionsMarkRead.$post({ 
  id: "mention-123" 
})
Type: Private Procedure

Mark All Mentions as Read

const res = await client.comment.mentionsMarkAllRead.$post()
Type: Private Procedure

Example: Complete Comment Flow

// 1. Load existing comments
const listRes = await client.comment.list.$get({ 
  postId: "post-123",
  surface: "workspace"
})
const { comments } = await listRes.json()

// 2. Create a new comment with mention
const createRes = await client.comment.create.$post({
  postId: "post-123",
  content: "@Alice Johnson what do you think about this approach?",
  isInternal: false
})
const { comment } = await createRes.json()
// Automatically creates mention notification for Alice

// 3. Vote on a comment
const voteRes = await client.comment.vote.$post({
  commentId: comment.id,
  voteType: "upvote"
})
const { upvotes, userVote } = await voteRes.json()

// 4. Create a reply
const replyRes = await client.comment.create.$post({
  postId: "post-123",
  content: "I agree with this suggestion!",
  parentId: comment.id // Reply to the comment
})

// 5. Check mentions (Alice's perspective)
const mentionsRes = await client.comment.mentionsList.$get()
const { notifications } = await mentionsRes.json()

// 6. Mark mention as read
if (notifications.length > 0) {
  await client.comment.mentionsMarkRead.$post({ 
    id: notifications[0].id 
  })
}

Build docs developers (and LLMs) love