FastComments.com

FastComments JavaScript/TypeScript SDK

This is the official JavaScript/TypeScript SDK for FastComments.

Manage comments, users, SSO, and moderation from Node.js or the browser.

Repository

View on GitHub

Installation Internal Link

npm install fastcomments-sdk

API Documentation Internal Link

Full API reference: docs/api/README.md

Browser vs Server Compatibility Internal Link

This SDK uses dual entry points to ensure optimal compatibility and prevent runtime errors:

  • fastcomments-sdk/browser - Browser-safe version with native fetch
  • fastcomments-sdk/server - Full Node.js version with SSO support
  • fastcomments-sdk (default) - Types only, safe to import anywhere

Public vs Secured APIs Internal Link

The SDK provides three main API classes:

  • DefaultApi - Secured endpoints that require your API key for authentication. Use these for server-side operations.
  • PublicApi - Public endpoints that can be accessed without an API key. These can be called directly from browsers/mobile devices/etc.
  • HiddenApi - Internal/admin endpoints for advanced use cases.

Example: Using Public API (browser-safe)

import { PublicApi } from 'fastcomments-sdk/browser';

const publicApi = new PublicApi();

// Get comments for a page (no API key required)
const response = await publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id'
});

Example: Using Default API (server-side only)

import { DefaultApi, Configuration } from 'fastcomments-sdk/server';

const config = new Configuration({
  apiKey: 'your-api-key' // Keep this secret!
});
const defaultApi = new DefaultApi(config);

// Get comments with full admin access
const response = await defaultApi.getComments({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id'
});

SSO (Single Sign-On) Integration Internal Link

FastComments supports SSO to integrate with your existing user authentication system. SSO functionality is only available in the server export since it requires Node.js crypto features.

Simple SSO (Server-Side Only)

Simple SSO should be generated server-side and sent to the client:

// Server-side code (Node.js/backend)
import { FastCommentsSSO, PublicApi } from 'fastcomments-sdk/server';

// Create simple SSO using the built-in helper  
const userData = {
  username: 'john_doe',
  email: 'john@example.com',
  displayName: 'John Doe',
  avatar: 'https://example.com/avatar.jpg'
};

const sso = FastCommentsSSO.createSimple(userData, {
  loginURL: '/login',
  logoutURL: '/logout'
});

const ssoToken = sso.createToken();

// Send ssoToken to your client-side code
// Client-side code can then use this token with the browser SDK

Secure SSO should be implemented server-side and provides better security:

// Server-side code (Node.js/backend)
import { FastCommentsSSO, PublicApi } from 'fastcomments-sdk/server';

// Create secure SSO using the built-in helper
const userData = {
  id: 'user-123',
  email: 'john@example.com',
  username: 'john_doe',
  displayName: 'John Doe',
  avatar: 'https://example.com/avatar.jpg',
  isAdmin: false,
  isModerator: false
};

const sso = FastCommentsSSO.createSecure('your-api-key', userData, {
  loginURL: '/login',
  logoutURL: '/logout'
});

const ssoConfig = sso.prepareToSend();

// Use with API calls on the server
const publicApi = new PublicApi();
const response = await publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id',
  sso: JSON.stringify(ssoConfig)
});

// Or send ssoConfig to client for browser usage

Using SSO from Browser (with Server-Generated Token)

// Client-side code (browser)
import { PublicApi } from 'fastcomments-sdk/browser';

// Get SSO token from your server endpoint
const ssoToken = await fetch('/api/sso-token').then(r => r.json());

const publicApi = new PublicApi();
const response = await publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id',
  sso: ssoToken // Use the server-generated SSO token
});

SSO with Comment Creation

// Server-side: Create SSO and comment
import { FastCommentsSSO, PublicApi } from 'fastcomments-sdk/server';

const sso = FastCommentsSSO.createSecure('your-api-key', userData);
const ssoConfig = sso.prepareToSend();

const response = await publicApi.createCommentPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id',
  broadcastId: 'unique-broadcast-id',
  commentData: {
    comment: 'This is my comment',
    date: Date.now(),
    commenterName: 'John Doe',
    url: 'https://example.com/page',
    urlId: 'page-url-id'
  },
  sso: JSON.stringify(ssoConfig)
});

Common Use Cases Internal Link

Getting Comments for a Page

const comments = await sdk.publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'article-123'
});

Creating a Comment

const newComment = await sdk.publicApi.createCommentPublic({
  createCommentParams: {
    tenantId: 'your-tenant-id',
    urlId: 'article-123',
    comment: 'Great article!',
    commenterName: 'John Doe',
    commenterEmail: 'john@example.com'
  }
});

Voting on a Comment

const voteResponse = await sdk.publicApi.voteComment({
  voteBodyParams: {
    commentId: 'comment-id',
    direction: 1 // 1 for upvote, -1 for downvote
  }
});

User Management (Requires API Key)

// Search for users (requires DefaultApi)
const users = await sdk.defaultApi.searchUsers({
  tenantId: 'your-tenant-id',
  urlId: 'page-id',
  usernameStartsWith: 'john'
});

Live Events (Real-time Updates) Internal Link

Subscribe to live events to get real-time updates for comments, votes, and other activities.

Page-Level Events

Listen for live events on a specific page (comments, votes, etc.):

import { subscribeToChanges, LiveEvent, LiveEventType } from 'fastcomments-sdk/browser';

const config = {
  tenantId: 'your-tenant-id',
  urlId: 'page-url-id',
};

// Subscribe to live events for a page
const subscription = subscribeToChanges(
  config,
  'your-tenant-id', // tenantIdWS
  'page-url-id',    // urlIdWS  
  'user-session-id', // userIdWS (get this from getComments response)
  (event: LiveEvent) => {
    console.log('Live event received:', event);

    switch (event.type) {
      case LiveEventType.new_comment:
        console.log('New comment:', event.comment);
        // Update your UI with the new comment
        break;
      case LiveEventType.new_vote:
        console.log('New vote:', event.vote);
        // Update vote counts in your UI
        break;
      case LiveEventType.updated_comment:
        console.log('Comment updated:', event.comment);
        break;
      default:
        console.log('Other event type:', event.type);
    }

    return true; // Return true if event was handled
  },
  (isConnected: boolean) => {
    console.log('Connection status:', isConnected ? 'Connected' : 'Disconnected');
  }
);

// Close the subscription when done
subscription.close();

Subscribe to User Events

Listen for user-specific events (notifications, mentions, etc.):

import { subscribeToUserFeed, LiveEvent, LiveEventType } from 'fastcomments-sdk/browser';

const userConfig = {
  userIdWS: 'user-session-id', // Get this from getComments response
};

// Subscribe to user's personal feed
const userSubscription = subscribeToUserFeed(
  userConfig,
  (event: LiveEvent) => {
    console.log('User event received:', event);

    switch (event.type) {
      case LiveEventType.notification:
        console.log('New notification:', event.notification);
        // Show notification in your UI
        break;
      case LiveEventType.notification_update:
        console.log('Notification updated:', event.notification);
        break;
      default:
        console.log('Other user event:', event.type);
    }

    return true;
  },
  (isConnected: boolean) => {
    console.log('User feed connection:', isConnected ? 'Connected' : 'Disconnected');
  }
);

// Close when done
userSubscription.close();

Getting userIdWS

The userIdWS parameter is required for live events and can be obtained from API responses:

const response = await sdk.publicApi.getCommentsPublic({
  tenantId: 'your-tenant-id',
  urlId: 'page-id'
});

// Extract userIdWS from the response
const userIdWS = response.data?.userSessionInfo?.userIdWS;

if (userIdWS) {
  // Now you can subscribe to live events
  const subscription = subscribeToChanges(config, tenantIdWS, urlIdWS, userIdWS, handleEvent);
}

Broadcast IDs Internal Link

You'll see you're supposed to pass a broadcastId in some API calls. When you receive events, you'll get this ID back, so you know to ignore the event if you plan to optimistically apply changes on the client (which you'll probably want to do since it offers the best experience). Pass a UUID here. The ID should be unique enough to not occur twice in a browser session.

import { v4 as uuidv4 } from 'uuid';

const response = await sdk.publicApi.createCommentPublic({
  createCommentParams: {
    tenantId: 'your-tenant-id',
    urlId: 'page-id',
    comment: 'My comment',
    broadcastId: uuidv4() // Unique ID for this operation
  }
});

Error Handling Internal Link

try {
  const comments = await sdk.publicApi.getCommentsPublic({
    tenantId: 'your-tenant-id',
    urlId: 'page-id'
  });
} catch (error) {
  if (error.response?.status === 404) {
    console.log('Page not found');
  } else {
    console.error('API Error:', error.message);
  }
}

aggregate Internal Link

Aggregates documents by grouping them (if groupBy is provided) and applying multiple operations. Different operations (e.g. sum, countDistinct, avg, etc.) are supported.

Parameters

Name Type Required Description
tenantId string Yes
aggregationRequest AggregationRequest Yes
parentTenantId string No
includeStats boolean No

Response

Returns: AggregationResponse

Example

aggregate Example
Copy Copy
1
2const tenantId: string = "tenant_42";
3const parentTenantId: string = "org_parent_7";
4const includeStats: boolean = true;
5const aggregationRequest: AggregationRequest = {
6 operation: { type: "COUNT", field: "commentId" },
7 groupBy: ["postId"],
8 filters: { predicates: [{ field: "status", operator: "EQ", value: { stringValue: "approved" } }] },
9 sort: [{ field: "count", direction: "DESC" }],
10 limit: 50
11};
12const result: AggregationResponse = await aggregate(tenantId, aggregationRequest, parentTenantId, includeStats);
13

getAuditLogs Internal Link

Parameters

Name Type Required Description
tenantId string Yes
limit number No
skip number No
order SORTDIR No
after number No
before number No

Response

Returns: GetAuditLogs200Response

Example

getAuditLogs Example
Copy Copy
1
2const tenantId: string = 'tenant_9c4f3a7b';
3const limit: number = 50;
4const skip: number = 0;
5const order: SORTDIR = SORTDIR.DESC;
6const after: number = 1672444800;
7const before: number = 1675036800;
8const response: GetAuditLogs200Response = await getAuditLogs(tenantId, limit, skip, order, after, before);
9

blockFromCommentPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
publicBlockFromCommentParams PublicBlockFromCommentParams Yes
sso string No

Response

Returns: BlockFromCommentPublic200Response

Example

blockFromCommentPublic Example
Copy Copy
1
2const tenantId: string = "tenant_9f4b2a";
3const commentId: string = "comment_3a7e1c";
4const publicBlockFromCommentParams: PublicBlockFromCommentParams = {
5 reason: "Repeated harassment toward other users",
6 durationHours: 168,
7 notifyCommenter: true
8};
9const sso: string = "eyJhbGciOiJIUzI1NiIkpXVCJ9.sso_example_token";
10const result: BlockFromCommentPublic200Response = await blockFromCommentPublic(tenantId, commentId, publicBlockFromCommentParams, sso);
11

unBlockCommentPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
publicBlockFromCommentParams PublicBlockFromCommentParams Yes
sso string No

Response

Returns: UnBlockCommentPublic200Response

Example

unBlockCommentPublic Example
Copy Copy
1
2async function demoUnblock(): Promise<void> {
3 const tenantId: string = 'tenant_12345';
4 const commentId: string = 'cmt_98765';
5 const publicBlockFromCommentParams: PublicBlockFromCommentParams = {
6 unblockReason: 'User appeal accepted after review',
7 moderatorId: 'mod_67890',
8 liftedAt: new Date().toISOString()
9 };
10 const sso: string = 'sso_tok_prod_01ab2c3d';
11 const result: UnBlockCommentPublic200Response = await unBlockCommentPublic(tenantId, commentId, publicBlockFromCommentParams, sso);
12 console.log(result);
13}
14demoUnblock();
15

checkedCommentsForBlocked Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentIds string Yes
sso string No

Response

Returns: CheckedCommentsForBlocked200Response

Example

checkedCommentsForBlocked Example
Copy Copy
1
2const tenantId: string = "tenant_98431";
3const commentIds: string = "cmt_2048,cmt_2049,cmt_2050";
4const resultWithoutSso: CheckedCommentsForBlocked200Response = await checkedCommentsForBlocked(tenantId, commentIds);
5const ssoToken: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.sample.signature";
6const resultWithSso: CheckedCommentsForBlocked200Response = await checkedCommentsForBlocked(tenantId, commentIds, ssoToken);
7

blockUserFromComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
blockFromCommentParams BlockFromCommentParams Yes
userId string No
anonUserId string No

Response

Returns: BlockFromCommentPublic200Response

Example

blockUserFromComment Example
Copy Copy
1
2const tenantId: string = 'tenant_acme_01';
3const id: string = 'cmt_20260112_7b9f';
4const blockFromCommentParams: BlockFromCommentParams = {
5 reason: 'Repeated spam links',
6 durationDays: 90,
7 blockReplies: true,
8 notifyCommenter: true
9};
10const userId: string = 'user_7f3e9';
11const result: BlockFromCommentPublic200Response = await blockUserFromComment(tenantId, id, blockFromCommentParams, userId);
12

createCommentPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes
broadcastId string Yes
commentData CommentData Yes
sessionId string No
sso string No

Response

Returns: CreateCommentPublic200Response

Example

createCommentPublic Example
Copy Copy
1
2const tenantId: string = "tenant_92b4f3";
3const urlId: string = "https://www.news-site.com/articles/2026/typescript-updates";
4const broadcastId: string = "broadcast_live_20260112";
5const commentData: CommentData = {
6 body: "Great updates — the stricter inference and tooling improvements will help a lot.",
7 author: { name: "Jordan Lee", avatarUrl: "https://avatars.example.com/jordan.jpg" },
8 metadata: { client: "web", editor: "rich-text" }
9};
10const sessionId: string = "sess_7a9c2d4b";
11const sso: string = "sso_token_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9";
12const result: CreateCommentPublic200Response = await createCommentPublic(tenantId, urlId, broadcastId, commentData, sessionId, sso);
13

deleteComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
contextUserId string No
isLive boolean No

Response

Returns: DeleteComment200Response

Example

deleteComment Example
Copy Copy
1
2async function run(): Promise<void> {
3 const result: DeleteComment200Response = await deleteComment(
4 'acme-corp-tenant-01',
5 'comment-9f2b3c',
6 'user-4827',
7 true
8 );
9 console.log(result);
10}
11run();
12

deleteCommentPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
broadcastId string Yes
editKey string No
sso string No

Response

Returns: DeleteCommentPublic200Response

Example

deleteCommentPublic Example
Copy Copy
1
2const tenantId: string = "acme-newsroom-tenant-001";
3const commentId: string = "cmt_20260112_9f2b3a";
4const broadcastId: string = "homepage-article-452";
5const editKey: string | undefined = "edit_7d3f6a9b";
6const sso: string | undefined = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ssoPayload.signature";
7
8const result: DeleteCommentPublic200Response = await deleteCommentPublic(
9 tenantId,
10 commentId,
11 broadcastId,
12 editKey,
13 sso
14);
15

deleteCommentVote Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
voteId string Yes
urlId string Yes
broadcastId string Yes
editKey string No
sso string No

Response

Returns: DeleteCommentVote200Response

Example

deleteCommentVote Example
Copy Copy
1
2const tenantId: string = 'tenant_1034';
3const commentId: string = 'cmt_20260111_784';
4const voteId: string = 'vote_7782';
5const urlId: string = 'article-2026-01-11-new-feature';
6const broadcastId: string = 'broadcast_2026_01_11_live';
7const editKey: string = 'edk_9f8e7d6c';
8const sso: string = 'sso_jwt_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
9
10const result: DeleteCommentVote200Response = await deleteCommentVote(tenantId, commentId, voteId, urlId, broadcastId, editKey, sso);
11

flagComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
userId string No
anonUserId string No

Response

Returns: FlagComment200Response

Example

flagComment Example
Copy Copy
1
2const tenantId: string = 'tenant_9d3f2b';
3const commentId: string = 'comment_4a7c1e';
4const userId: string = 'user_8234'; // optional authenticated user id
5const flaggedResponse: FlagComment200Response = await flagComment(tenantId, commentId, userId);
6

getComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetComment200Response

Example

getComment Example
Copy Copy
1
2const tenantId: string = 'acme-tenant-42';
3const commentId: string = 'b3d1f9c2-7e8a-4d2e-9a1b-6c2e9f8a1234';
4const commentResponse: GetComment200Response = await getComment(tenantId, commentId);
5const apiComment: APIComment | undefined = (commentResponse as { comment?: APIComment }).comment;
6const firstBadge: CommentUserBadgeInfo | undefined = apiComment?.user?.badges?.[0];
7

getComments Internal Link

Parameters

Name Type Required Description
tenantId string Yes
page number No
limit number No
skip number No
asTree boolean No
skipChildren number No
limitChildren number No
maxTreeDepth number No
urlId string No
userId string No
anonUserId string No
contextUserId string No
hashTag string No
parentId string No
direction SortDirections No

Response

Returns: GetComments200Response

Example

getComments Example
Copy Copy
1
2const commentsResponse: GetComments200Response = await getComments(
3 'tenant_abc123',
4 2,
5 25,
6 0,
7 true,
8 1,
9 3,
10 3,
11 'article-2026',
12 'user_42',
13 undefined,
14 undefined,
15 '#feature-release',
16 'cmt_987654'
17);
18

getCommentsPublic Internal Link

req tenantId urlId

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes
page number No
direction SortDirections No
sso string No
skip number No
skipChildren number No
limit number No
limitChildren number No
countChildren boolean No
fetchPageForCommentId string No
includeConfig boolean No
countAll boolean No
includei10n boolean No
locale string No
modules string No
isCrawler boolean No
includeNotificationCount boolean No
asTree boolean No
maxTreeDepth number No
useFullTranslationIds boolean No
parentId string No
searchText string No
hashTags Array No
userId string No
customConfigStr string No
afterCommentId string No
beforeCommentId string No

Response

Returns: GetCommentsPublic200Response

Example

getCommentsPublic Example
Copy Copy
1
2const response: GetCommentsPublic200Response = await getCommentsPublic(
3 'tenant_7f3a2c',
4 'https://blog.example.com/posts/2026/new-features',
5 1,
6 'DESC',
7 'sso_jwt_eyJhbGciOiJIUzI1Ni',
8 0,
9 0,
10 25,
11 5,
12 true,
13 undefined,
14 true,
15 false,
16 true,
17 'en-US',
18 'reactions,moderation',
19 false,
20 true,
21 true,
22 3,
23 false,
24 undefined,
25 'new features release',
26 ['release', 'feature'],
27 'user_98765',
28 '{"highlightThreads":true}',
29 undefined,
30 undefined
31);
32

getCommentText Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
editKey string No
sso string No

Response

Returns: GetCommentText200Response

Example

getCommentText Example
Copy Copy
1
2(async () => {
3 const tenantId: string = "tenant_98765";
4 const commentId: string = "cmt_54321";
5 const editKey: string = "edit_1a2b3c4d";
6 const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.fake.payload";
7 const commentTextBasic: GetCommentText200Response = await getCommentText(tenantId, commentId);
8 const commentTextWithAuth: GetCommentText200Response = await getCommentText(tenantId, commentId, editKey, sso);
9})();
10

getCommentVoteUserNames Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
dir number Yes
sso string No

Response

Returns: GetCommentVoteUserNames200Response

Example

getCommentVoteUserNames Example
Copy Copy
1
2async function example(): Promise<void> {
3 const tenantId: string = 'acme_corp';
4 const commentId: string = 'cmt_000123456';
5 const dirDownvote: number = -1;
6 const voteUserNamesDown: GetCommentVoteUserNames200Response = await getCommentVoteUserNames(tenantId, commentId, dirDownvote);
7 const dirUpvote: number = 1;
8 const ssoToken: string = 'sso:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
9 const voteUserNamesUp: GetCommentVoteUserNames200Response = await getCommentVoteUserNames(tenantId, commentId, dirUpvote, ssoToken);
10 console.log(voteUserNamesDown, voteUserNamesUp);
11}
12example();
13

lockComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
broadcastId string Yes
sso string No

Response

Returns: LockComment200Response

Example

lockComment Example
Copy Copy
1
2const tenantId: string = 'tenant_acme_42';
3const commentId: string = 'cmt_9f3b2a';
4const broadcastId: string = 'broadcast_2026-01-12_live';
5const sso: string | undefined = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ssoPayload.signature';
6const result: LockComment200Response = await lockComment(tenantId, commentId, broadcastId, sso);
7

pinComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
broadcastId string Yes
sso string No

Response

Returns: PinComment200Response

Example

pinComment Example
Copy Copy
1
2(async () => {
3 const tenantId: string = "tenant_1278";
4 const commentId: string = "cmt_84b3f";
5 const broadcastId: string = "brd_live_20260112";
6 const ssoToken: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.fake.signature";
7
8 const pinnedWithSso: PinComment200Response = await pinComment(tenantId, commentId, broadcastId, ssoToken);
9 const pinnedWithoutSso: PinComment200Response = await pinComment(tenantId, commentId, broadcastId);
10 console.log(pinnedWithSso, pinnedWithoutSso);
11})();
12

saveComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createCommentParams CreateCommentParams Yes
isLive boolean No
doSpamCheck boolean No
sendEmails boolean No
populateNotifications boolean No

Response

Returns: SaveComment200Response

Example

saveComment Example
Copy Copy
1
2const tenantId: string = "tenant_92b3c";
3const mention: CommentUserMentionInfo = { userId: "u842", displayName: "Alex Chen" };
4const hashtag: CommentUserHashTagInfo = { tag: "performance" };
5const createCommentParams: CreateCommentParams = {
6 threadId: "article-frontend-performance-2026",
7 content: "Performance improvements look great — shipped this in prod and saw a 12% render time reduction.",
8 authorName: "Jordan Harper",
9 authorEmail: "jordan.harper@example.com",
10 mentions: [mention],
11 hashtags: [hashtag]
12};
13const result: SaveComment200Response = await saveComment(tenantId, createCommentParams, true, true, false, true);
14

saveCommentsBulk Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createCommentParams Array Yes
isLive boolean No
doSpamCheck boolean No
sendEmails boolean No
populateNotifications boolean No

Response

Returns: Array<SaveComment200Response

Example

saveCommentsBulk Example
Copy Copy
1
2const tenantId: string = 'tenant_acme_922';
3const mention: CommentUserMentionInfo = { userId: 'u-204', displayName: 'Maria Gomez', username: 'maria.g' };
4const hashtag: CommentUserHashTagInfo = { tag: 'frontend', indices: [45, 53] };
5const createCommentParams: Array<CreateCommentParams> = [
6 {
7 content: 'I replaced the legacy DOM manipulation with a small component — performance improved by ~30%.',
8 authorName: 'Samuel Park',
9 authorEmail: 'samuel.park@devteam.io',
10 permalink: '/guides/performance-tuning',
11 createdAt: '2026-01-11T09:15:00Z',
12 userMentions: [mention],
13 userHashtags: [hashtag]
14 }
15];
16const responses: Array<SaveComment200Response> = await saveCommentsBulk(tenantId, createCommentParams, true, true, false, true);
17

setCommentText Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
broadcastId string Yes
commentTextUpdateRequest CommentTextUpdateRequest Yes
editKey string No
sso string No

Response

Returns: SetCommentText200Response

Example

setCommentText Example
Copy Copy
1
2const tenantId: string = "tenant_prod_81f4b3";
3const commentId: string = "cmt_9a2f4e7b";
4const broadcastId: string = "broadcast_2026_01_12_live";
5const mention: CommentUserMentionInfo = { userId: "user_123", displayName: "Jane Doe" };
6const hashtag: CommentUserHashTagInfo = { tag: "product-feedback" };
7const commentTextUpdateRequest: CommentTextUpdateRequest = {
8 text: "Thanks for the update — tagging @Jane Doe for visibility. #product-feedback",
9 mentions: [mention],
10 hashtags: [hashtag]
11};
12const editKey: string = "editkey_5f6b7c9d";
13const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ssoPayload.signature";
14const result: SetCommentText200Response = await setCommentText(tenantId, commentId, broadcastId, commentTextUpdateRequest, editKey, sso);
15

unBlockUserFromComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
unBlockFromCommentParams UnBlockFromCommentParams Yes
userId string No
anonUserId string No

Response

Returns: UnBlockCommentPublic200Response

Example

unBlockUserFromComment Example
Copy Copy
1
2const tenantId: string = "tenant_7b3f2c9a";
3const commentId: string = "comment_9d4a1f2b";
4const unBlockFromCommentParams: UnBlockFromCommentParams = {
5 reason: "User submitted successful appeal; block removed",
6 moderatorId: "mod_jane_doe",
7 effectiveAt: new Date().toISOString()
8};
9const userId: string = "user_5a8f3e21";
10const anonUserId: string = "anon_2f7d9c88";
11const result: UnBlockCommentPublic200Response = await unBlockUserFromComment(
12 tenantId,
13 commentId,
14 unBlockFromCommentParams,
15 userId,
16 anonUserId
17);
18

unFlagComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
userId string No
anonUserId string No

Response

Returns: FlagComment200Response

Example

unFlagComment Example
Copy Copy
1
2const tenantId: string = "tenant_3f8b1a4c";
3const id: string = "comment_5d7a2b9e";
4const userId: string = "moderator_1024";
5
6const result: FlagComment200Response = await unFlagComment(tenantId, id, userId);
7

unLockComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
broadcastId string Yes
sso string No

Response

Returns: LockComment200Response

Example

unLockComment Example
Copy Copy
1
2const tenantId: string = 'acme-tenant-7a1f2b';
3const commentId: string = 'cmt-9d4e2f7a-12';
4const broadcastId: string = 'bcast-2026-01-12-live';
5const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1Njc4IiwiaWF0IjoxNjQwMDAwMDB9.signature';
6
7const resultWithoutSso: LockComment200Response = await unLockComment(tenantId, commentId, broadcastId);
8const resultWithSso: LockComment200Response = await unLockComment(tenantId, commentId, broadcastId, ssoToken);
9

unPinComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
broadcastId string Yes
sso string No

Response

Returns: PinComment200Response

Example

unPinComment Example
Copy Copy
1
2const tenantId: string = 'acme-tenant-7f3d';
3const commentId: string = 'cmt_4b1e2a9c';
4const broadcastId: string = 'live_20260112_nyc';
5const sso: string = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1c2VyQGFjbWUuY29tIn0.r7hZQfK1Xk';
6const result: PinComment200Response = await unPinComment(tenantId, commentId, broadcastId, sso);
7

updateComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updatableCommentParams UpdatableCommentParams Yes
contextUserId string No
doSpamCheck boolean No
isLive boolean No

Response

Returns: FlagCommentPublic200Response

Example

updateComment Example
Copy Copy
1
2const tenantId: string = "tenant_82b1c4";
3const commentId: string = "cmt_9f3b2a1";
4const updatableCommentParams: UpdatableCommentParams = {
5 content: "Thanks — I've clarified the timeline and fixed the source link.",
6 metadata: { editedBy: "moderator_12", editReason: "clarity" }
7};
8const contextUserId: string = "user_47a2b";
9const doSpamCheck: boolean = true;
10const isLive: boolean = false;
11const result: FlagCommentPublic200Response = await updateComment(tenantId, commentId, updatableCommentParams, contextUserId, doSpamCheck, isLive);
12

voteComment Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
urlId string Yes
broadcastId string Yes
voteBodyParams VoteBodyParams Yes
sessionId string No
sso string No

Response

Returns: VoteComment200Response

Example

voteComment Example
Copy Copy
1
2const tenantId: string = "tenant_9f8d7c";
3const commentId: string = "c_5a1b2c3d";
4const urlId: string = "news/2026/01/clean-energy-policy";
5const broadcastId: string = "broadcast_20260112_live";
6const voteBodyParams: VoteBodyParams = { vote: "up", weight: 1 };
7const sessionId: string | undefined = "session_xyz123";
8const sso: string | undefined = "sso_jwt_token_eyJ";
9const result: VoteComment200Response = await voteComment(tenantId, commentId, urlId, broadcastId, voteBodyParams, sessionId, sso);
10

addDomainConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
addDomainConfigParams AddDomainConfigParams Yes

Response

Returns: AddDomainConfig200Response

Example

addDomainConfig Example
Copy Copy
1
2const tenantId: string = 'tenant_6a9f8b2c';
3const params: AddDomainConfigParams = {
4 domain: 'comments.myproduct.io',
5 allowedOrigins: ['https://www.myproduct.io', 'https://app.myproduct.io'],
6 enforceHttps: true, // optional parameter
7 description: 'Comments subdomain for product site'
8};
9const response: AddDomainConfig200Response = await addDomainConfig(tenantId, params);
10

deleteDomainConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
domain string Yes

Response

Returns: DeleteDomainConfig200Response

Example

deleteDomainConfig Example
Copy Copy
1
2const tenantId: string = 'tenant_8d3f2b4a9c';
3const domain: string = 'comments.myproduct.io';
4const response: DeleteDomainConfig200Response = await deleteDomainConfig(tenantId, domain);
5// Optional post-delete handler (demonstrates optional parameter usage)
6const onDeleted?: (res: DeleteDomainConfig200Response) => void = (res) => { /* notify admin, refresh UI */ };
7onDeleted?.(response);
8

getDomainConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
domain string Yes

Response

Returns: GetDomainConfig200Response

Example

getDomainConfig Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'acme-tenant-93b2';
4 const domain: string = 'comments.acme.com';
5 const domainConfig: GetDomainConfig200Response = await getDomainConfig(tenantId, domain);
6 console.log(domainConfig);
7})();
8

getDomainConfigs Internal Link

Parameters

Name Type Required Description
tenantId string Yes

Response

Returns: GetDomainConfigs200Response

Example

getDomainConfigs Example
Copy Copy
1
2// getDomainConfigs only requires tenantId; there are no optional parameters for this call
3const tenantId: string = "acme-corp-001";
4const domainConfigs: GetDomainConfigs200Response = await getDomainConfigs(tenantId);
5

patchDomainConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
domainToUpdate string Yes
patchDomainConfigParams PatchDomainConfigParams Yes

Response

Returns: GetDomainConfig200Response

Example

patchDomainConfig Example
Copy Copy
1
2const tenantId: string = 'tenant_acme_42';
3const domainToUpdate: string = 'comments.acme-app.com';
4const patchDomainConfigParams: PatchDomainConfigParams = {
5 enableHttps: true,
6 allowedOrigins: ['https://www.acme-app.com', 'https://app.acme-app.com'], // optional list
7 redirectToPrimaryDomain: false // optional toggle
8} as PatchDomainConfigParams;
9const updatedConfig: GetDomainConfig200Response = await patchDomainConfig(tenantId, domainToUpdate, patchDomainConfigParams);
10

putDomainConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
domainToUpdate string Yes
updateDomainConfigParams UpdateDomainConfigParams Yes

Response

Returns: GetDomainConfig200Response

Example

putDomainConfig Example
Copy Copy
1
2const tenantId: string = "tenant_92b4c1a7";
3const domainToUpdate: string = "blog.company-example.com";
4const updateDomainConfigParams: UpdateDomainConfigParams = {
5 enableComments: true,
6 moderationMode: "pre-moderation",
7 allowedOrigins: ["https://company-example.com", "https://studio.company-example.com"],
8 // optional parameter demonstrated by including redirectToCanonical (may be omitted)
9 redirectToCanonical: true
10};
11const response: GetDomainConfig200Response = await putDomainConfig(tenantId, domainToUpdate, updateDomainConfigParams);
12

createEmailTemplate Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createEmailTemplateBody CreateEmailTemplateBody Yes

Response

Returns: CreateEmailTemplate200Response

Example

createEmailTemplate Example
Copy Copy
1
2const tenantId: string = "tenant_7a9f2b3d";
3
4const createEmailTemplateBody: CreateEmailTemplateBody = {
5 name: "Comment Notification",
6 subject: "New comment on your article: {{postTitle}}",
7 htmlBody: "<p>{{commenterName}} left a comment:</p><blockquote>{{commentText}}</blockquote>",
8 enabled: true,
9 defaultLocale: "en-US",
10 metadata: { createdBy: "admin@example.com", purpose: "notify_comment" } // optional extra data
11};
12
13const result: CreateEmailTemplate200Response = await createEmailTemplate(tenantId, createEmailTemplateBody);
14

deleteEmailTemplate Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: FlagCommentPublic200Response

Example

deleteEmailTemplate Example
Copy Copy
1
2const tenantId: string = "tenant_4b2f6a-4b2f6a2d";
3const templateId: string = "email_template_9f8b7c3e";
4const result: FlagCommentPublic200Response = await deleteEmailTemplate(tenantId, templateId);
5const status: APIStatus | undefined = result?.status
6

deleteEmailTemplateRenderError Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
errorId string Yes

Response

Returns: FlagCommentPublic200Response

Example

deleteEmailTemplateRenderError Example
Copy Copy
1
2const tenantId: string = "tenant_8f3b2a9c";
3const id: string = "template_4a1c9f7e";
4const errorId: string = "err_20260112_abc123";
5const result: FlagCommentPublic200Response = await deleteEmailTemplateRenderError(tenantId, id, errorId);
6

getEmailTemplate Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetEmailTemplate200Response

Example

getEmailTemplate Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'acme-enterprises-123';
4 const id: string = 'welcome-email-template-v2';
5 const locale: string | undefined = 'en-US'; // optional parameter example
6 const template: GetEmailTemplate200Response = await getEmailTemplate(tenantId, id);
7 console.log(template, locale);
8})();
9

getEmailTemplateDefinitions Internal Link

Parameters

Name Type Required Description
tenantId string Yes

Response

Returns: GetEmailTemplateDefinitions200Response

Example

getEmailTemplateDefinitions Example
Copy Copy
1
2const tenantId: string = 'acme-enterprises-78f2';
3const emailTemplates: GetEmailTemplateDefinitions200Response = await getEmailTemplateDefinitions(tenantId);
4

getEmailTemplateRenderErrors Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
skip number No

Response

Returns: GetEmailTemplateRenderErrors200Response

Example

getEmailTemplateRenderErrors Example
Copy Copy
1
2const tenantId: string = "tenant_7b3f2a9c";
3const id: string = "tmpl_4f1b2c9e";
4const skip: number = 25;
5const result: GetEmailTemplateRenderErrors200Response = await getEmailTemplateRenderErrors(tenantId, id, skip);
6

getEmailTemplates Internal Link

Parameters

Name Type Required Description
tenantId string Yes
skip number No

Response

Returns: GetEmailTemplates200Response

Example

getEmailTemplates Example
Copy Copy
1
2const tenantId: string = 'tenant_8f4d2b7c';
3const responseWithoutSkip: GetEmailTemplates200Response = await getEmailTemplates(tenantId);
4const skip: number = 20;
5const responseWithSkip: GetEmailTemplates200Response = await getEmailTemplates(tenantId, skip);
6

renderEmailTemplate Internal Link

Parameters

Name Type Required Description
tenantId string Yes
renderEmailTemplateBody RenderEmailTemplateBody Yes
locale string No

Response

Returns: RenderEmailTemplate200Response

Example

renderEmailTemplate Example
Copy Copy
1
2const tenantId: string = 'acme-corp-7f3';
3const renderEmailTemplateBody: RenderEmailTemplateBody = {
4 templateId: 'new-comment-notification',
5 recipientEmail: 'jane.doe@acme.com',
6 variables: {
7 commenterName: 'Samir Patel',
8 commentText: 'I found this article really helpful — thanks for sharing!',
9 threadUrl: 'https://acme.com/blog/123#comments'
10 },
11 includeUnsubscribeLink: true
12};
13const locale: string = 'en-US';
14const response: RenderEmailTemplate200Response = await renderEmailTemplate(tenantId, renderEmailTemplateBody, locale);
15

updateEmailTemplate Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateEmailTemplateBody UpdateEmailTemplateBody Yes

Response

Returns: FlagCommentPublic200Response

Example

updateEmailTemplate Example
Copy Copy
1
2const tenantId: string = 'acme-corp-tenant-01';
3const id: string = 'email_tpl_42b7a9';
4const updateEmailTemplateBody: UpdateEmailTemplateBody = {
5 name: 'Comment Flag Notification',
6 subject: 'A comment was flagged on acme.com',
7 html: '<p>A comment by {{commenterName}} was flagged. Review at {{moderationUrl}}</p>',
8 replyTo: 'noreply@acme.com', // optional field demonstrated
9 enabled: true,
10 customConfig: { priority: 'high' } // optional custom parameters
11};
12const response: FlagCommentPublic200Response = await updateEmailTemplate(tenantId, id, updateEmailTemplateBody);
13

getEventLog Internal Link

req tenantId urlId userIdWS

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes
userIdWS string Yes
startTime number Yes
endTime number Yes

Response

Returns: GetEventLog200Response

Example

getEventLog Example
Copy Copy
1
2const tenantId: string = 'tenant_7f9c3b';
3const urlId: string = 'article-3f2a1c';
4const userIdWS: string = 'ws-user-4521';
5const startTime: number = Date.now() - 86_400_000; // 24 hours ago (ms)
6const endTime: number = Date.now();
7const endTimeOverride: number | undefined = undefined; // optional override
8const endTimeToUse: number = endTimeOverride ?? endTime;
9const response: GetEventLog200Response = await getEventLog(tenantId, urlId, userIdWS, startTime, endTimeToUse);
10

getGlobalEventLog Internal Link

req tenantId urlId userIdWS

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes
userIdWS string Yes
startTime number Yes
endTime number Yes

Response

Returns: GetEventLog200Response

Example

getGlobalEventLog Example
Copy Copy
1
2const tenantId: string = 'tenant_7a3f2b';
3const urlId: string = 'site-homepage';
4const optionalUrlId: string | undefined = undefined;
5const userIdWS: string = 'ws-user-9843';
6const startTime: number = Date.now() - 24 * 60 * 60 * 1000;
7const endTime: number = Date.now();
8const eventLog: GetEventLog200Response = await getGlobalEventLog(tenantId, optionalUrlId ?? urlId, userIdWS, startTime, endTime);
9

createFeedPost Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createFeedPostParams CreateFeedPostParams Yes
broadcastId string No
isLive boolean No
doSpamCheck boolean No
skipDupCheck boolean No

Response

Returns: CreateFeedPost200Response

Example

