FastComments.com

FastComments JavaScript/TypeScript SDK

This is the official JavaScript/TypeScript SDK for FastComments.

Official JavaScript/TypeScript SDK for the FastComments API

Repository

View on GitHub

Installation Internal Link

Installation

npm install fastcomments-sdk

API Documentation Internal Link

API Documentation

Full API reference: docs/api/README.md

Browser vs Server Compatibility Internal Link

Browser vs Server Compatibility

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

Public vs Secured APIs

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

SSO (Single Sign-On) Integration

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

Common Use Cases

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

Live Events (Real-time Updates)

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

Broadcast IDs

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

Error Handling

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);
  }
}

TypeScript Support Internal Link

TypeScript Support

The SDK is written in TypeScript and provides complete type definitions for all API methods and response models:

// Import types from the default export (safe everywhere)
import type { 
  PublicComment, 
  CreateCommentParams, 
  GetCommentsPublic200Response 
} from 'fastcomments-sdk';

// Use with browser SDK
import { createFastCommentsBrowserSDK } from 'fastcomments-sdk/browser';

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

const comments: PublicComment[] = response.comments || [];

bulkAggregateQuestionResults Internal Link

POST /api/v1/question-results-aggregation/bulk

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_83a2b';
3const bulkAggregateQuestionResultsRequest: BulkAggregateQuestionResultsRequest = {
4 aggregations: [
5 { aggId: 'agg-001', questionId: 'q-9876', timeBucket: 'day', startDate: new Date('2025-01-01T00:00:00Z') },
6 { aggId: 'agg-002', questionIds: ['q-123', 'q-456'], urlId: 'article-789', timeBucket: 'month', startDate: new Date('2024-06-01T00:00:00Z') }
7 ]
8};
9const forceRecalculate: boolean = true;
10const result: BulkAggregateQuestionResults200Response = await bulkAggregateQuestionResults(tenantId, bulkAggregateQuestionResultsRequest, forceRecalculate);
11

createFeedPost Internal Link

POST /api/v1/feed-posts

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_12345";
3const createFeedPostParams: CreateFeedPostParams = {
4 title: "Weekly Product Update — October",
5 contentHTML: "<p>We shipped a faster search index and fixed login issues for iOS users.</p>",
6 media: [{ title: "Release Screenshot", linkUrl: "https://cdn.example.com/screenshot.png", sizes: [{ w: 1200, h: 800, src: "https://cdn.example.com/screenshot_1200.png" }] }],
7 links: [{ text: "Changelog", title: "Full changelog", url: "https://app.example.com/changelog/october" }],
8 fromUserId: "user_782",
9 fromUserDisplayName: "Product Team",
10 tags: ["release", "product", "ios"],
11 key: "release-oct-2025",
12 meta: { source: "web-dashboard", environment: "production" }
13};
14const broadcastId: string = "broadcast_98765";
15const isLive: boolean = true;
16const doSpamCheck: boolean = true;
17const skipDupCheck: boolean = false;
18const result: CreateFeedPost200Response = await createFeedPost(tenantId, createFeedPostParams, broadcastId, isLive, doSpamCheck, skipDupCheck);
19

blockUserFromComment Internal Link

POST /api/v1/comments/{id}/block

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_001';
3const id: string = 'comment_4321';
4const blockFromCommentParams: BlockFromCommentParams = { commentIdsToCheck: ['comment_4320', 'comment_4319'] };
5const userId: string = 'user_8842';
6const anonUserId: string = 'anon_7f9b';
7const result: BlockFromCommentPublic200Response = await blockUserFromComment(tenantId, id, blockFromCommentParams, userId, anonUserId);
8

createSubscription Internal Link

POST /api/v1/subscriptions

Parameters

Name Type Required Description
tenantId string Yes
createAPIUserSubscriptionData CreateAPIUserSubscriptionData Yes

Response

Returns: CreateSubscriptionAPIResponse

Example

createSubscription Example
Copy Copy
1
2const tenantId: string = 'acme-tenant-01';
3const createAPIUserSubscriptionData: CreateAPIUserSubscriptionData = {
4 urlId: 'blog-fastcomments-launch-2025',
5 pageTitle: 'FastComments Launch: What’s New in 2025',
6 url: 'https://blog.acme.com/fastcomments-launch-2025',
7 anonUserId: 'anon_84b7',
8 userId: 'user_92a1'
9};
10const response: CreateSubscriptionAPIResponse = await createSubscription(tenantId, createAPIUserSubscriptionData);
11console.log(response.subscription?.id, response.status);
12

aggregateQuestionResults Internal Link

GET /api/v1/question-results-aggregation

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_acme_01';
3const questionId: string | undefined = undefined;
4const questionIds: Array<string> = ['q-4572', 'q-4573'];
5const urlId: string = 'articles/homepage';
6const timeBucket: AggregateTimeBucket = 'month';
7const startDate: Date = new Date('2025-01-01T00:00:00Z');
8const forceRecalculate: boolean = true;
9const result: AggregateQuestionResults200Response = await aggregateQuestionResults(
10 tenantId,
11 questionId,
12 questionIds,
13 urlId,
14 timeBucket,
15 startDate,
16 forceRecalculate
17);
18

addSSOUser Internal Link

POST /api/v1/sso-users

Parameters

Name Type Required Description
tenantId string Yes
createAPISSOUserData CreateAPISSOUserData Yes

Response

Returns: AddSSOUserAPIResponse

Example

addSSOUser Example
Copy Copy
1
2const tenantId: string = 'tenant_7f3b2a';
3const createAPISSOUserData: CreateAPISSOUserData = {
4 groupIds: ['grp_4a1b2c'],
5 hasBlockedUsers: false,
6 isProfileCommentsPrivate: false,
7 isCommentModeratorAdmin: true,
8 isAdminAdmin: false,
9 isAccountOwner: false,
10 displayName: 'Jane Doe',
11 displayLabel: 'Jane D.',
12 optedInSubscriptionNotifications: true,
13 optedInNotifications: true,
14 avatarSrc: 'https://cdn.acmecorp.com/avatars/jane.doe.jpg',
15 loginCount: 12,
16 createdFromUrlId: 'homepage_banner',
17 signUpDate: 1698770000000,
18 email: 'jane.doe@acmecorp.com',
19 websiteUrl: 'https://jane.acme.dev',
20 username: 'jane.doe',
21 id: 'user_9c4b1a'
22};
23const result: AddSSOUserAPIResponse = await addSSOUser(tenantId, createAPISSOUserData);
24

addPage Internal Link

POST /api/v1/pages

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_tenant_78';
3const createData: CreateAPIPageData = { accessibleByGroupIds: ['engineering-team', 'marketing-team'], rootCommentCount: 0, title: 'Acme Product Launch — June 2025', url: 'https://blog.acme-corp.com/posts/product-launch-june-2025', urlId: 'acme-product-launch-2025' };
4const result: AddPageAPIResponse = await addPage(tenantId, createData);
5

aggregate Internal Link

