Skip to main content

Get Member Statistics

Get activity statistics for a workspace member.
const res = await client.member.statsByWorkspaceSlug.$get({
  slug: "acme",
  userId: "user-123"
})
const { stats, topPosts } = await res.json()
Type: Private Procedure (requires workspace membership)
slug
string
required
Workspace slug
userId
string
required
User ID to get statistics for
stats
object
topPosts
array
Cache: Response is cached for 2 minutes with 10-minute stale-while-revalidate.

Get Member Activity

Get activity log for a workspace member with pagination.
const res = await client.member.activityByWorkspaceSlug.$get({
  slug: "acme",
  userId: "user-123",
  limit: 20,
  cursor: "2024-01-15T10:30:00.000Z" // Optional for pagination
})
const { items, nextCursor } = await res.json()
Type: Private Procedure (requires workspace membership)
slug
string
required
Workspace slug
userId
string
required
User ID to get activity for
limit
number
Number of activities per page (1-50, default: 20)
cursor
string
ISO date string for pagination (items before this date)
items
array
nextCursor
string | null
Cursor for next page (null if no more items)
Cache: Response is cached for 1 minute with 5-minute stale-while-revalidate.

Activity Types

The activity log tracks various user actions:

Post Activities

  • post_created - Created a new post
  • post_updated - Updated a post
  • post_deleted - Deleted a post
  • post_voted - Upvoted a post
  • post_vote_removed - Removed upvote
  • post_merged - Merged duplicate posts
  • post_reported - Reported a post
  • post_meta_updated - Updated post status/flags
  • post_board_updated - Moved post to different board

Comment Activities

  • comment_created - Created a comment
  • comment_updated - Updated a comment
  • comment_deleted - Deleted a comment
  • comment_voted - Voted on a comment
  • comment_vote_removed - Removed comment vote
  • comment_vote_changed - Changed vote type
  • comment_reported - Reported a comment
  • comment_pinned - Pinned a comment
  • comment_unpinned - Unpinned a comment

Board Activities

  • tag_created - Created a tag
  • tag_deleted - Deleted a tag

Changelog Activities

  • changelog_entry_created - Created changelog entry
  • changelog_entry_updated - Updated changelog entry
  • changelog_entry_deleted - Deleted changelog entry
  • changelog_entry_published - Published changelog entry
  • changelog_tag_created - Created changelog tag
  • changelog_tag_deleted - Deleted changelog tag
  • changelog_notra_imported - Imported from Notra

Example: Member Profile

import { client } from "@/lib/client"

// Build a member profile page
async function getMemberProfile(workspaceSlug: string, userId: string) {
  // Get statistics
  const statsRes = await client.member.statsByWorkspaceSlug.$get({
    slug: workspaceSlug,
    userId
  })
  const { stats, topPosts } = await statsRes.json()

  // Get recent activity (first page)
  const activityRes = await client.member.activityByWorkspaceSlug.$get({
    slug: workspaceSlug,
    userId,
    limit: 20
  })
  const { items: activities, nextCursor } = await activityRes.json()

  return {
    stats,
    topPosts,
    recentActivity: activities,
    hasMore: nextCursor !== null,
    nextCursor
  }
}

// Load more activity
async function loadMoreActivity(
  workspaceSlug: string,
  userId: string,
  cursor: string
) {
  const res = await client.member.activityByWorkspaceSlug.$get({
    slug: workspaceSlug,
    userId,
    limit: 20,
    cursor
  })
  return await res.json()
}

// Usage
const profile = await getMemberProfile("acme", "user-123")

console.log(`Posts: ${profile.stats.posts}`)
console.log(`Comments: ${profile.stats.comments}`)
console.log(`Upvotes: ${profile.stats.upvotes}`)
console.log(`Top post: ${profile.topPosts[0]?.title}`)
console.log(`Recent activities: ${profile.recentActivity.length}`)

if (profile.hasMore) {
  const nextPage = await loadMoreActivity(
    "acme",
    "user-123",
    profile.nextCursor!
  )
  console.log(`Next page: ${nextPage.items.length} items`)
}

Permissions

Both member endpoints require the requesting user to be:
  • A member of the workspace, OR
  • The workspace owner
Users cannot view statistics or activity for members in workspaces they don’t belong to.

Use Cases

Member Profile Page

Display member contributions and engagement:
  • Total posts, comments, and votes
  • Top 5 most upvoted posts
  • Recent activity timeline

Team Dashboard

Track team member activity:
  • Who’s most active
  • What members are working on
  • Recent contributions

Moderation

Review member behavior:
  • Activity history
  • Patterns in contributions
  • Identify power users or potential issues

Build docs developers (and LLMs) love