createFeedPost Example
Copy Copy
1
2const tenantId: string = "tenant_8f3b2c";
3const createFeedPostParams: CreateFeedPostParams = {
4 title: "Weekly product update",
5 body: "We shipped performance improvements and a login fix. Please share feedback.",
6 authorId: "user_72a1",
7 externalId: "post-2026-01-12",
8 media: [
9 {
10 type: "image",
11 assets: [
12 {
13 url: "https://cdn.example.com/images/update-jan.jpg",
14 width: 1200,
15 height: 630,
16 mimeType: "image/jpeg"
17 } as FeedPostMediaItemAsset
18 ]
19 } as FeedPostMediaItem
20 ],
21 links: [
22 { url: "https://example.com/releases/january", title: "Release notes" } as FeedPostLink
23};
24const broadcastId: string = "bcast_20260112";
25const isLive: boolean = true;
26const doSpamCheck: boolean = true;
27const skipDupCheck: boolean = false;
28const response: CreateFeedPost200Response = await createFeedPost(tenantId, createFeedPostParams, broadcastId, isLive, doSpamCheck, skipDupCheck);
29

createFeedPostPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createFeedPostParams CreateFeedPostParams Yes
broadcastId string No
sso string No

Response

Returns: CreateFeedPostPublic200Response

Example

createFeedPostPublic Example
Copy Copy
1
2const tenantId: string = 'fastcomments-tenant-84';
3const createFeedPostParams: CreateFeedPostParams = {
4 title: 'Product Update — Performance Improvements',
5 html: '<p>We deployed several backend optimizations reducing page load by ~30%.</p>',
6 authorName: 'Engineering Team',
7 published: true,
8 media: [
9 {
10 url: 'https://cdn.fastcomments.example/assets/release-2-4.png',
11 type: 'image',
12 assets: [{ url: 'https://cdn.fastcomments.example/assets/release-2-4-thumb.png', width: 320 }]
13 } as FeedPostMediaItem
14 ] as FeedPostMediaItem[],
15 links: [{ url: 'https://fastcomments.example/changelog/2.4', title: 'Full changelog' } as FeedPostLink]
16} as CreateFeedPostParams;
17const broadcastId: string = 'broadcast_2026_01_12_01';
18const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.signature';
19const result: CreateFeedPostPublic200Response = await createFeedPostPublic(tenantId, createFeedPostParams, broadcastId, sso);
20

deleteFeedPostPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
postId string Yes
broadcastId string No
sso string No

Response

Returns: DeleteFeedPostPublic200Response

Example

deleteFeedPostPublic Example
Copy Copy
1
2const tenantId: string = 'tenant_8f3a2b9c-4d5e-6f7a-8b9c-0d1e2f3a4b5c';
3const postId: string = 'post_74b3c9d2-1a6f-4e5d-9c3b-2a1e0f6d7c8b';
4const broadcastId: string = 'broadcast_2026-01-12_01';
5const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6InVzZXIxMjMiLCJleHAiOjE3MDAwMDAwMDB9.dummySignature12345';
6
7const responseWithAll: DeleteFeedPostPublic200Response = await deleteFeedPostPublic(tenantId, postId, broadcastId, sso);
8const responseRequiredOnly: DeleteFeedPostPublic200Response = await deleteFeedPostPublic(tenantId, postId);
9

getFeedPosts Internal Link

req tenantId afterId

Parameters

Name Type Required Description
tenantId string Yes
afterId string No
limit number No
tags Array No

Response

Returns: GetFeedPosts200Response

Example

getFeedPosts Example
Copy Copy
1
2const tenantId: string = "tenant_5f6d9c";
3const afterId: string | undefined = "post_20260110_abc123";
4const limit: number = 50;
5const tags: Array<string> = ["product-update", "security"];
6const response: GetFeedPosts200Response = await getFeedPosts(tenantId, afterId, limit, tags);
7

getFeedPostsPublic Internal Link

req tenantId afterId

Parameters

Name Type Required Description
tenantId string Yes
afterId string No
limit number No
tags Array No
sso string No
isCrawler boolean No
includeUserInfo boolean No

Response

Returns: GetFeedPostsPublic200Response

Example

getFeedPostsPublic Example
Copy Copy
1
2const tenantId: string = 'acme-corp-uk';
3const afterId: string | undefined = 'post_20260110_123456';
4const limit: number | undefined = 25;
5const tags: string[] | undefined = ['product-updates', 'featured'];
6const sso: string | undefined = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ssoPayload.signature';
7const isCrawler: boolean | undefined = false;
8const includeUserInfo: boolean | undefined = true;
9const response: GetFeedPostsPublic200Response = await getFeedPostsPublic(tenantId, afterId, limit, tags, sso, isCrawler, includeUserInfo);
10

getFeedPostsStats Internal Link

Parameters

Name Type Required Description
tenantId string Yes
postIds Array Yes
sso string No

Response

Returns: GetFeedPostsStats200Response

Example

getFeedPostsStats Example
Copy Copy
1
2const tenantId: string = 'acme-enterprises';
3const postIds: string[] = ['a1f3e9b2-4d6c-41a2-9f3b-0c1234567890', 'b2d4c6e8-7f9a-42b1-a3c4-1d0987654321'];
4const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyQGFjbWUuY29tIiwiaWF0IjoxNjA5NDU2MDB9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
5const statsWithSSO: GetFeedPostsStats200Response = await getFeedPostsStats(tenantId, postIds, sso);
6const statsWithoutSSO: GetFeedPostsStats200Response = await getFeedPostsStats(tenantId, postIds);
7

getUserReactsPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
postIds Array No
sso string No

Response

Returns: GetUserReactsPublic200Response

Example

getUserReactsPublic Example
Copy Copy
1
2const tenantId: string = 'acme-tenant-001';
3const postIds: Array<string> = ['post-1001', 'post-1002'];
4const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.signature';
5const userReacts: GetUserReactsPublic200Response = await getUserReactsPublic(tenantId, postIds, sso);
6

reactFeedPostPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
postId string Yes
reactBodyParams ReactBodyParams Yes
isUndo boolean No
broadcastId string No
sso string No

Response

Returns: ReactFeedPostPublic200Response

Example

reactFeedPostPublic Example
Copy Copy
1
2const tenantId: string = "tenant_9b1f4c";
3const postId: string = "post_c3f1a7";
4const reactBody: ReactBodyParams = { reactionType: "like", emoji: "👍", userId: "user_42", timestamp: new Date().toISOString() };
5const isUndo: boolean = false;
6const broadcastId: string = "broadcast_20260112_001";
7const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyXzQyIn0.signature";
8const result: ReactFeedPostPublic200Response = await reactFeedPostPublic(tenantId, postId, reactBody, isUndo, broadcastId, sso);
9

updateFeedPost Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
feedPost FeedPost Yes

Response

Returns: FlagCommentPublic200Response

Example

updateFeedPost Example
Copy Copy
1
2const tenantId: string = 'tenant-42-west';
3const id: string = 'post-2026-01-12-007';
4const mediaItem: FeedPostMediaItem = {
5 type: 'image',
6 caption: 'Team at launch event',
7 assets: [{ url: 'https://cdn.fastcomments.example/photos/launch-1234.jpg', width: 1920, height: 1080 }]
8};
9const feedPost: FeedPost = {
10 title: 'Product Launch Recap',
11 body: 'We rolled out the new moderation features and performance improvements.',
12 published: true,
13 // optional parameters demonstrated:
14 media: [mediaItem],
15 links: [{ title: 'Full changelog', url: 'https://example.com/changelog/q1-2026' }]
16};
17const response: FlagCommentPublic200Response = await updateFeedPost(tenantId, id, feedPost);
18

updateFeedPostPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
postId string Yes
updateFeedPostParams UpdateFeedPostParams Yes
broadcastId string No
sso string No

Response

Returns: CreateFeedPostPublic200Response

Example

updateFeedPostPublic Example
Copy Copy
1
2const tenantId: string = "tenant_98f4c2";
3const postId: string = "post_4a9b12";
4const updateFeedPostParams: UpdateFeedPostParams = {
5 title: "Weekly Product Update — Jan 12, 2026",
6 body: "Released performance improvements (~30%) and fixed comment threading bug.",
7 published: true,
8 tags: ["release", "performance"]
9};
10const broadcastId: string = "broadcast_20260112_01";
11const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.exampleSignature";
12const result: CreateFeedPostPublic200Response = await updateFeedPostPublic(tenantId, postId, updateFeedPostParams, broadcastId, sso);
13

flagCommentPublic Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
isFlagged boolean Yes
sso string No

Response

Returns: FlagCommentPublic200Response

Example

flagCommentPublic Example
Copy Copy
1
2const tenantId: string = "tenant_8a3f2b4c";
3const commentId: string = "cmt_9fc3e7a1";
4const isFlagged: boolean = true;
5const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
6const result: FlagCommentPublic200Response = await flagCommentPublic(tenantId, commentId, isFlagged, sso);
7

addHashTag Internal Link

Parameters

Name Type Required Description
tenantId string No
createHashTagBody CreateHashTagBody No

Response

Returns: AddHashTag200Response

Example

addHashTag Example
Copy Copy
1
2const tenantId: string = 'tenant_7b2f6c2b';
3const createBody: CreateHashTagBody = {
4 tag: 'feature-request',
5 label: 'Feature Request',
6 description: 'Requests for new functionality in the web client',
7 isActive: true,
8 visibility: 'public',
9 allowedDomains: ['example.com', 'internal.example.com']
10};
11const result: AddHashTag200Response = await addHashTag(tenantId, createBody);
12const resultWithoutTenant: AddHashTag200Response = await addHashTag(undefined, {
13 tag: 'bug',
14 label: 'Bug',
15 description: 'Use for reproducible bugs reported by users',
16 isActive: true,
17 visibility: 'public'
18});
19

addHashTagsBulk Internal Link

Parameters

Name Type Required Description
tenantId string No
bulkCreateHashTagsBody BulkCreateHashTagsBody No

Response

Returns: AddHashTagsBulk200Response

Example

addHashTagsBulk Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_3f2b9a';
4 const bulkCreateHashTagsBody: BulkCreateHashTagsBody = {
5 tags: [
6 { name: 'performance', description: 'Comments about site performance', visibleToModeratorsOnly: false },
7 { name: 'feature-request', description: 'Requests for new features', visibleToModeratorsOnly: true }
8 ]
9 };
10 const result: AddHashTagsBulk200Response = await addHashTagsBulk(tenantId, bulkCreateHashTagsBody);
11 const resultWithNoTenant: AddHashTagsBulk200Response = await addHashTagsBulk(undefined, bulkCreateHashTagsBody);
12 console.log(result, resultWithNoTenant);
13})();
14

deleteHashTag Internal Link

Parameters

Name Type Required Description
tag string Yes
tenantId string No
deleteHashTagRequest DeleteHashTagRequest No

Response

Returns: FlagCommentPublic200Response

Example

deleteHashTag Example
Copy Copy
1
2const tag: string = 'breaking-news';
3const tenantId: string = 'tenant_42';
4const deleteReq: DeleteHashTagRequest = { removedBy: 'moderator_jane', reason: 'off-topic for this community', deleteAssociatedComments: true } as DeleteHashTagRequest;
5const result: FlagCommentPublic200Response = await deleteHashTag(tag, tenantId, deleteReq);
6

getHashTags Internal Link

Parameters

Name Type Required Description
tenantId string Yes
page number No

Response

Returns: GetHashTags200Response

Example

getHashTags Example
Copy Copy
1
2(async () => {
3 const tenantId: string = "acme-corp-7a9f";
4 const tagsPage1: GetHashTags200Response = await getHashTags(tenantId);
5 const tagsPage2: GetHashTags200Response = await getHashTags(tenantId, 2);
6 console.log(tagsPage1, tagsPage2);
7})();
8

patchHashTag Internal Link

Parameters

Name Type Required Description
tag string Yes
tenantId string No
updateHashTagBody UpdateHashTagBody No

Response

Returns: PatchHashTag200Response

Example

patchHashTag Example
Copy Copy
1
2const tag: string = 'release-2026';
3const tenantId: string = 'tenant_42';
4const updateHashTagBody: UpdateHashTagBody = {
5 displayName: 'Release 2026',
6 description: 'Discussions and notes for the 2026 product release',
7 isActive: true
8};
9const result: PatchHashTag200Response = await patchHashTag(tag, tenantId, updateHashTagBody);
10

createModerator Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createModeratorBody CreateModeratorBody Yes

Response

Returns: CreateModerator200Response

Example

createModerator Example
Copy Copy
1
2const tenantId: string = "tenant_prod_us-east_01";
3const createModeratorBody: CreateModeratorBody = {
4 email: "maria.lopez+mod@fastcompany.com",
5 username: "mlopez_mod",
6 displayName: "Maria Lopez",
7 roles: ["content_moderator"],
8 notifyOnReports: true,
9 metadata: { region: "us-east", team: "community" }
10};
11const result: CreateModerator200Response = await createModerator(tenantId, createModeratorBody);
12

deleteModerator Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
sendEmail string No

Response

Returns: FlagCommentPublic200Response

Example

deleteModerator Example
Copy Copy
1
2const tenantId: string = 'acme-tenant-987';
3const moderatorId: string = 'mod-78b2c9a4-3f1e-4d6a';
4const sendEmail: string = 'true';
5const result: FlagCommentPublic200Response = await deleteModerator(tenantId, moderatorId, sendEmail);
6