POST /api/v1/aggregate

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_7';
4const includeStats: boolean = true;
5const aggregationRequest: AggregationRequest = {
6 resourceName: 'article:12345',
7 query: [
8 { key: 'createdAt', value: { from: '2025-01-01T00:00:00Z' }, operator: 'gte' },
9 { key: 'status', value: 'published', operator: 'eq' }
10 ],
11 groupBy: ['authorId'],
12 operations: [
13 { field: 'id', op: 'count', alias: 'commentCount' },
14 { field: 'userId', op: 'countDistinct', alias: 'uniqueCommenters' }
15 ],
16 sort: { field: 'commentCount', dir: 'desc' }
17};
18const result: AggregationResponse = await aggregate(tenantId, aggregationRequest, parentTenantId, includeStats);
19

combineCommentsWithQuestionResults Internal Link

GET /api/v1/question-results-aggregation/combine/comments

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_5d2c9a4b';
3const questionIds: Array<string> = ['q-1001', 'q-1002'];
4const startDate: Date = new Date('2025-06-01T00:00:00Z');
5const forceRecalculate: boolean = true;
6const limit: number = 100;
7const result: CombineCommentsWithQuestionResults200Response = await combineCommentsWithQuestionResults(
8 tenantId,
9 undefined, // questionId (optional)
10 questionIds,
11 undefined, // urlId (optional)
12 startDate,
13 forceRecalculate,
14 0, // minValue (optional)
15 100, // maxValue (optional)
16 limit // limit (optional)
17);
18

addDomainConfig Internal Link

POST /api/v1/domain-configs

Parameters

Name Type Required Description
tenantId string Yes
addDomainConfigParams AddDomainConfigParams Yes

Response

Returns: AddDomainConfig200Response

Example

addDomainConfig Example
Copy Copy
1
2type AddDomainConfigParams = {
3 domain: string;
4 emailFromName?: string;
5 emailFromEmail?: string;
6 logoSrc?: string;
7 logoSrc100px?: string;
8 footerUnsubscribeURL?: string;
9 [key: string]: any;
10 emailHeaders?: { [key: string]: string };
11};
12
13type AddDomainConfig200Response = {
14 reason: string;
15 code: string;
16 status: any | null;
17 _configuration: any | null;
18};
19
20const tenantId: string = "tenant_prod_9b2c4a";
21const params: AddDomainConfigParams = {
22 domain: "comments.acme-corp.com",
23 emailFromName: "Acme Notifications",
24 emailFromEmail: "notifications@acme-corp.com",
25 logoSrc: "https://assets.acme-corp.com/logo-wide.png",
26 logoSrc100px: "https://assets.acme-corp.com/logo-100.png",
27 footerUnsubscribeURL: "https://acme-corp.com/account/unsubscribe",
28 emailHeaders: { "X-Acme-Env": "production", "Reply-To": "support@acme-corp.com" },
29 key: "acme_comments_domain_key_v1"
30};
31
32const result: AddDomainConfig200Response = await addDomainConfig(tenantId, params);
33

createUserBadge Internal Link

POST /api/v1/user-badges

Parameters

Name Type Required Description
tenantId string Yes
createUserBadgeParams CreateUserBadgeParams Yes

Response

Returns: CreateUserBadge200Response

Example

createUserBadge Example
Copy Copy
1
2const tenantId: string = 'tenant_6a8f3b2c';
3const createUserBadgeParams: CreateUserBadgeParams = { userId: 'user_1942', badgeId: 'top_contributor', displayedOnComments: true };
4const response: CreateUserBadge200Response = await createUserBadge(tenantId, createUserBadgeParams);
5

deleteComment Internal Link

DELETE /api/v1/comments/{id}

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
2const tenantId: string = 'fastcomments_tenant_42';
3const id: string = 'cmt_7f3b2a1c';
4const contextUserId: string = 'moderator_1024';
5const isLive: boolean = false;
6const result: DeleteComment200Response = await deleteComment(tenantId, id, contextUserId, isLive);
7

deletePage Internal Link

DELETE /api/v1/pages/{id}

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: DeletePageAPIResponse

Example

deletePage Example
Copy Copy
1
2const tenantId: string = 'tenant_81b4c7e9';
3const pageId: string = 'page_5f3a2b1c';
4const result: DeletePageAPIResponse = await deletePage(tenantId, pageId);
5const reason: string | undefined = result.reason;
6const code: string | undefined = result.code;
7const status: string = result.status;
8

deleteSSOUser Internal Link

DELETE /api/v1/sso-users/{id}

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_6f2b1c9d';
3const userId: string = '5f3d2a9c-4b1e-47a2-9f0c-2e8d3b7c9f6a';
4const deleteComments: boolean = true;
5const commentDeleteMode: string = 'anonymize';
6const result: DeleteSSOUserAPIResponse = await deleteSSOUser(tenantId, userId, deleteComments, commentDeleteMode);
7

deleteUserBadge Internal Link

DELETE /api/v1/user-badges/{id}

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: UpdateUserBadge200Response

Example

deleteUserBadge Example
Copy Copy
1
2const result: UpdateUserBadge200Response = await deleteUserBadge('tenant_acme_corp', 'badge_987654321');
3const status: 'failed' = result.status;
4const secondaryCode: string | undefined = result.secondaryCode;
5const bannedUntil: number | undefined = result.bannedUntil;
6const maxCommentLength: number | null | undefined = result.customConfig?.maxCommentCharacterLength;
7

flagComment Internal Link

POST /api/v1/comments/{id}/flag

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 = 'site_82b9f4';
3const commentId: string = 'cmt_a3f1d9e7';
4const userId: string = 'user_9842'; // optional parameter provided
5
6const response: FlagComment200Response = await flagComment(tenantId, commentId, userId);
7

deleteDomainConfig Internal Link

DELETE /api/v1/domain-configs/{domain}

Parameters

Name Type Required Description
tenantId string Yes
domain string Yes

Response

Returns: DeleteDomainConfig200Response

Example

deleteDomainConfig Example
Copy Copy
1
2type DeleteDomainConfig200Response = { status: any | null };
3
4const tenantId: string = process.env.FASTCOMMENTS_TENANT_ID ?? 'acme-corp-tenant-8421';
5const domain: string = 'comments.acmeproducts.com';
6const domainAlias: string | undefined = process.env.DELETE_DOMAIN_ALIAS;
7
8const result: DeleteDomainConfig200Response = await deleteDomainConfig(tenantId, domainAlias ?? domain);
9

getComment Internal Link

GET /api/v1/comments/{id}

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetComment200Response

Example

getComment Example
Copy Copy
1
2async function example(): Promise<void> {
3 const tenantId: string = 'tenant_9a2b3c';
4 const commentId: string = 'cmt-7f6e5d4c';
5 const result: GetComment200Response = await getComment(tenantId, commentId);
6 const bannedUntil: number | undefined = result.bannedUntil;
7 const translatedError: string | undefined = result.translatedError;
8 const pageTitle: string | undefined = result.comment.pageTitle;
9 console.log(result.status, result.comment.id, pageTitle, bannedUntil, translatedError);
10}
11example();
12

