GitHub

API Reference

Diskus exposes a robust, RESTful API. While the official Widget and Dashboard handle API interactions automatically, you can use these endpoints to build custom, headless comment integrations for your own frontend applications.

All endpoints are prefixed with /api/v1.

Authentication Flow

Authentication is required for most administrative and authenticated commenter actions.

MethodEndpointAuthRate LimitDescription
GET/auth/setup-statusNoneNoneReturns {setupRequired: boolean} indicating if an admin account needs to be created.
POST/auth/registerNone5 / hrRegister the first dashboard admin. (Subsequent registrations blocked unless ALLOW_REGISTRATION=true).
POST/auth/loginNone10 / 15mLogin to the dashboard. Returns a JWT token.

Public Widget Endpoints

These endpoints power the public-facing comment widget.

Initialization & Embed Tokens

To prevent unauthorized domains from spamming your API, Diskus requires an Embed Token for widget operations.

MethodEndpointAuthDescription
GET/widget/embed-token?api_key={appId}NoneIssues a short-lived Embed Token. The backend strictly verifies the Origin and Referer headers against the registered domain for the provided api_key.

Note: All subsequent /widget/* requests must include this token via the X-Diskus-Embed-Token header or embed_token query parameter.

Comments

MethodEndpointAuthRate LimitDescription
GET/widget/comments?threadKey={key}Embed TokenNoneFetch paginated comments for a thread. Automatically creates the thread if it does not exist.
POST/widget/commentsEmbed Token30 / minPost a new comment. Automatically catches bot spam via the _diskus_trap honeypot field.
POST/widget/auth/registerEmbed Token5 / hrRegister a new authenticated commenter.
POST/widget/auth/loginEmbed Token10 / 15mLogin for authenticated commenters.
POST/widget/comments/:id/likeJWT30 / minLike a comment. Requires user authentication.
POST/widget/comments/:id/unlikeJWT30 / minRemove a like from a comment.
DELETE/widget/comments/:idJWTNoneSoft-delete a user’s own comment.

Admin Dashboard Endpoints

These endpoints are strictly for site administrators and require a valid Bearer JWT token in the Authorization header.

Sites & Domains

MethodEndpointDescription
GET/admin/sitesGet all websites registered to the authenticated admin.
POST/admin/sitesRegister a new website (generates a publicApiKey).
PATCH/admin/sites/:idUpdate site configuration (requireLogin, enableEmail, etc.).
DELETE/admin/sites/:idDelete a website and all associated comments.

Moderation

MethodEndpointDescription
GET/admin/analytics/summaryGet counts for all queues (Pending, Approved, Spam, Trash).
GET/admin/commentsFetch all comments across all threads for moderation.
PATCH/admin/comments/bulkBulk update comment statuses (e.g., approve multiple comments).
DELETE/admin/comments/bulkBulk hard-delete comments from the database.
PATCH/admin/comments/:id/pinToggle the pinned status of a specific comment.

Data Management

MethodEndpointDescription
GET/admin/export/:siteIdExport all threads and comments as a highly portable JSON file.
POST/admin/import/:siteIdImport threads and comments from a JSON file. Includes automatic deduplication and HTML re-sanitization.

Users

MethodEndpointDescription
GET/admin/usersList all commenter accounts registered via the widget.
DELETE/admin/users/:idDelete a commenter account.
GET/admin/accountGet current admin account details.
PUT/admin/accountUpdate admin account details (including Resend API key).