getModerator Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetModerator200Response

Example

getModerator Example
Copy Copy
1
2const tenantId: string = "tenant_eu_4f8d2b9e";
3const maybeModeratorId: string | undefined = "mod_91c3b7a2"; // optional source (could be undefined)
4const moderator: GetModerator200Response = await getModerator(tenantId, maybeModeratorId!);
5

getModerators Internal Link

Parameters

Name Type Required Description
tenantId string Yes
skip number No

Response

Returns: GetModerators200Response

Example

getModerators Example
Copy Copy
1
2const tenantId: string = "tenant_corp_7f9b2a";
3const moderatorsPage1: GetModerators200Response = await getModerators(tenantId);
4const skip: number = 50;
5const moderatorsPage2: GetModerators200Response = await getModerators(tenantId, skip);
6

sendInvite Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
fromName string Yes

Response

Returns: FlagCommentPublic200Response

Example

sendInvite Example
Copy Copy
1
2const tenantId: string = 'acme-tenant-004';
3const id: string = 'comment_9b7f3a2c';
4const fromName: string = 'María Hernández';
5const response: FlagCommentPublic200Response = await sendInvite(tenantId, id, fromName);
6

updateModerator Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateModeratorBody UpdateModeratorBody Yes

Response

Returns: FlagCommentPublic200Response

Example

updateModerator Example
Copy Copy
1
2const tenantId: string = '4f8a9c2e-3b6d-4d9e-8c2f-1a2b3c4d5e6f';
3const id: string = 'mod_92a7c4';
4const updateModeratorBodyMinimal: UpdateModeratorBody = { displayName: 'Sophia Patel' };
5const updateModeratorBodyWithOptional: UpdateModeratorBody = {
6 displayName: 'Sophia Patel',
7 email: 'sophia.patel@newsroom.example',
8 permissions: ['remove_comments', 'ban_user'],
9 notifyOnFlag: true // optional parameter demonstrated
10};
11const result: FlagCommentPublic200Response = await updateModerator(tenantId, id, updateModeratorBodyWithOptional);
12

deleteNotificationCount Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: FlagCommentPublic200Response

Example

deleteNotificationCount Example
Copy Copy
1
2const tenantId: string = 'tenant_7f3a1b2c4d9e';
3const notificationId: string = 'notif_8c9d0a1b2f3e4b7';
4const result: FlagCommentPublic200Response = await deleteNotificationCount(tenantId, notificationId);
5

getCachedNotificationCount Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetCachedNotificationCount200Response

Example

getCachedNotificationCount Example
Copy Copy
1
2const tenantId: string = 'acme-tenant-01';
3const baseNotificationId: string = 'notif-000123';
4const idSuffix: string | undefined = undefined; // optional parameter example
5const notificationId: string = idSuffix ? `${baseNotificationId}-${idSuffix}` : baseNotificationId;
6const result: GetCachedNotificationCount200Response = await getCachedNotificationCount(tenantId, notificationId);
7console.log(result);
8

getNotificationCount Internal Link

Parameters

Name Type Required Description
tenantId string Yes
userId string No
urlId string No
fromCommentId string No
viewed boolean No
type string No

Response

Returns: GetNotificationCount200Response

Example

getNotificationCount Example
Copy Copy
1
2const tenantId: string = 'tenant_8a9b7c';
3const userId: string = 'user_42b3c';
4const urlId: string = 'https://blog.example.com/posts/introducing-new-editor';
5const fromCommentId: string | undefined = undefined;
6const viewed: boolean = false;
7const type: string = 'mention';
8const result: GetNotificationCount200Response = await getNotificationCount(tenantId, userId, urlId, fromCommentId, viewed, type);
9

getNotifications Internal Link

Parameters

Name Type Required Description
tenantId string Yes
userId string No
urlId string No
fromCommentId string No
viewed boolean No
type string No
skip number No

Response

Returns: GetNotifications200Response

Example

getNotifications Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_8f3b1a2c';
4 const userId: string = 'user_42';
5 const urlId: string = 'https://news.example.com/articles/2026/01/11/comment-thread';
6 const fromCommentId: string = 'cmt_9a7b';
7 const viewed: boolean = false;
8 const type: string = 'mention';
9 const skip: number = 0;
10 const response: GetNotifications200Response = await getNotifications(tenantId, userId, urlId, fromCommentId, viewed, type, skip);
11 console.log(response);
12})();
13

updateNotification Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateNotificationBody UpdateNotificationBody Yes
userId string No

Response

Returns: FlagCommentPublic200Response

Example

updateNotification Example
Copy Copy
1
2const tenantId: string = "tenant_86a7b3";
3const id: string = "notif_20260112_01";
4const userId: string = "moderator_42";
5const updateNotificationBody: UpdateNotificationBody = {
6 name: "Flagged comment alert",
7 enabled: true,
8 channels: ["email"],
9 recipients: ["mod-team@news-site.com"],
10 threshold: 1
11};
12
13(async () => {
14 const result: FlagCommentPublic200Response = await updateNotification(tenantId, id, updateNotificationBody, userId);
15 console.log(result);
16})();
17

addPage Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createAPIPageData CreateAPIPageData Yes

Response

Returns: AddPageAPIResponse

Example

addPage Example
Copy Copy
1
2const tenantId: string = "acme-corp-prod-01";
3const createData: CreateAPIPageData = {
4 url: "/docs/2026/comment-moderation",
5 title: "Comment Moderation Guide",
6 description: "Step-by-step instructions to configure moderation workflows for community posts.",
7 language: "en-US", // optional field
8 metadata: { productArea: "support", owner: "platform-team" } // optional field
9};
10const result: AddPageAPIResponse = await addPage(tenantId, createData);
11

deletePage Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: DeletePageAPIResponse

Example

deletePage Example
Copy Copy
1
2const tenantId: string = 'tenant_7c1ab2ef';
3const id: string = 'b5f9c3d0-12ab-4e6f-9a2c-3d4b5a6e7f8a';
4const response: DeletePageAPIResponse = await deletePage(tenantId, id);
5

getPageByURLId Internal Link

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes

Response

Returns: GetPageByURLIdAPIResponse

Example

getPageByURLId Example
Copy Copy
1
2const tenantId: string = 'acme-corp-742';
3const urlId: string = 'blog-article-9f4b2c';
4const response: GetPageByURLIdAPIResponse = await getPageByURLId(tenantId, urlId);
5const page: APIPage | undefined = response.page;
6const pageId: string | undefined = page?.id
7

getPages Internal Link

Parameters

Name Type Required Description
tenantId string Yes

Response

Returns: GetPagesAPIResponse

Example

getPages Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_8a7b3d2f';
4 const result: GetPagesAPIResponse = await getPages(tenantId);
5 const pages: APIPage[] = result.pages ?? [];
6 const firstPageId: string | undefined = pages[0]?.id;
7 console.log(`Tenant ${tenantId} has ${pages.length} pages; first page id: ${firstPageId}`);
8})();
9

patchPage Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateAPIPageData UpdateAPIPageData Yes

Response

Returns: PatchPageAPIResponse

Example

patchPage Example
Copy Copy
1
2const tenantId: string = 'tenant_7f3b2a4c';
3const pageId: string = 'page_9c1d8f7';
4const updateAPIPageData: UpdateAPIPageData = {
5 title: 'How to use FastComments with TypeScript',
6 path: '/guides/fastcomments-typescript',
7 isPublished: true,
8 metadata: { author: 'Alex Martinez', tags: ['comments', 'typescript'] } // optional field included
9};
10const result: PatchPageAPIResponse = await patchPage(tenantId, pageId, updateAPIPageData);
11

deletePendingWebhookEvent Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: FlagCommentPublic200Response

Example

deletePendingWebhookEvent Example
Copy Copy
1
2const tenantId: string = 'tenant_7f4e2b';
3const pendingEventId: string = '9f7b6a8c-3b2a-4c0d-a8e5-1234567890ab';
4const result: FlagCommentPublic200Response = await deletePendingWebhookEvent(tenantId, pendingEventId);
5console.log(result);
6

getPendingWebhookEventCount Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string No
externalId string No
eventType string No
type string No
domain string No
attemptCountGT number No

Response

Returns: GetPendingWebhookEventCount200Response

Example

getPendingWebhookEventCount Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_9c3b2b';
4 const commentId: string = 'cmt_f4a1b2';
5 const externalId: string = 'ext-789';
6 const eventType: string = 'comment.created';
7 const type: string = 'delivery';
8 const domain: string = 'app.example.com';
9 const attemptCountGT: number = 2;
10
11 const result: GetPendingWebhookEventCount200Response = await getPendingWebhookEventCount(
12 tenantId,
13 commentId,
14 externalId,
15 eventType,
16 type,
17 domain,
18 attemptCountGT
19 );
20
21 console.log(result);
22})();
23

getPendingWebhookEvents Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string No
externalId string No
eventType string No
type string No
domain string No
attemptCountGT number No
skip number No

Response

Returns: GetPendingWebhookEvents200Response

Example

getPendingWebhookEvents Example
Copy Copy
1
2const tenantId: string = "tenant_78b2f1";
3const commentId: string = "cmt_0042";
4const eventType: string = "comment.created";
5const domain: string = "blog.example.com";
6const attemptCountGT: number = 1;
7const skip: number = 0;
8
9const pending: GetPendingWebhookEvents200Response = await getPendingWebhookEvents(
10 tenantId,
11 commentId,
12 undefined, // externalId
13 eventType,
14 undefined, // type
15 domain,
16 attemptCountGT,
17 skip
18);
19

createQuestionConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createQuestionConfigBody CreateQuestionConfigBody Yes

Response

Returns: CreateQuestionConfig200Response

Example

createQuestionConfig Example
Copy Copy
1
2const tenantId: string = "tenant_live_7f8b3c2a";
3const customOptions: QuestionConfigCustomOptionsInner[] = [
4 { value: "under18", label: "Under 18" },
5 { value: "18-24", label: "18-24" },
6 { value: "25-34", label: "25-34", defaultSelected: true }
7];
8const createQuestionConfigBody: CreateQuestionConfigBody = {
9 key: "age_range",
10 label: "What is your age range?",
11 required: false, // optional: demonstrate omitted vs included optional fields
12 renderingType: QuestionRenderingType.Dropdown,
13 options: customOptions,
14 whenSave: QuestionWhenSave.Always
15};
16const result: CreateQuestionConfig200Response = await createQuestionConfig(tenantId, createQuestionConfigBody);
17

deleteQuestionConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: FlagCommentPublic200Response

Example

deleteQuestionConfig Example
Copy Copy
1
2async function deleteIfPresent(tenantId: string, id?: string): Promise<FlagCommentPublic200Response | null> {
3 if (!id) return null;
4 const result: FlagCommentPublic200Response = await deleteQuestionConfig(tenantId, id);
5 return result;
6}
7const tenantId: string = 'tenant_acme_001';
8const optionalConfigId: string | undefined = 'qcfg_20260112_01';
9(async (): Promise<void> => {
10 const deleted: FlagCommentPublic200Response | null = await deleteIfPresent(tenantId, optionalConfigId);
11 void deleted;
12})();
13

getQuestionConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetQuestionConfig200Response

Example

getQuestionConfig Example
Copy Copy
1
2const tenantId: string = 'acme-corp-47';
3const questionId: string = 'q-2026-01-12-01';
4const result: GetQuestionConfig200Response = await getQuestionConfig(tenantId, questionId);
5function summarizeConfig(cfg: GetQuestionConfig200Response, includeMetadata?: boolean): QuestionConfig | undefined {
6 // includeMetadata is optional; implementation omitted for brevity
7 return undefined;
8}
9const summarizedWithMeta: QuestionConfig | undefined = summarizeConfig(result, true);
10const summarizedDefault: QuestionConfig | undefined = summarizeConfig(result);
11

getQuestionConfigs Internal Link

Parameters

Name Type Required Description
tenantId string Yes
skip number No

Response

Returns: GetQuestionConfigs200Response

Example

getQuestionConfigs Example
Copy Copy
1
2const tenantId: string = 'tenant-42a7b9';
3const firstPage: GetQuestionConfigs200Response = await getQuestionConfigs(tenantId);
4const secondPage: GetQuestionConfigs200Response = await getQuestionConfigs(tenantId, 50);
5

updateQuestionConfig Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateQuestionConfigBody UpdateQuestionConfigBody Yes

Response

Returns: FlagCommentPublic200Response

Example

updateQuestionConfig Example
Copy Copy
1
2const tenantId: string = 'tenant-82b3a';
3const id: string = 'qst-20260112';
4const updateQuestionConfigBody: UpdateQuestionConfigBody = { label: 'Age verification', required: true, renderingType: 'singleChoice', customOptions: [{ value: '18-24', label: '18–24' }] } as UpdateQuestionConfigBody;
5const result: FlagCommentPublic200Response = await updateQuestionConfig(tenantId, id, updateQuestionConfigBody);
6

createQuestionResult Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createQuestionResultBody CreateQuestionResultBody Yes