getAuditLogs Internal Link

GET /api/v1/audit-logs

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_827f2b1a';
3const limit: number = 100;
4const order: SORTDIR = 'DESC';
5const after: number = Date.now() - 30 * 24 * 60 * 60 * 1000;
6const response: GetAuditLogs200Response = await getAuditLogs(tenantId, limit, undefined, order, after);
7

getDomainConfig Internal Link

GET /api/v1/domain-configs/{domain}

Parameters

Name Type Required Description
tenantId string Yes
domain string Yes

Response

Returns: GetDomainConfig200Response

Example

getDomainConfig Example
Copy Copy
1
2const tenantId: string = "acme-corp-01";
3const preferredDomain: string | undefined = "comments.acme.com";
4const domain: string = preferredDomain ?? "acme-corp.com";
5const response: GetDomainConfig200Response = await getDomainConfig(tenantId, domain);
6

deleteSubscription Internal Link

DELETE /api/v1/subscriptions/{id}

Parameters

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

Response

Returns: DeleteSubscriptionAPIResponse

Example

deleteSubscription Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'fc-tenant-001';
4 const subscriptionId: string = '34d9e7b2-8c41-4f6a-a2d3-9f0b6c5e21a7';
5 const userId: string = 'user-8723';
6 const resultWithUser: DeleteSubscriptionAPIResponse = await deleteSubscription(tenantId, subscriptionId, userId);
7 const resultWithoutUser: DeleteSubscriptionAPIResponse = await deleteSubscription(tenantId, subscriptionId);
8 console.log(resultWithUser, resultWithoutUser);
9})();
10

getFeedPosts Internal Link

GET /api/v1/feed-posts

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_83b2f';
3const afterId: string = 'post_20251101_a7';
4const limit: number = 25;
5const tags: Array<string> = ['news', 'product-launch'];
6const feedResponse: GetFeedPosts200Response = await getFeedPosts(tenantId, afterId, limit, tags);
7

getPages Internal Link

GET /api/v1/pages

Parameters

Name Type Required Description
tenantId string Yes

Response

Returns: GetPagesAPIResponse

Example

getPages Example
Copy Copy
1
2const tenantId: string = 'tenant_acme_98765';
3const result: GetPagesAPIResponse = await getPages(tenantId);
4const firstPage: APIPage | undefined = result.pages?.[0];
5const pageUrl: string | undefined = firstPage?.url;
6const isClosed: boolean | undefined = firstPage?.isClosed;
7console.log(result.status, firstPage?.title, pageUrl, isClosed);
8

getComments Internal Link

GET /api/v1/comments

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 response: GetComments200Response = await getComments(
3 "news-site-123",
4 1,
5 25,
6 undefined,
7 true,
8 undefined,
9 undefined,
10 3,
11 "article-2025-11-03-poll",
12 "user_9876",
13 undefined,
14 undefined,
15 "election",
16 "cmt_a1b2c3",
17 "MR"
18);
19

getDomainConfigs Internal Link

GET /api/v1/domain-configs

Parameters

Name Type Required Description
tenantId string Yes

Response

Returns: GetDomainConfigs200Response

Example

getDomainConfigs Example
Copy Copy
1
2const tenantId: string = 'acme-website-001';
3const includeArchived: boolean | undefined = undefined; // optional flag (not required by function)
4const result: GetDomainConfigs200Response = await getDomainConfigs(tenantId);
5const primaryReason: string = result.reason;
6const firstConfiguration: any | null = (result.configurations as any[] | null)?.[0] ?? null;
7

getUserBadge Internal Link

GET /api/v1/user-badges/{id}

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetUserBadge200Response

Example

getUserBadge Example
Copy Copy
1
2const tenantId: string = 'acme-tenant-01';
3const badgeId: string = 'badge_7a9c2f';
4const response: GetUserBadge200Response = await getUserBadge(tenantId, badgeId);
5const secondaryCode: string | undefined = response.secondaryCode;
6const bannedUntil: number | undefined = response.bannedUntil;
7const maxCommentLen: number | null | undefined = response.customConfig?.maxCommentCharacterLength;
8

getSSOUsers Internal Link

GET /api/v1/sso-users

Parameters

Name Type Required Description
tenantId string Yes
skip number No

Response

Returns: GetSSOUsers200Response

Example

getSSOUsers Example
Copy Copy
1
2(async () => {
3 const tenantId: string = "site_3f9d2b7a";
4 const skip: number = 50;
5 const responseWithSkip: GetSSOUsers200Response = await getSSOUsers(tenantId, skip);
6 const responseNoSkip: GetSSOUsers200Response = await getSSOUsers(tenantId);
7 console.log(responseWithSkip.users.length, responseNoSkip.status);
8})();
9

getPageByURLId Internal Link

GET /api/v1/pages/by-url-id

Parameters

Name Type Required Description
tenantId string Yes
urlId string Yes

Response

Returns: GetPageByURLIdAPIResponse

Example

getPageByURLId Example
Copy Copy
1
2const tenantId: string = 'newsroom-prod-01';
3const urlId: string = 'article-7d3f2a9b';
4const result: GetPageByURLIdAPIResponse = await getPageByURLId(tenantId, urlId);
5const isClosed: boolean | undefined = result.page?.isClosed;
6const pageUrl: string | undefined = result.page?.url;
7const groupIds: string[] = result.page?.accessibleByGroupIds ?? [];
8const rootComments: number = result.page?.rootCommentCount ?? 0;
9

getUserBadgeProgressById Internal Link

GET /api/v1/user-badge-progress/{id}

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetUserBadgeProgressById200Response

Example

getUserBadgeProgressById Example
Copy Copy
1
2const tenantId: string = 'tenant_98765';
3const badgeProgressId: string = '3b9f1e2a-8c4d-4a7e-b0f1-2c3d4e5f6a7b';
4const result: GetUserBadgeProgressById200Response = await getUserBadgeProgressById(tenantId, badgeProgressId);
5const progress: UserBadgeProgress = result.userBadgeProgress;
6const autoTrustFactor: number | undefined = progress.autoTrustFactor;
7const secondaryCode: string | undefined = result.secondaryCode;
8const bannedUntil: number | undefined = result.bannedUntil;
9

getSSOUserByEmail Internal Link

GET /api/v1/sso-users/by-email/{email}

Parameters

Name Type Required Description
tenantId string Yes
email string Yes

Response

Returns: GetSSOUserByEmailAPIResponse

Example

getSSOUserByEmail Example
Copy Copy
1
2(async () => {
3 const tenantId: string = 'tenant_4f9e7b';
4 const email: string = 'jane.doe@acme-corp.com';
5 const response: GetSSOUserByEmailAPIResponse = await getSSOUserByEmail(tenantId, email);
6 const user: APISSOUser | undefined = response.user;
7 const isAccountOwner: boolean | undefined = user?.isAccountOwner;
8 console.log(response.status, user?.id, isAccountOwner);
9})();
10

getUserBadgeProgressList Internal Link

GET /api/v1/user-badge-progress

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_acme_news';
3const userId: string = 'user_9f8d7c';
4const limit: number = 25;
5const response: GetUserBadgeProgressList200Response = await getUserBadgeProgressList(tenantId, userId, limit);
6

getUserBadgeProgressByUserId Internal Link

GET /api/v1/user-badge-progress/user/{userId}

Parameters

Name Type Required Description
tenantId string Yes
userId string Yes

Response

Returns: GetUserBadgeProgressById200Response

Example

getUserBadgeProgressByUserId Example
Copy Copy
1
2const tenantId: string = 'tenant_88f3b9';
3const userId: string = 'user_4a7c2f';
4const progressResponse: GetUserBadgeProgressById200Response = await getUserBadgeProgressByUserId(tenantId, userId);
5const secondaryCode: string | undefined = progressResponse.secondaryCode;
6const maxCommentLength: number | undefined = progressResponse.customConfig?.maxCommentCharacterLength ?? undefined;
7const firstCommentBadgeProgress: number | undefined = progressResponse.userBadgeProgress.progress['first_comment'];
8

getUserBadges Internal Link

GET /api/v1/user-badges

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
2const tenantId: string = 'tenant_acme_corp_01';
3const userId: string = 'user_71b2a9';
4const badgeId: string = 'gold_contributor';
5const displayedOnComments: boolean = true;
6const limit: number = 10;
7const skip: number = 0;
8
9const result: GetUserBadges200Response = await getUserBadges(
10 tenantId,
11 userId,
12 badgeId,
13 undefined, // type omitted
14 displayedOnComments,
15 limit,
16 skip
17);
18

getSSOUserById Internal Link

GET /api/v1/sso-users/by-id/{id}

Parameters

Name Type Required Description
tenantId string Yes
id string Yes

Response

Returns: GetSSOUserByIdAPIResponse

Example

getSSOUserById Example
Copy Copy
1
2const tenantId: string = 'tenant_3f9a7c';
3const id: string = '9b1deb4d-5f3a-4c6a-8f2e-7d9a1c2b3e4f';
4const response: GetSSOUserByIdAPIResponse = await getSSOUserById(tenantId, id);
5const user: APISSOUser | undefined = response.user;
6const groupCount: number = user?.groupIds?.length ?? 0;
7console.log(`status=${response.status} code=${response.code ?? 'none'} user=${user?.displayName ?? user?.username ?? 'n/a'} groups=${groupCount} owner=${user?.isAccountOwner ? 'yes' : 'no'}`);
8

patchDomainConfig Internal Link

PATCH /api/v1/domain-configs/{domainToUpdate}

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_9a3c2f";
3const domainToUpdate: string = "comments.example.com";
4const patchDomainConfigParams: PatchDomainConfigParams = {
5 emailFromName: "Example Comments Team",
6 emailFromEmail: "no-reply@notifications.example.com",
7 logoSrc100px: "https://cdn.example.com/assets/logo-100.png",
8 emailHeaders: {
9 "Reply-To": "support@example.com",
10 "List-Unsubscribe": "<mailto:unsubscribe@example.com>"
11 },
12 supportPhone: "+1-800-555-0123"
13};
14const result: GetDomainConfig200Response = await patchDomainConfig(tenantId, domainToUpdate, patchDomainConfigParams);
15

getSubscriptions Internal Link

GET /api/v1/subscriptions

Parameters

Name Type Required Description
tenantId string Yes
userId string No

Response

Returns: GetSubscriptionsAPIResponse

Example

getSubscriptions Example
Copy Copy
1
2(async () => {
3 const subscriptionsWithUser: GetSubscriptionsAPIResponse = await getSubscriptions('tenant_9f8b1c', 'user_4a7e22');
4 const subscriptionsWithoutUser: GetSubscriptionsAPIResponse = await getSubscriptions('tenant_9f8b1c');
5 console.log(subscriptionsWithUser, subscriptionsWithoutUser);
6})();
7

patchPage Internal Link

PATCH /api/v1/pages/{id}

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 = 'acme-tenant-42';
3const id: string = 'page_9b7c';
4const updateAPIPageData: UpdateAPIPageData = {
5 isClosed: true,
6 accessibleByGroupIds: ['group-moderators', 'group-paid-subscribers'],
7 urlId: 'install-widget-3' // optional parameter used here; title and url omitted
8};
9const response: PatchPageAPIResponse = await patchPage(tenantId, id, updateAPIPageData);
10console.log(response.status, response.page?.title, response.page?.createdAt);
11

saveComment Internal Link

POST /api/v1/comments

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 = 'acme-tenant-123';
3const createCommentParams: CreateCommentParams = {
4 commenterName: 'Alex Morgan',
5 commenterEmail: 'alex.morgan@example.com',
6 comment: 'Great write-up — this clarified several deployment pitfalls for me.',
7 url: 'https://www.example.com/blog/deploying-typescript',
8 urlId: 'deploying-typescript-2025',
9 pageTitle: 'Deploying TypeScript Services',
10 locale: 'en_us',
11 rating: 5,
12 key: 'submission-abc123'
13};
14const isLive: boolean = true;
15const doSpamCheck: boolean = true;
16const sendEmails: boolean = false;
17const populateNotifications: boolean = true;
18const result: SaveComment200Response = await saveComment(tenantId, createCommentParams, isLive, doSpamCheck, sendEmails, populateNotifications);
19

patchSSOUser Internal Link

PATCH /api/v1/sso-users/{id}

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
2const tenantId: string = "tenant_8b7f3c9a";
3const id: string = "user_92a1f4b7";
4const updateData: UpdateAPISSOUserData = {
5 displayName: "Jordan Lee",
6 displayLabel: "Jordan L.",
7 email: "jordan.lee@example.com",
8 avatarSrc: "https://cdn.example.net/avatars/jordan.jpg",
9 optedInNotifications: true,
10 optedInSubscriptionNotifications: false,
11 websiteUrl: "https://jordan.dev",
12 username: "jordanlee",
13 loginCount: 42,
14 signUpDate: 1627849200000,
15 groupIds: ["moderators", "beta_testers"],
16 isCommentModeratorAdmin: true
17};
18const result: PatchSSOUserAPIResponse = await patchSSOUser(tenantId, id, updateData, true);
19

saveCommentsBulk Internal Link