Response

Returns: CreateQuestionResult200Response

Example

createQuestionResult Example
Copy Copy
1
2const tenantId: string = "fc_tenant_7a3c_us-east-1";
3const metaItem: MetaItem = { key: "referrer", value: "/blog/how-to-comment" };
4const createQuestionResultBody: CreateQuestionResultBody = {
5 questionId: "q_42",
6 commenterId: "user_1984",
7 answer: "yes",
8 score: 4,
9 meta: [metaItem] // optional metadata demonstrated
10} as CreateQuestionResultBody;
11const result: CreateQuestionResult200Response = await createQuestionResult(tenantId, createQuestionResultBody);
12

deleteQuestionResult Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: FlagCommentPublic200Response

Example

deleteQuestionResult Example
Copy Copy
1
2const tenantId: string = 'acme-tenant-01';
3const questionResultId: string = '6f1a2b3c-4d5e-6789-abcd-ef0123456789';
4const deletedResult: FlagCommentPublic200Response = await deleteQuestionResult(tenantId, questionResultId);
5console.log(deletedResult);
6

getQuestionResult Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetQuestionResult200Response

Example

getQuestionResult Example
Copy Copy
1
2const tenantId: string = "3fa85f64-5717-4562-b3fc-2c963f66afa6";
3const questionId: string = "question_72f1b9c3a4";
4const result: GetQuestionResult200Response = await getQuestionResult(tenantId, questionId);
5console.log(result);
6

getQuestionResults Internal Link

Parameters

Name Type Required Description
tenantId string Yes
urlId string No
userId string No
startDate string No
questionId string No
questionIds string No
skip number No

Response

Returns: GetQuestionResults200Response

Example

getQuestionResults Example
Copy Copy
1
2const tenantId: string = 'tenant_42';
3const urlId: string = 'news/2025/fastcomments-release';
4const userId: string = 'user_8b7f3c';
5const startDate: string = '2025-01-01T00:00:00Z';
6const questionIds: string = 'q123,q124';
7const skip: number = 20;
8const result: GetQuestionResults200Response = await getQuestionResults(tenantId, urlId, userId, startDate, undefined, questionIds, skip);
9

updateQuestionResult Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateQuestionResultBody UpdateQuestionResultBody Yes

Response

Returns: FlagCommentPublic200Response

Example

updateQuestionResult Example
Copy Copy
1
2const tenantId: string = 'tenant_84f2b9';
3const id: string = 'question_3a7c1d';
4const updateQuestionResultBody: UpdateQuestionResultBody = {
5 result: { verdict: 'helpful', confidence: 0.92 },
6 reviewer: { id: 'mod_102', name: 'Aisha Rahman' },
7 notifyUser: true // optional parameter included
8};
9const response: FlagCommentPublic200Response = await updateQuestionResult(tenantId, id, updateQuestionResultBody);
10

aggregateQuestionResults Internal Link

Parameters

Name Type Required Description
tenantId string Yes
questionId string No
questionIds Array No
urlId string No
timeBucket AggregateTimeBucket No
startDate Date No
forceRecalculate boolean No

Response

Returns: AggregateQuestionResults200Response

Example

aggregateQuestionResults Example
Copy Copy
1
2const tenantId: string = "tenant_9f3b7c2d";
3const questionIds: Array<string> = ["q_prod_feature_vote", "q_ui_satisfaction"];
4const urlId: string = "url_5f7a2c1e";
5const startDate: Date = new Date("2025-01-01T00:00:00Z");
6const forceRecalculate: boolean = true;
7
8const result: AggregateQuestionResults200Response = await aggregateQuestionResults(
9 tenantId,
10 undefined,
11 questionIds,
12 urlId,
13 undefined,
14 startDate,
15 forceRecalculate
16);
17

bulkAggregateQuestionResults Internal Link

Parameters

Name Type Required Description
tenantId string Yes
bulkAggregateQuestionResultsRequest BulkAggregateQuestionResultsRequest Yes
forceRecalculate boolean No

Response

Returns: BulkAggregateQuestionResults200Response

Example

bulkAggregateQuestionResults Example
Copy Copy
1
2const tenantId: string = "tenant_48d3a2b1";
3const requestItem: BulkAggregateQuestionItem = {
4 questionId: "q-7890",
5 metric: "response_count",
6 timeBuckets: [
7 {
8 start: "2025-01-01T00:00:00Z",
9 end: "2025-01-07T23:59:59Z"
10 }
11 ]
12};
13const bulkAggregateQuestionResultsRequest: BulkAggregateQuestionResultsRequest = {
14 items: [requestItem],
15 includeTotals: true
16};
17const forceRecalculate: boolean = true;
18const result: BulkAggregateQuestionResults200Response = await bulkAggregateQuestionResults(tenantId, bulkAggregateQuestionResultsRequest, forceRecalculate);
19

combineCommentsWithQuestionResults Internal Link

Parameters

Name Type Required Description
tenantId string Yes
questionId string No
questionIds Array No
urlId string No
startDate Date No
forceRecalculate boolean No
minValue number No
maxValue number No
limit number No

Response

Returns: CombineCommentsWithQuestionResults200Response

Example

combineCommentsWithQuestionResults Example
Copy Copy
1
2const tenantId: string = 'tenant_abc123';
3const questionIds: string[] = ['q_101', 'q_102'];
4const startDate: Date = new Date('2025-01-01T00:00:00Z');
5const limit: number = 200;
6const result: CombineCommentsWithQuestionResults200Response = await combineCommentsWithQuestionResults({
7 tenantId,
8 questionIds,
9 startDate,
10 forceRecalculate: true,
11 minValue: 0,
12 maxValue: 100,
13 limit
14});
15

addSSOUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createAPISSOUserData CreateAPISSOUserData Yes

Response

Returns: AddSSOUserAPIResponse

Example

addSSOUser Example
Copy Copy
1
2const tenantId: string = 'acme-tenant-7f8c2d4b';
3const createAPISSOUserData: CreateAPISSOUserData = {
4 externalId: 'okta|00u1abcd2345EfGH',
5 email: 'jane.doe@acme-corp.com',
6 displayName: 'Jane Doe',
7 avatarUrl: 'https://cdn.acme-corp.com/avatars/jane.jpg',
8 sendWelcomeEmail: true,
9 metadata: { department: 'Engineering', employeeId: 'E12345' }
10};
11const result: AddSSOUserAPIResponse = await addSSOUser(tenantId, createAPISSOUserData);
12

deleteSSOUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
deleteComments boolean No
commentDeleteMode string No

Response

Returns: DeleteSSOUserAPIResponse

Example

deleteSSOUser Example
Copy Copy
1
2const tenantId: string = 'tenant_8a3f4c2b-6d1a';
3const id: string = 'sso_user_3f9a7b1d-22c4';
4const deleteComments: boolean = true;
5const commentDeleteMode: string = 'permanent';
6const responseWithDeletion: DeleteSSOUserAPIResponse = await deleteSSOUser(tenantId, id, deleteComments, commentDeleteMode);
7const responseWithoutDeletion: DeleteSSOUserAPIResponse = await deleteSSOUser(tenantId, id);
8

getSSOUserByEmail Internal Link

Parameters

Name Type Required Description
tenantId string Yes
email string Yes

Response

Returns: GetSSOUserByEmailAPIResponse

Example

getSSOUserByEmail Example
Copy Copy
1
2const tenantId: string = "tenant_fc_7a9d3b";
3const email: string = "laura.powell@dailynews.com";
4const response: GetSSOUserByEmailAPIResponse = await getSSOUserByEmail(tenantId, email);
5const ssoUser: APISSOUser | undefined = response.user;
6const ssoUserEmail: string | undefined = ssoUser?.email;
7

getSSOUserById Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetSSOUserByIdAPIResponse

Example

getSSOUserById Example
Copy Copy
1
2const tenantId: string = "fastcomments-enterprise-42";
3const id: string = "sso_user_9f3b1c2d";
4const result: GetSSOUserByIdAPIResponse = await getSSOUserById(tenantId, id);
5const ssoUser: APISSOUser | undefined = result.user;
6const email: string | undefined = ssoUser?.email;
7console.log(email);
8

getSSOUsers Internal Link

Parameters

Name Type Required Description
tenantId string Yes
skip number No

Response

Returns: GetSSOUsers200Response

Example

getSSOUsers Example
Copy Copy
1
2const tenantId: string = 'tenant_4a9f3b2c-01';
3const resultWithoutSkip: GetSSOUsers200Response = await getSSOUsers(tenantId);
4
5const skip: number = 25;
6const resultWithSkip: GetSSOUsers200Response = await getSSOUsers(tenantId, skip);
7

patchSSOUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateAPISSOUserData UpdateAPISSOUserData Yes
updateComments boolean No

Response

Returns: PatchSSOUserAPIResponse

Example

patchSSOUser Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_acme_01';
4 const id: string = 'ssouser_0a1b2c3d';
5 const updateData: UpdateAPISSOUserData = {
6 email: 'jane.doe@acme-corp.com',
7 name: 'Jane Doe',
8 provider: 'saml',
9 externalId: 'CN=Jane Doe,OU=Users,DC=acme,DC=com'
10 };
11 const updateComments: boolean = true;
12 const result: PatchSSOUserAPIResponse = await patchSSOUser(tenantId, id, updateData, updateComments);
13})();
14

putSSOUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateAPISSOUserData UpdateAPISSOUserData Yes
updateComments boolean No

Response

Returns: PutSSOUserAPIResponse

Example

putSSOUser Example
Copy Copy
1
2const tenantId: string = "fastcomments_tenant_7f3a2b";
3const id: string = "sso_user_4a9c21";
4const updateData: UpdateAPISSOUserData = {
5 email: "marija.kovacevic@example.com",
6 displayName: "Marija K.",
7 roles: ["moderator"],
8 avatarUrl: "https://cdn.example.com/avatars/marija.jpg",
9 externalId: "marija-kovacevic-01"
10};
11const updateComments: boolean = true;
12const result: PutSSOUserAPIResponse = await putSSOUser(tenantId, id, updateData, updateComments);
13

createSubscription Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createAPIUserSubscriptionData CreateAPIUserSubscriptionData Yes

Response

Returns: CreateSubscriptionAPIResponse

Example

createSubscription Example
Copy Copy
1
2(async () => {
3 const tenantId: string = "fc_tenant_7f3b2a";
4 const subscriptionData: CreateAPIUserSubscriptionData = {
5 userId: "user_84c9",
6 planId: "pro_annual",
7 startDate: "2026-01-15T12:00:00Z",
8 autoRenew: true,
9 paymentMethodId: "pm_visa_9876",
10 trialEndsAt: "2026-02-15T12:00:00Z", // optional field demonstrated
11 metadata: { signupSource: "marketing_campaign" } // optional field demonstrated
12 };
13 const result: CreateSubscriptionAPIResponse = await createSubscription(tenantId, subscriptionData);
14 console.log(result);
15})();
16

deleteSubscription Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
userId string No

Response

Returns: DeleteSubscriptionAPIResponse

Example

deleteSubscription Example
Copy Copy
1
2const responseWithoutUser: DeleteSubscriptionAPIResponse = await deleteSubscription('tenant_9f8b7a6c', 'sub_3a9d2e7b');
3const responseWithUser: DeleteSubscriptionAPIResponse = await deleteSubscription('tenant_9f8b7a6c', 'sub_8b2c4f1d', 'user_47b2f9c1');
4

getSubscriptions Internal Link

Parameters

Name Type Required Description
tenantId string Yes
userId string No

Response

Returns: GetSubscriptionsAPIResponse

Example

getSubscriptions Example
Copy Copy
1
2const tenantId: string = 'tenant_8a7f3b2c';
3const userId: string = 'user_4f1c9d6a';
4const subscriptions: GetSubscriptionsAPIResponse = await getSubscriptions(tenantId, userId);
5const tenantOnlySubscriptions: GetSubscriptionsAPIResponse = await getSubscriptions(tenantId);
6

getTenantDailyUsages Internal Link

Parameters

Name Type Required Description
tenantId string Yes
yearNumber number No
monthNumber number No
dayNumber number No
skip number No

Response

Returns: GetTenantDailyUsages200Response

Example

getTenantDailyUsages Example
Copy Copy
1
2const tenantId: string = "tenant_89f3c2-prod";
3const yearNumber: number = 2026;
4const monthNumber: number = 1;
5const skip: number = 0;
6const usages: GetTenantDailyUsages200Response = await getTenantDailyUsages(tenantId, yearNumber, monthNumber, undefined, skip);
7

createTenantPackage Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createTenantPackageBody CreateTenantPackageBody Yes

Response

Returns: CreateTenantPackage200Response

Example

createTenantPackage Example
Copy Copy
1
2const tenantId: string = "tenant_7f3b1a9c";
3const tenantPackage: TenantPackage = { id: "pkg_001", name: "Premium Plan", seats: 100 };
4const customConfig: CustomConfigParameters = { enableImages: true, maxImageSizeMb: 10 };
5const createTenantPackageBody: CreateTenantPackageBody = {
6 packageName: "Premium Plus",
7 tenantPackage,
8 customConfig,
9 notes: "Enable advanced moderation and image uploads" // optional parameter demonstrated
10};
11const result: CreateTenantPackage200Response = await createTenantPackage(tenantId, createTenantPackageBody);
12