POST /api/v1/comments/bulk

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_7f3a2b";
3const createCommentParams: CreateCommentParams[] = [{
4 date: Date.now(),
5 localDateString: new Date().toLocaleString(),
6 commenterName: "Jordan Smith",
7 commenterEmail: "jordan.smith@example.com",
8 comment: "This feature fixed a workflow bottleneck for our team — great job!",
9 productId: 402,
10 userId: "usr_1029",
11 avatarSrc: "https://cdn.example.com/avatars/jordan_s.jpg",
12 url: "https://app.example.com/articles/optimizations",
13 urlId: "articles-optimizations-402",
14 key: "imported-2025-11-03-001",
15 mentions: [{ id: "usr_204", tag: "@AishaK", rawTag: "@AishaK", type: "user", sent: true }],
16 hashTags: [{ id: "ht_01", tag: "#performance", url: "https://app.example.com/tags/performance", retain: true }],
17 rating: 5,
18 pageTitle: "Performance Optimizations",
19 isFromMyAccountPage: false
20}];
21
22const result: SaveComment200Response[] = await saveCommentsBulk(tenantId, createCommentParams, true, true, false, true);
23

putDomainConfig Internal Link

PUT /api/v1/domain-configs/{domainToUpdate}

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_8f3b2c';
3const domainToUpdate: string = 'comments.news-site.com';
4const updateDomainConfigParams: UpdateDomainConfigParams = {
5 domain: 'comments.news-site.com',
6 emailFromName: 'NewsSite Community',
7 emailFromEmail: 'community@news-site.com',
8 logoSrc: 'https://news-site.com/assets/logo.svg',
9 logoSrc100px: 'https://news-site.com/assets/logo-100.png',
10 footerUnsubscribeURL: 'https://news-site.com/unsubscribe',
11 brandColor: '#003366',
12 emailHeaders: { 'Reply-To': 'community@news-site.com', 'X-Mailer': 'FastComments' }
13};
14const result: GetDomainConfig200Response = await putDomainConfig(tenantId, domainToUpdate, updateDomainConfigParams);
15

unFlagComment Internal Link

POST /api/v1/comments/{id}/un-flag

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 = 'acme-tenant-001';
3const id: string = 'comment_5f3a9c2e';
4const userId: string = 'user_7a1b2c3d';
5
6const response: FlagComment200Response = await unFlagComment(tenantId, id, userId);
7

unBlockUserFromComment Internal Link

POST /api/v1/comments/{id}/un-block

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_9f8b6a4c';
3const id: string = 'comment_5b3a2f1e';
4const unBlockFromCommentParams: UnBlockFromCommentParams = { commentIdsToCheck: ['comment_5b3a2f1e', 'comment_7e6d4a2b'] };
5const userId: string = 'user_42a7c9';
6const result: UnBlockCommentPublic200Response = await unBlockUserFromComment(tenantId, id, unBlockFromCommentParams, userId);
7

updateComment Internal Link

PATCH /api/v1/comments/{id}

Parameters

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

Response

Returns: FlagCommentPublic200Response

Example

updateComment Example
Copy Copy
1
2const tenantId: string = 'tenant_8f3b2c';
3const id: string = 'comment_9a7e1b';
4const body: PickAPICommentUpdatableCommentFields = {
5 date: new Date('2025-11-01T12:34:56Z'),
6 urlId: 'site-news-2025-11-01',
7 urlIdRaw: '/news/2025/11/01/example-piece',
8 url: 'https://example.com/news/2025/11/01/example-piece',
9 pageTitle: 'Example News: Major Update',
10 userId: 'user_2468',
11 commenterEmail: 'jane.doe@example.com',
12 commenterName: 'Jane Doe',
13 commenterLink: 'https://example.com/@janedoe',
14 comment: 'Thanks for the detailed coverage — this clarified a lot for me.',
15 commentHTML: '<p>Thanks for the detailed coverage — this clarified a lot for me.</p>',
16 verified: true,
17 approved: true,
18 votes: 27,
19 flagCount: 0,
20 meta: { wpUserId: '42' }
21};
22const contextUserId: string = 'moderator_1357';
23const doSpamCheck: boolean = true;
24const isLive: boolean = true;
25const result: FlagCommentPublic200Response = await updateComment(tenantId, id, body, contextUserId, doSpamCheck, isLive);
26

updateUserBadge Internal Link

PUT /api/v1/user-badges/{id}

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 = 'tenant_84b3a2';
3const id: string = 'user_4f2a1c';
4const updateUserBadgeParams: UpdateUserBadgeParams = { displayedOnComments: true };
5const result: UpdateUserBadge200Response = await updateUserBadge(tenantId, id, updateUserBadgeParams);
6

putSSOUser Internal Link

PUT /api/v1/sso-users/{id}

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 = 'acme-platform-tenant-01';
3const id: string = 'sso_user_7d3a2c';
4const updateAPISSOUserData: UpdateAPISSOUserData = {
5 id: 'sso_user_7d3a2c',
6 username: 'j.smith',
7 email: 'j.smith@acme.com',
8 displayName: 'John Smith',
9 displayLabel: 'John S.',
10 avatarSrc: 'https://cdn.acme.com/avatars/john_smith.png',
11 websiteUrl: 'https://johnsmith.dev',
12 signUpDate: 1625097600000,
13 loginCount: 42,
14 optedInNotifications: true,
15 optedInSubscriptionNotifications: false,
16 isAdminAdmin: false,
17 groupIds: ['marketing-team', 'customer-success'],
18 createdFromUrlId: 'signup_landing_03'
19};
20const updateComments: boolean = true;
21const result: PutSSOUserAPIResponse = await putSSOUser(tenantId, id, updateAPISSOUserData, updateComments);
22

checkedCommentsForBlocked Internal Link

GET /check-blocked-comments

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_8421';
3const commentIds: string = 'cmt_9a1b,cmt_4f2d,cmt_7z8y';
4const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.signature';
5const resultWithSSO: CheckedCommentsForBlocked200Response = await checkedCommentsForBlocked(tenantId, commentIds, ssoToken);
6const resultWithoutSSO: CheckedCommentsForBlocked200Response = await checkedCommentsForBlocked(tenantId, commentIds);
7

createCommentPublic Internal Link

POST /comments/{tenantId}

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_acme_001";
3const urlId: string = "blog-post-2025-11-03";
4const broadcastId: string = "broadcast_live_20251103_01";
5const commentData: CommentData = {
6 date: Date.now(),
7 localDateString: new Date().toLocaleString(),
8 localDateHours: new Date().getHours(),
9 commenterName: "Jamie Parker",
10 commenterEmail: "jamie.parker@example.com",
11 comment: "Great article — the performance tips about caching were especially helpful.",
12 url: "https://www.acmeblog.com/performance/caching-best-practices",
13 urlId,
14 avatarSrc: "https://cdn.acme.com/avatars/jamie.png",
15 key: "client-frontend-xyz"
16};
17const sessionId: string = "sess_9f8e7d6c";
18const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9";
19const result: CreateCommentPublic200Response = await createCommentPublic(tenantId, urlId, broadcastId, commentData, sessionId, sso);
20

createFeedPostPublic Internal Link