deleteTenantPackage Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: FlagCommentPublic200Response

Example

deleteTenantPackage Example
Copy Copy
1
2const tenantId: string = 'fc-tenant-8a9c2b';
3const packageId: string = 'pkg-47f3c9';
4const result: FlagCommentPublic200Response = await deleteTenantPackage(tenantId, packageId);
5

getTenantPackage Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetTenantPackage200Response

Example

getTenantPackage Example
Copy Copy
1
2const tenantId: string = 'tenant_westus_01';
3const packageId: string = 'pkg_premium_annual_2026';
4interface FetchOptions { includeArchived?: boolean }
5const options: FetchOptions = { includeArchived: false };
6const result: GetTenantPackage200Response = await getTenantPackage(tenantId, packageId);
7

getTenantPackages Internal Link

Parameters

Name Type Required Description
tenantId string Yes
skip number No

Response

Returns: GetTenantPackages200Response

Example

getTenantPackages Example
Copy Copy
1
2const tenantId: string = 'tenant_4f3a9c2d';
3const skip: number = 25;
4const packagesResponse: GetTenantPackages200Response = await getTenantPackages(tenantId);
5const pagedPackagesResponse: GetTenantPackages200Response = await getTenantPackages(tenantId, skip);
6

replaceTenantPackage Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
replaceTenantPackageBody ReplaceTenantPackageBody Yes

Response

Returns: FlagCommentPublic200Response

Example

replaceTenantPackage Example
Copy Copy
1
2const tenantId: string = 'tenant-9b72f2';
3const packageId: string = 'pkg-prod-v2';
4const replaceTenantPackageBody: ReplaceTenantPackageBody = {
5 name: 'Premium Moderation Bundle',
6 enabled: true,
7 maxModerators: 4,
8 // optional fields like "notes" or "trialExpiry" are intentionally omitted here
9} as ReplaceTenantPackageBody;
10const result: FlagCommentPublic200Response = await replaceTenantPackage(
11 tenantId,
12 packageId,
13 replaceTenantPackageBody
14);
15

updateTenantPackage Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateTenantPackageBody UpdateTenantPackageBody Yes

Response

Returns: FlagCommentPublic200Response

Example

updateTenantPackage Example
Copy Copy
1
2const tenantId: string = 'tenant_8a4f1c9b';
3const packageId: string = 'pkg_premium_v2';
4const customConfig: CustomConfigParameters = { enableRichText: true, maxImagesPerComment: 5 };
5const updateTenantPackageBody: UpdateTenantPackageBody = {
6 name: 'Premium Moderation Package',
7 enabled: true,
8 description: 'Adds advanced spam rules, image moderation and priority support',
9 customConfigParameters: customConfig
10};
11const result: FlagCommentPublic200Response = await updateTenantPackage(tenantId, packageId, updateTenantPackageBody);
12

createTenantUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createTenantUserBody CreateTenantUserBody Yes

Response

Returns: CreateTenantUser200Response

Example

createTenantUser Example
Copy Copy
1
2const tenantId: string = "tenant_9a8c7e4b";
3const createTenantUserBody: CreateTenantUserBody = {
4 email: "julia.smith@acme-corp.com",
5 displayName: "Julia Smith",
6 role: "moderator",
7 password: "Str0ngP@ssword!23",
8 sendInviteEmail: true, // optional parameter demonstrated
9 locale: "en-US",
10 metadata: { department: "Customer Success" }
11};
12const result: CreateTenantUser200Response = await createTenantUser(tenantId, createTenantUserBody);
13

deleteTenantUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
deleteComments string No
commentDeleteMode string No

Response

Returns: FlagCommentPublic200Response

Example

deleteTenantUser Example
Copy Copy
1
2const tenantId: string = 'tenant_8f3b2a9c';
3const id: string = 'user_4e5f6a7b';
4const deleteComments: string = 'true';
5const commentDeleteMode: string = 'hard';
6
7const result: FlagCommentPublic200Response = await deleteTenantUser(tenantId, id, deleteComments, commentDeleteMode);
8

getTenantUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetTenantUser200Response

Example

getTenantUser Example
Copy Copy
1
2const tenantId: string = "tenant_9f7d4b2a-1c3e";
3const id: string = "user_6a12b3c4d5";
4const includeProfile: boolean | undefined = true; // optional parameter example
5const response: GetTenantUser200Response = await getTenantUser(tenantId, id);
6console.log("Tenant user fetched", response);
7

getTenantUsers Internal Link

Parameters

Name Type Required Description
tenantId string Yes
skip number No

Response

Returns: GetTenantUsers200Response

Example

getTenantUsers Example
Copy Copy
1
2const tenantId: string = 'tenant_8f3b2c1a';
3const skip: number = 50;
4const firstPage: GetTenantUsers200Response = await getTenantUsers(tenantId);
5const nextPage: GetTenantUsers200Response = await getTenantUsers(tenantId, skip);
6

replaceTenantUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
replaceTenantUserBody ReplaceTenantUserBody Yes
updateComments string No

Response

Returns: FlagCommentPublic200Response

Example

replaceTenantUser Example
Copy Copy
1
2const tenantId: string = "tenant_5f8b9a";
3const id: string = "user_92bf21";
4const replaceTenantUserBody: ReplaceTenantUserBody = {
5 email: "jane.doe@acme-corp.com",
6 displayName: "Jane Doe",
7 externalId: "acme|12345",
8 roles: ["commenter", "moderator"],
9 isActive: true,
10 metadata: { team: "product", location: "NYC" }
11};
12const updateComments: string = "Update historical comments to reflect new display name";
13const result: FlagCommentPublic200Response = await replaceTenantUser(tenantId, id, replaceTenantUserBody, updateComments);
14

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
redirectURL string No

Response

Returns: FlagCommentPublic200Response

Example

sendLoginLink Example
Copy Copy
1
2const tenantId: string = 'tenant_acme_01';
3const id: string = 'user_9f3b2a';
4const redirectURL: string = 'https://app.example.com/onboard?source=login-email';
5const result: FlagCommentPublic200Response = await sendLoginLink(tenantId, id, redirectURL);
6

updateTenantUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateTenantUserBody UpdateTenantUserBody Yes
updateComments string No

Response

Returns: FlagCommentPublic200Response

Example

updateTenantUser Example
Copy Copy
1
2const tenantId: string = 'tenant_84f3b2';
3const id: string = 'user_7a9d1c';
4const updateComments: string = 'Promoted to moderator and updated contact email';
5const updateTenantUserBody: UpdateTenantUserBody = {
6 email: 'jane.doe+mod@example.com',
7 displayName: 'Jane D.',
8 roles: ['moderator'],
9 isBanned: false,
10 metadata: { department: 'community' }
11};
12const result: FlagCommentPublic200Response = await updateTenantUser(tenantId, id, updateTenantUserBody, updateComments);
13

createTenant Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createTenantBody CreateTenantBody Yes

Response

Returns: CreateTenant200Response

Example

createTenant Example
Copy Copy
1
2const tenantId: string = "acme-corporation";
3const billing: BillingInfo = { planId: "pro", billingContactEmail: "finance@acme-corp.com", currency: "USD" };
4const domainConfig: APIDomainConfiguration = { primaryDomain: "comments.acme-corp.com", allowedDomains: ["acme-corp.com", "www.acme-corp.com"], enforceHttps: true };
5const importedSites: ImportedSiteType[] = [{ siteId: "site-001", url: "https://blog.acme-corp.com", name: "Acme Blog" }]; // optional
6const createBody: CreateTenantBody = { tenantName: "Acme Corporation", adminEmail: "admin@acme-corp.com", billingInfo: billing, domainConfiguration: domainConfig, importedSites, enableModeration: true };
7const response: CreateTenant200Response = await createTenant(tenantId, createBody);
8

deleteTenant Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
sure string No

Response

Returns: FlagCommentPublic200Response

Example

deleteTenant Example
Copy Copy
1
2const tenantId: string = "tenant_7b3f1a9e";
3const id: string = "flag_9c4d2b1a";
4const sure: string = "yes_confirm_delete";
5
6const result: FlagCommentPublic200Response = await deleteTenant(tenantId, id, sure);
7console.log(result);
8

getTenant Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetTenant200Response

Example

getTenant Example
Copy Copy
1
2const tenantId: string = "tenant_acme_corp";
3const id: string = "f47ac10b-58cc-4372-a567-0e02b2c3d479";
4interface GetOptions { includeDeleted?: boolean; locale?: string; }
5const options: GetOptions = { locale: "en-US" };
6const result: GetTenant200Response = await getTenant(tenantId, id);
7

getTenants Internal Link

Parameters

Name Type Required Description
tenantId string Yes
meta string No
skip number No

Response

Returns: GetTenants200Response

Example

getTenants Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_9f2d1b7c';
4 const meta: string = 'include=domains,billing,customConfig';
5 const skip: number = 20;
6 const response: GetTenants200Response = await getTenants(tenantId, meta, skip);
7 console.log(response);
8})();
9

updateTenant Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateTenantBody UpdateTenantBody Yes

Response

Returns: FlagCommentPublic200Response

Example

updateTenant Example
Copy Copy
1
2const tenantId: string = "tenant_01H4ZQ7KABCD";
3const id: string = "site_9f8e7d6c";
4const apiDomainConfiguration: APIDomainConfiguration = {
5 primaryDomain: "comments.acme.com",
6 allowSubdomains: true
7};
8const billingInfo: BillingInfo = {
9 planName: "Business",
10 billingContactEmail: "billing@acme.com",
11 seats: 25
12};
13const updateTenantBody: UpdateTenantBody = {
14 displayName: "Acme Corporation Comments",
15 apiDomainConfiguration,
16 billingInfo, // optional parameter demonstrated
17 enableModeration: true
18};
19const result: FlagCommentPublic200Response = await updateTenant(tenantId, id, updateTenantBody);
20

uploadImage Internal Link

Upload and resize an image

Parameters

Name Type Required Description
tenantId string Yes
file Blob Yes
sizePreset SizePreset No
urlId string No

Response

Returns: UploadImageResponse

Example

uploadImage Example
Copy Copy
1
2const tenantId: string = 'tenant-4f3b2c9'
3const file: Blob = new Blob([new Uint8Array([137,80,78,71,13,10,26,10])], { type: 'image/png' })
4const sizePreset: SizePreset = { name: 'medium', maxWidth: 1024, maxHeight: 768 }
5const urlId: string = 'article-2026-01-12'
6const result: UploadImageResponse = await uploadImage(tenantId, file, sizePreset, urlId)
7

getUserBadgeProgressById Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetUserBadgeProgressById200Response

Example

getUserBadgeProgressById Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'acme-inc-tenant-001';
4 const userId: string = 'user-842391';
5 const badgeProgress: GetUserBadgeProgressById200Response = await getUserBadgeProgressById(tenantId, userId);
6 console.log(badgeProgress);
7})();
8

getUserBadgeProgressByUserId Internal Link

Parameters

Name Type Required Description
tenantId string Yes
userId string Yes

Response

Returns: GetUserBadgeProgressById200Response

Example

getUserBadgeProgressByUserId Example
Copy Copy
1
2const tenantId: string = 'fastcomments-88a1';
3const userId: string = 'user_5f4d2c';
4const overrideUserId?: string = undefined; // optional override, demonstrate optional parameter usage
5const targetUserId: string = overrideUserId ?? userId;
6const result: GetUserBadgeProgressById200Response = await getUserBadgeProgressByUserId(tenantId, targetUserId);
7

getUserBadgeProgressList Internal Link

Parameters

Name Type Required Description
tenantId string Yes
userId string No
limit number No
skip number No

Response

Returns: GetUserBadgeProgressList200Response

Example

getUserBadgeProgressList Example
Copy Copy
1
2const tenantId: string = "tenant_4f7b9c2e";
3const userId: string = "user_9a12b3f6";
4const limit: number = 25;
5const skip: number = 0;
6const result: GetUserBadgeProgressList200Response = await getUserBadgeProgressList(tenantId, userId, limit, skip);
7

createUserBadge Internal Link

Parameters

Name Type Required Description
tenantId string Yes
createUserBadgeParams CreateUserBadgeParams Yes

Response

Returns: CreateUserBadge200Response

Example

createUserBadge Example
Copy Copy
1
2const tenantId: string = 'tenant_9f8b6c';
3const createUserBadgeParams: CreateUserBadgeParams = {
4 name: 'Top Contributor',
5 description: 'Awarded to users with 500+ helpful replies',
6 imageUrl: 'https://cdn.fastcomments.com/badges/top-contributor.png',
7 isActive: true,
8 criteria: { minComments: 500, minUpvotes: 120 }, // optional criteria
9 customConfig: { badgeColor: '#FFD700', displayOnProfile: true } // optional custom config
10};
11const result: CreateUserBadge200Response = await createUserBadge(tenantId, createUserBadgeParams);
12