POST /feed-posts/{tenantId}

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 = "tenant_82b1c9";
3const createParams: CreateFeedPostParams = {
4 title: "New product feature launch",
5 contentHTML: "<p>Inline editing is now available for comments — try it out!</p>",
6 media: [
7 { title: "Feature screenshot", linkUrl: "https://cdn.example.com/screens/feat.jpg", sizes: [{ w: 1200, h: 800, src: "https://cdn.example.com/screens/feat.jpg" }] }
8 ],
9 links: [{ text: "Read release notes", title: "Release Notes", description: "Details on the launch", url: "https://blog.example.com/releases/inline-edit" }],
10 fromUserId: "team_product_01",
11 fromUserDisplayName: "Product Team",
12 tags: ["product","launch"],
13 key: "prod-launch-2025-11-03",
14 meta: { env: "production", region: "us-east-1" }
15};
16const broadcastId: string = "broadcast_55a";
17const sso: string = "sso_token_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9";
18const result: CreateFeedPostPublic200Response = await createFeedPostPublic(tenantId, createParams, broadcastId, sso);
19

blockFromCommentPublic Internal Link

POST /block-from-comment/{commentId}

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 = 'acme-newsroom';
3const commentId: string = 'cmt-20251103-7af';
4const publicBlockFromCommentParams: PublicBlockFromCommentParams = { commentIds: ['cmt-20251102-1a', 'cmt-20251101-2b'] };
5const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.fakeSignature';
6const result: BlockFromCommentPublic200Response = await blockFromCommentPublic(tenantId, commentId, publicBlockFromCommentParams, sso);
7

deleteCommentPublic Internal Link

DELETE /comments/{tenantId}/{commentId}

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 = 'tenant-news-123';
3const commentId: string = 'cmt_8f3b2a1';
4const broadcastId: string = 'live_2025-11-03_987';
5const editKey: string | undefined = 'edit_7x9y4z';
6const sso: string | undefined = 'sso_jwt_token_eyJhbGci';
7const result: DeleteCommentPublic200Response = await deleteCommentPublic(tenantId, commentId, broadcastId, editKey, sso);
8

updateFeedPost Internal Link

PATCH /api/v1/feed-posts/{id}

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_47b2';
3const id: string = 'post_9f4a3';
4const feedPost: FeedPost = {
5 id,
6 tenantId,
7 title: 'Weekly release notes — v2.4.1',
8 fromUserId: 'user_22',
9 fromUserDisplayName: 'Alex Rivera',
10 fromUserAvatar: null,
11 tags: ['release', 'frontend'],
12 meta: {
13 createdAt: new Date('2025-10-28T10:15:00Z'),
14 contentHTML: '<p>Deployed performance fixes and accessibility improvements.</p>',
15 media: [{ title: 'Release screenshot', linkUrl: 'https://cdn.example.com/releases/v2.4.1.png', sizes: [{ w: 1200, h: 630, src: 'https://cdn.example.com/releases/v2.4.1-1200.png' }] }],
16 links: [{ text: 'Changelog', url: 'https://app.example.com/changelog/v2.4.1' }],
17 reacts: { like: 42, commentCount: 3 }
18 }
19};
20const result: FlagCommentPublic200Response = await updateFeedPost(tenantId, id, feedPost);
21

getCommentText Internal Link

GET /comments/{tenantId}/{commentId}/text

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
2const tenantId: string = 'tenant_acme_01';
3const commentId: string = 'comment_9a8b7c6d';
4const editKey: string | undefined = 'edit_3f2e1d';
5const sso: string | undefined = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
6const result: GetCommentText200Response = await getCommentText(tenantId, commentId, editKey, sso);
7

deleteFeedPostPublic Internal Link

DELETE /feed-posts/{tenantId}/{postId}

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
2(async () => {
3 const tenantId: string = 'tenant_acme_production';
4 const postId: string = 'post_6f3a9b';
5 const broadcastId: string = 'broadcast_2025-11-03';
6 const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.sampleToken';
7 const result: DeleteFeedPostPublic200Response = await deleteFeedPostPublic(tenantId, postId, broadcastId, sso);
8 console.log(result);
9})();
10

flagCommentPublic Internal Link

POST /flag-comment/{commentId}

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 = 'site-8472-prod';
3const commentId: string = 'cmt-9f3b21a4';
4const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.signature';
5
6const resultWithSSO: FlagCommentPublic200Response = await flagCommentPublic(tenantId, commentId, true, ssoToken);
7const resultWithoutSSO: FlagCommentPublic200Response = await flagCommentPublic(tenantId, 'cmt-9f3b21a4', false);
8

deleteCommentVote Internal Link

DELETE /comments/{tenantId}/{commentId}/vote/{voteId}

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_7c9a3f';
3const commentId: string = 'cmt_f8b3d9c2';
4const voteId: string = 'vote_v4a1b2c';
5const urlId: string = 'news-site/2025/10/31/article-42';
6const broadcastId: string = 'broadcast_20251031_001';
7const editKey: string = 'edk_9f8a7b'; // optional
8const sso: string = 'sso_token_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9'; // optional
9const result: DeleteCommentVote200Response = await deleteCommentVote(tenantId, commentId, voteId, urlId, broadcastId, editKey, sso);
10

getCommentVoteUserNames Internal Link

GET /comments/{tenantId}/{commentId}/votes

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
2const tenantId: string = 'news-site-123';
3const commentId: string = 'cmt_987654321';
4const dir: number = 1;
5const ssoToken: string = 'sso-token-abcdef123456';
6
7const resultWithSSO: GetCommentVoteUserNames200Response = await getCommentVoteUserNames(tenantId, commentId, dir, ssoToken);
8const resultWithoutSSO: GetCommentVoteUserNames200Response = await getCommentVoteUserNames(tenantId, commentId, dir);
9

getUserNotificationCount Internal Link

GET /user-notifications/get-count

Parameters

Name Type Required Description
tenantId string Yes
sso string No

Response

Returns: GetUserNotificationCount200Response

Example

getUserNotificationCount Example
Copy Copy
1
2const tenantId1: string = "fastcomments_prod_42";
3const response1: GetUserNotificationCount200Response = await getUserNotificationCount(tenantId1);
4
5const tenantId2: string = "fastcomments_stage_07";
6const ssoToken: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.signature";
7const response2: GetUserNotificationCount200Response = await getUserNotificationCount(tenantId2, ssoToken);
8

getFeedPostsPublic Internal Link

GET /feed-posts/{tenantId}

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 = 'tenant_12345';
3const afterId: string = 'post_98765';
4const limit: number = 25;
5const tags: string[] = ['news', 'sports'];
6const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ssoPayload.signature';
7const isCrawler: boolean = false;
8const includeUserInfo: boolean = true;
9
10const response: GetFeedPostsPublic200Response = await getFeedPostsPublic(
11 tenantId,
12 afterId,
13 limit,
14 tags,
15 sso,
16 isCrawler,
17 includeUserInfo
18);
19

getEventLog Internal Link

GET /event-log/{tenantId}

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 = 'fastcomments_tenant_12';
3const urlId: string = 'article_2025-11-03-42';
4const userIdWS: string = 'ws_user_7382';
5const startTime: number = Date.now() - 1000 * 60 * 60; // 1 hour ago
6const endTime: number = Date.now();
7const response: GetEventLog200Response = await getEventLog(tenantId, urlId, userIdWS, startTime, endTime);
8const firstEventId: string | undefined = response.events[0]?.id;
9const bannedUntil: number | undefined = response.bannedUntil;
10

getFeedPostsStats Internal Link

GET /feed-posts/{tenantId}/stats

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-newsroom';
3const postIds: Array<string> = ['f3b2e9c4-8a1d-4c6e-b2f0-9d2a7e5c1234', 'e1a2b3c4-5d6f-7a8b-9c0d-1e2f3a4b5c6d'];
4const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI0MjMifQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
5const result: GetFeedPostsStats200Response = await getFeedPostsStats(tenantId, postIds, sso);
6

getGlobalEventLog Internal Link

GET /event-log/global/{tenantId}

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_acme_001';
3const urlId: string = 'content/article-4321';
4const userIdWS: string = 'ws_user_8421';
5const startTime: number = Math.floor(Date.now() - 1000 * 60 * 60 * 24); // 24 hours ago
6const endTime: number = Math.floor(Date.now());
7const result: GetEventLog200Response = await getGlobalEventLog(tenantId, urlId, userIdWS, startTime, endTime);
8const recentEventCount: number = result.events.length;
9const maxCommentLen: number | null | undefined = result.customConfig?.maxCommentCharacterLength;
10

getUserReactsPublic Internal Link

GET /feed-posts/{tenantId}/user-reacts

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 = 'tenant_82f4d3';
3const postIds: Array<string> = ['post_9f1c', 'post_7b2a'];
4const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.sso_user_98765.signature';
5const result: GetUserReactsPublic200Response = await getUserReactsPublic(tenantId, postIds, sso);
6

getUserPresenceStatuses Internal Link

GET /user-presence-status

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 = 'tenant_9f3b2a';
3const urlIdWS: string = 'wss://ws.fastcomments.com/room/9f3b2a';
4const userIds: string = 'u_1023,u_2045,u_3098';
5const presence: GetUserPresenceStatuses200Response = await getUserPresenceStatuses(tenantId, urlIdWS, userIds);
6const isUser1023Online: boolean | undefined = presence.userIdsOnline?.['u_1023'];
7const user1023Reason: string | undefined = presence.userIdsOnline?.reason;
8const user1023SecondaryCode: string | undefined = presence.userIdsOnline?.secondaryCode;
9

lockComment Internal Link

POST /comments/{tenantId}/{commentId}/lock

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
2(async () => {
3 const tenantId: string = 'tenant_9f3a2b7c';
4 const commentId: string = 'cmt_4b8e91a2';
5 const broadcastId: string = 'broadcast_live_2025-11-03';
6 const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.fake_payload.signature';
7 const response: LockComment200Response = await lockComment(tenantId, commentId, broadcastId, sso);
8 console.log(response.status, response.reason);
9})();
10

getUserNotifications Internal Link

GET /user-notifications

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
2const notifications: GetUserNotifications200Response = await getUserNotifications(
3 'tenant_7f3b2a9',
4 20,
5 'notification_98a7b3',
6 true,
7 Date.now() - 7 * 24 * 60 * 60 * 1000,
8 true,
9 false,
10 false,
11 true,
12 'sso_jwt_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9'
13);
14

getCommentsPublic Internal Link

GET /comments/{tenantId}

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_8f4b2",
4 "https://news.example.com/articles/2025/important-update",
5 1,
6 "MR",
7 undefined,
8 0,
9 0,
10 25,
11 5,
12 true,
13 undefined,
14 true,
15 false,
16 true,
17 "en-US",
18 "reactions,analytics",
19 false,
20 true,
21 true,
22 3,
23 false,
24 undefined,
25 "climate change",
26 ["breaking", "featured"],
27 "user_9876",
28 '{"theme":"compact"}',
29 "cmt_12345",
30 undefined
31);
32

reactFeedPostPublic Internal Link

POST /feed-posts/{tenantId}/react/{postId}

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 = 'acme-tenant-123';
3const postId: string = 'post_78945';
4const reactBodyParams: ReactBodyParams = { reactType: 'like' };
5const isUndo: boolean = false;
6const broadcastId: string = 'broadcast-2025-11-03-01';
7const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.exampleSignature';
8const result: ReactFeedPostPublic200Response = await reactFeedPostPublic(tenantId, postId, reactBodyParams, isUndo, broadcastId, sso);
9

searchUsers Internal Link

GET /user-search/{tenantId}

Parameters

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

Response

Returns: SearchUsers200Response

Example

searchUsers Example
Copy Copy
1
2const tenantId: string = 'tenant_live_981';
3const urlId: string = 'news/2025/11/03/how-to-write-typescript';
4const usernameStartsWith: string = 'jo';
5const mentionGroupIds: string[] = ['editors', 'moderators'];
6const sso: string = 'sso-token-2f9b7c3a';
7const response: SearchUsers200Response = await searchUsers(tenantId, urlId, usernameStartsWith, mentionGroupIds, sso);
8

pinComment Internal Link

POST /comments/{tenantId}/{commentId}/pin

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
2const tenantId: string = 'tenant_live_84f1';
3const commentId: string = 'cmt-9a3b2';
4const broadcastId: string = 'broadcast_2025-11-03_stream1';
5const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.sso_payload.signature';
6
7const pinnedResult: PinComment200Response = await pinComment(tenantId, commentId, broadcastId, sso);
8

resetUserNotifications Internal Link

POST /user-notifications/reset

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_48a3f2';
3const afterId: string = 'notif_20251103_001';
4const afterCreatedAt: number = Date.now() - 86_400_000; // 24 hours ago
5const unreadOnly: boolean = true;
6const dmOnly: boolean = false;
7const noDm: boolean = false;
8const sso: string = 'sso-john.doe@company.com';
9
10const result: ResetUserNotifications200Response = await resetUserNotifications(
11 tenantId,
12 afterId,
13 afterCreatedAt,
14 unreadOnly,
15 dmOnly,
16 noDm,
17 sso
18);
19

setCommentText Internal Link

POST /comments/{tenantId}/{commentId}/update-text

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_7b2f9c';
3const commentId: string = 'cmt_4921a';
4const broadcastId: string = 'brd_sports_20251103';
5const commentTextUpdateRequest: CommentTextUpdateRequest = {
6 comment: 'Great point, @jane_doe — agreed with the analysis. #sports',
7 mentions: [{ id: 'user_102', tag: '@jane_doe', rawTag: '@jane_doe', sent: true }],
8 hashTags: [{ id: 'ht_7', tag: '#sports', url: 'https://example.com/tags/sports', retain: true }]
9};
10const editKey: string = 'edit_9f8d7c';
11const sso: string = 'sso_tok_abc123';
12const result: SetCommentText200Response = await setCommentText(tenantId, commentId, broadcastId, commentTextUpdateRequest, editKey, sso);
13

unBlockCommentPublic Internal Link