deleteUserBadge Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: UpdateUserBadge200Response

Example

deleteUserBadge Example
Copy Copy
1
2const tenantId: string = "tenant_78b3c6d9";
3const id: string = "badge-4a7b-11e6-80f5-76304dec7eb7";
4const result: UpdateUserBadge200Response = await deleteUserBadge(tenantId, id);
5

getUserBadge Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetUserBadge200Response

Example

getUserBadge Example
Copy Copy
1
2async function demoFetch(tenantId: string, id: string, includeRelated?: boolean): Promise<GetUserBadge200Response> {
3 const response: GetUserBadge200Response = await getUserBadge(tenantId, id);
4 return response;
5}
6
7const tenantId: string = 'acme-enterprises-78';
8const badgeId: string = '9f8b7c6d-5e4f-4012-8a3b-0c1d2e3f4a5b';
9const badgeResponse: GetUserBadge200Response = await getUserBadge(tenantId, badgeId);
10

getUserBadges Internal Link

Parameters

Name Type Required Description
tenantId string Yes
userId string No
badgeId string No
type number No
displayedOnComments boolean No
limit number No
skip number No

Response

Returns: GetUserBadges200Response

Example

getUserBadges Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'site_8a12c9f';
4 const displayedOnComments: boolean = true;
5 const limit: number = 15;
6 const skip: number = 0;
7 const response: GetUserBadges200Response = await getUserBadges(tenantId, undefined, undefined, undefined, displayedOnComments, limit, skip);
8 console.log(response);
9})();
10

updateUserBadge Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
updateUserBadgeParams UpdateUserBadgeParams Yes

Response

Returns: UpdateUserBadge200Response

Example

updateUserBadge Example
Copy Copy
1
2const tenantId: string = "acme_corp_tenant_01";
3const id: string = "badge_000198";
4const updateUserBadgeParams: UpdateUserBadgeParams = {
5 name: "Top Reviewer",
6 description: "Awarded for 100+ helpful reviews",
7 color: "#ffb347",
8 imageUrl: "https://assets.acme.com/badges/top-reviewer.png",
9 // optional: expiresAt can be omitted if badge is permanent
10 expiresAt: "2027-01-01T00:00:00Z"
11};
12const updatedBadge: UpdateUserBadge200Response = await updateUserBadge(tenantId, id, updateUserBadgeParams);
13

getUserNotificationCount Internal Link

Parameters

Name Type Required Description
tenantId string Yes
sso string No

Response

Returns: GetUserNotificationCount200Response

Example

getUserNotificationCount Example
Copy Copy
1
2const tenantId: string = "tenant_3f8e9a2b-6c4d-4e0f-9d7a-12b3456c7890";
3const ssoToken: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1Njc4OSJ9.dummySignature";
4const notificationCount: GetUserNotificationCount200Response = await getUserNotificationCount(tenantId);
5const notificationCountWithSso: GetUserNotificationCount200Response = await getUserNotificationCount(tenantId, ssoToken);
6

getUserNotifications Internal Link

Parameters

Name Type Required Description
tenantId string Yes
pageSize number No
afterId string No
includeContext boolean No
afterCreatedAt number No
unreadOnly boolean No
dmOnly boolean No
noDm boolean No
includeTranslations boolean No
sso string No

Response

Returns: GetUserNotifications200Response

Example

getUserNotifications Example
Copy Copy
1
2(async () => {
3 const tenantId: string = "tenant_42";
4 const pageSize: number = 25;
5 const afterId: string = "notif_987654321";
6 const includeContext: boolean = true;
7 const afterCreatedAt: number = Date.now() - 7 * 24 * 60 * 60 * 1000;
8 const unreadOnly: boolean = true;
9 const dmOnly: boolean = false;
10 const noDm: boolean = false;
11 const includeTranslations: boolean = true;
12 const sso: string = "sso_jwt_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9";
13 const result: GetUserNotifications200Response = await getUserNotifications(tenantId, pageSize, afterId, includeContext, afterCreatedAt, unreadOnly, dmOnly, noDm, includeTranslations, sso);
14 console.log(result);
15})();
16

resetUserNotificationCount Internal Link

Parameters

Name Type Required Description
tenantId string Yes
sso string No

Response

Returns: ResetUserNotifications200Response

Example

resetUserNotificationCount Example
Copy Copy
1
2const tenantId: string = 'tenant_4a7f9c12';
3const ssoToken: string = 'sso_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
4const resultWithSso: ResetUserNotifications200Response = await resetUserNotificationCount(tenantId, ssoToken);
5const resultWithoutSso: ResetUserNotifications200Response = await resetUserNotificationCount(tenantId);
6

resetUserNotifications Internal Link

Parameters

Name Type Required Description
tenantId string Yes
afterId string No
afterCreatedAt number No
unreadOnly boolean No
dmOnly boolean No
noDm boolean No
sso string No

Response

Returns: ResetUserNotifications200Response

Example

resetUserNotifications Example
Copy Copy
1
2const tenantId: string = 'tenant_8b3f4';
3const afterId: string = 'notif_7a12';
4const afterCreatedAt: number = Date.now() - 3_600_000;
5const unreadOnly: boolean = true;
6const dmOnly: boolean = false;
7const noDm: boolean | undefined = undefined;
8const sso: string = 'sso-token-0a1b2c3d';
9
10const result: ResetUserNotifications200Response = await resetUserNotifications(
11 tenantId,
12 afterId,
13 afterCreatedAt,
14 unreadOnly,
15 dmOnly,
16 noDm,
17 sso
18);
19

updateUserNotificationCommentSubscriptionStatus Internal Link

Enable or disable notifications for a specific comment.

Parameters

Name Type Required Description
tenantId string Yes
notificationId string Yes
optedInOrOut UpdateUserNotificationCommentSubscriptionStatusOptedInOrOutEnum Yes
commentId string Yes
sso string No

Response

Returns: UpdateUserNotificationStatus200Response

Example

updateUserNotificationCommentSubscriptionStatus Example
Copy Copy
1
2const tenantId: string = "tenant_84f3b2";
3const notificationId: string = "notification_9a1c7";
4const optedInOrOut: UpdateUserNotificationCommentSubscriptionStatusOptedInOrOutEnum = UpdateUserNotificationCommentSubscriptionStatusOptedInOrOutEnum.OptedIn;
5const commentId: string = "comment_5d2e9";
6const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.exampleSignature";
7const result: UpdateUserNotificationStatus200Response = await updateUserNotificationCommentSubscriptionStatus(tenantId, notificationId, optedInOrOut, commentId, sso);
8

updateUserNotificationPageSubscriptionStatus Internal Link

Enable or disable notifications for a page. When users are subscribed to a page, notifications are created for new root comments, and also

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes
url string Yes
pageTitle string Yes
subscribedOrUnsubscribed UpdateUserNotificationPageSubscriptionStatusSubscribedOrUnsubscribedEnum Yes
sso string No

Response

Returns: UpdateUserNotificationStatus200Response

Example

updateUserNotificationPageSubscriptionStatus Example
Copy Copy
1
2const tenantId: string = "tenant_71b9f3c2";
3const urlId: string = "post-2026-01-12-why-ts-is-great";
4const url: string = "https://www.example-news.com/opinion/why-typescript-is-great";
5const pageTitle: string = "Why TypeScript Is Great for Large Teams";
6const subscribedOrUnsubscribed: UpdateUserNotificationPageSubscriptionStatusSubscribedOrUnsubscribedEnum =
7 UpdateUserNotificationPageSubscriptionStatusSubscribedOrUnsubscribedEnum.SUBSCRIBED;
8const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.exampleSignature";
9const response: UpdateUserNotificationStatus200Response = await updateUserNotificationPageSubscriptionStatus(
10 tenantId,
11 urlId,
12 url,
13 pageTitle,
14 subscribedOrUnsubscribed,
15 sso
16);
17

updateUserNotificationStatus Internal Link

Parameters

Name Type Required Description
tenantId string Yes
notificationId string Yes
newStatus UpdateUserNotificationStatusNewStatusEnum Yes
sso string No

Response

Returns: UpdateUserNotificationStatus200Response

Example

updateUserNotificationStatus Example
Copy Copy
1
2const tenantId: string = "tenant_acme_corp_01";
3const notificationId: string = "notif_20260112_84b2";
4const newStatus: UpdateUserNotificationStatusNewStatusEnum = UpdateUserNotificationStatusNewStatusEnum.Read;
5const ssoToken: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.signature";
6const resultWithoutSSO: UpdateUserNotificationStatus200Response = await updateUserNotificationStatus(tenantId, notificationId, newStatus);
7const resultWithSSO: UpdateUserNotificationStatus200Response = await updateUserNotificationStatus(tenantId, notificationId, newStatus, ssoToken);
8

getUserPresenceStatuses Internal Link

Parameters

Name Type Required Description
tenantId string Yes
urlIdWS string Yes
userIds string Yes

Response

Returns: GetUserPresenceStatuses200Response

Example

getUserPresenceStatuses Example
Copy Copy
1
2const tenantId: string = 'acme-news';
3const urlIdWS: string = 'wss://ws.fastcomments.com/tenant/acme-news';
4const userIds: string = 'user-7a9b,user-11f2';
5type PresenceOptions = { includeInactive?: boolean };
6const options: PresenceOptions = { includeInactive: true };
7const presence: GetUserPresenceStatuses200Response = await getUserPresenceStatuses(tenantId, urlIdWS, userIds);
8

searchUsers Internal Link

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes
usernameStartsWith string No
mentionGroupIds Array No
sso string No

Response

Returns: SearchUsers200Response

Example

searchUsers Example
Copy Copy
1
2const tenantId: string = 'acme-corp-tenant-42';
3const urlId: string = 'news-2026-01-12-top-story';
4const usernameStartsWith: string = 'sara';
5const mentionGroupIds: Array<string> = ['editors', 'community-managers'];
6const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.payload';
7
8const result: SearchUsers200Response = await searchUsers(tenantId, urlId, usernameStartsWith, mentionGroupIds, sso);
9

getUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetUser200Response

Example

getUser Example
Copy Copy
1
2const tenantId: string = "acme-publishing-42";
3const userIdOptional: string | undefined = "user_9d7b4c"; // may be undefined in some flows (optional)
4const id: string = userIdOptional ?? "user_default_0001";
5const result: GetUser200Response = await getUser(tenantId, id);
6console.log(result);
7

createVote Internal Link

Parameters

Name Type Required Description
tenantId string Yes
commentId string Yes
direction CreateVoteDirectionEnum Yes
userId string No
anonUserId string No

Response

Returns: VoteComment200Response

Example

createVote Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'acme-tenant-812';
4 const commentId: string = '5e8f8b7a-3d4b-4f1b-9a2e-1c9f2d6a7b8c';
5 const direction: CreateVoteDirectionEnum = CreateVoteDirectionEnum.UP;
6 const anonUserId: string = 'anon-84b9c2d';
7 const voteResult: VoteComment200Response = await createVote(tenantId, commentId, direction, undefined, anonUserId);
8 console.log(voteResult);
9})();
10

deleteVote Internal Link

Parameters

Name Type Required Description
tenantId string Yes
id string Yes
editKey string No

Response

Returns: DeleteCommentVote200Response

Example

deleteVote Example
Copy Copy
1
2const tenantId: string = 'tenant_7f3b21c9';
3const id: string = 'vote_4a2d9f1b';
4const editKey: string = 'edit_92b7c6a1';
5
6const resultWithoutEditKey: DeleteCommentVote200Response = await deleteVote(tenantId, id);
7const resultWithEditKey: DeleteCommentVote200Response = await deleteVote(tenantId, id, editKey);
8

getVotes Internal Link

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes

Response

Returns: GetVotes200Response

Example

getVotes Example
Copy Copy
1
2const tenantId: string = 'tenant_9f8b3c_prod';
3const urlId: string = '/news/2026/typescript-ecosystem-update';
4const votes: GetVotes200Response = await getVotes(tenantId, urlId);
5// If an optional parameter existed, e.g. includeHidden, it might be used like:
6// const votesWithHidden: GetVotes200Response = await getVotes(tenantId, urlId, { includeHidden: true });
7

getVotesForUser Internal Link

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes
userId string No
anonUserId string No

Response

Returns: GetVotesForUser200Response

Example

getVotesForUser Example
Copy Copy
1
2const tenantId: string = 'tenant_acme_01';
3const urlId: string = 'news/2026/01/12/product-launch';
4const userId: string = 'user_9c3f2b';
5const anonUserId: string = 'anon_d4e7a1';
6
7const votesForUser: GetVotesForUser200Response = await getVotesForUser(tenantId, urlId, userId);
8const votesForAnon: GetVotesForUser200Response = await getVotesForUser(tenantId, urlId, undefined, anonUserId);
9

Need Help?

If you encounter any issues or have questions about the JavaScript/TypeScript SDK, please:

Contributing

Contributions are welcome! Please visit the GitHub repository for contribution guidelines.