DELETE /block-from-comment/{commentId}

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
2const tenantId: string = 'tenant_84b2f1';
3const commentId: string = 'cmt_9f3a21';
4const publicBlockFromCommentParams: PublicBlockFromCommentParams = { commentIds: ['cmt_9f3a22', 'cmt_9f3a23'] };
5const sso: string = 'sso_txn_7a8b9c';
6const result: UnBlockCommentPublic200Response = await unBlockCommentPublic(tenantId, commentId, publicBlockFromCommentParams, sso);
7

unPinComment Internal Link

POST /comments/{tenantId}/{commentId}/unpin

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 = 'tenant_93f4b1';
3const commentId: string = 'cmt_8a9f2d';
4const broadcastId: string = 'broadcast_newsroom_20251103';
5const ssoToken: string = 'sso_x9YzK6mN2b';
6const result: PinComment200Response = await unPinComment(tenantId, commentId, broadcastId, ssoToken);
7

unLockComment Internal Link

POST /comments/{tenantId}/{commentId}/unlock

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 = 'tenant_83d4a2';
3const commentId: string = 'cmt-5f9a1b3';
4const broadcastId: string = 'broadcast-nyc-20251103';
5const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.SSO_PAYLOAD.SIGN';
6
7const resultWithSSO: LockComment200Response = await unLockComment(tenantId, commentId, broadcastId, ssoToken);
8const resultNoSSO: LockComment200Response = await unLockComment(tenantId, commentId, broadcastId);
9

updateUserNotificationCommentSubscriptionStatus Internal Link

POST /user-notifications/{notificationId}/mark-opted/{optedInOrOut}

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_4f2b9a';
3const notificationId: string = 'notif_20251103_1';
4const commentId: string = 'cmt_8a7f2c';
5const optedInOrOut: UpdateUserNotificationCommentSubscriptionStatusOptedInOrOutEnum = UpdateUserNotificationCommentSubscriptionStatusOptedInOrOutEnum.OPTED_IN;
6const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.exampleSignature';
7const result: UpdateUserNotificationStatus200Response = await updateUserNotificationCommentSubscriptionStatus(tenantId, notificationId, optedInOrOut, commentId, sso);
8

updateUserNotificationStatus Internal Link

POST /user-notifications/{notificationId}/mark/{newStatus}

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_7f3a2b9e';
3const notificationId: string = 'notif_a3f4c1b7';
4const newStatus: UpdateUserNotificationStatusNewStatusEnum = 'read' as UpdateUserNotificationStatusNewStatusEnum;
5const sso: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.example.payload';
6const response: UpdateUserNotificationStatus200Response = await updateUserNotificationStatus(tenantId, notificationId, newStatus, sso);
7

resetUserNotificationCount Internal Link

POST /user-notifications/reset-count

Parameters

Name Type Required Description
tenantId string Yes
sso string No

Response

Returns: ResetUserNotifications200Response

Example

resetUserNotificationCount Example
Copy Copy
1
2const tenantId: string = 'acme-tenant-9f2b';
3const ssoToken: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1Njc4OSIsImlhdCI6MTY4MDAwMDB9.signature';
4const responseWithSSO: ResetUserNotifications200Response = await resetUserNotificationCount(tenantId, ssoToken);
5const responseWithoutSSO: ResetUserNotifications200Response = await resetUserNotificationCount(tenantId);
6

updateFeedPostPublic Internal Link

PUT /feed-posts/{tenantId}/{postId}

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_42f9b3";
3const postId: string = "post_987cba";
4const mediaItem: FeedPostMediaItem = {
5 title: "Event photo",
6 linkUrl: "https://cdn.example.com/events/2025/photo.jpg",
7 sizes: [{ w: 1200, h: 800, src: "https://cdn.example.com/events/2025/photo.jpg" }]
8};
9const link: FeedPostLink = { text: "Full story", title: "Read more", url: "https://blog.example.com/event/2025" };
10const updateFeedPostParams: UpdateFeedPostParams = {
11 title: "Community Meetup Recap",
12 contentHTML: "<p>Thanks to everyone who joined our meetup. Highlights and photos below.</p>",
13 media: [mediaItem],
14 links: [link],
15 tags: ["community", "meetup", "2025"],
16 meta: { source: "newsletter", publishedBy: "community_team" }
17};
18const broadcastId: string = "broadcast_20251103";
19const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...";
20
21const result: CreateFeedPostPublic200Response = await updateFeedPostPublic(tenantId, postId, updateFeedPostParams, broadcastId, sso);
22

updateUserNotificationPageSubscriptionStatus Internal Link

POST /user-notifications/set-subscription-state/{subscribedOrUnsubscribed}

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_8291";
3const urlId: string = "article-759-election-2025-turnout";
4const url: string = "https://www.dailyexample.com/politics/election-2025-turnout";
5const pageTitle: string = "Election 2025: Voter Turnout Trends";
6const subscribedOrUnsubscribed: UpdateUserNotificationPageSubscriptionStatusSubscribedOrUnsubscribedEnum =
7 "subscribed" as unknown as UpdateUserNotificationPageSubscriptionStatusSubscribedOrUnsubscribedEnum;
8const sso: string = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.exampleSignature";
9const result: UpdateUserNotificationStatus200Response = await updateUserNotificationPageSubscriptionStatus(
10 tenantId,
11 urlId,
12 url,
13 pageTitle,
14 subscribedOrUnsubscribed,
15 sso
16);
17

uploadImage Internal Link

POST /upload-image/{tenantId}

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
2enum SizePreset { Default = 'Default', CrossPlatform = 'CrossPlatform' }
3enum APIStatus { success = 'success', failed = 'failed' }
4type MediaAsset = { w: number; h: number; src: string };
5type UploadImageResponse = { status: APIStatus; url?: string; media?: MediaAsset[]; reason?: string; code?: string };
6
7const tenantId: string = 'tenant_9a7b4c';
8const file: Blob = new Blob([new Uint8Array([255,216,255,224])], { type: 'image/jpeg' });
9const sizePreset: SizePreset = SizePreset.CrossPlatform;
10const urlId: string = 'post-2025-11-03';
11
12const result: UploadImageResponse = await uploadImage(tenantId, file, sizePreset, urlId);
13

voteComment Internal Link

POST /comments/{tenantId}/{commentId}/vote

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_42';
3const commentId: string = 'cmt_987654321';
4const urlId: string = 'news/article-2025-11-03';
5const broadcastId: string = 'broadcast_01';
6const voteBodyParams: VoteBodyParams = {
7 commenterEmail: 'reader@example.com',
8 commenterName: 'Jordan Blake',
9 voteDir: 'up' as unknown as VoteBodyParamsVoteDirEnum,
10 url: 'https://news.example.com/article/2025/11/03'
11};
12const sessionId: string = 'sess_4f3a2b';
13const sso: string = 'sso_jwt_eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
14const result: VoteComment200Response = await voteComment(tenantId, commentId, urlId, broadcastId, voteBodyParams, sessionId, sso);
15

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.