Skip to content

Comments ​

Contentrain Studio lets visitors comment on the entries of your collection and document models. Visitors post through a public API, and your team moderates the comments in Studio before (or after) they appear on your site.

Comments live in Studio, not in Git

Only the comment configuration is stored in the model definition in your repository. The comments themselves are stored in Studio's database, so approving or rejecting a comment never creates a commit or a review branch.

Availability

Comments and moderation need the comments.enabled plan feature. Related features are gated separately:

  • Publish without approval — comments.auto_approve
  • CAPTCHA — comments.captcha
  • WordPress import — comments.import
  • Webhook notifications — comments.webhook_notification (Enterprise Edition)
  • Spam filter — comments.spam_filter (Enterprise Edition, on the roadmap, not yet available)

The number of comment-enabled models and new comments per month are plan limits; see Billing for your plan.

How Comments Work ​

Visitor → Submit API → Moderation queue → Approve → Shown on your site
  1. You enable comments on a model and choose the moderation rules
  2. Your site reads and submits comments through the public endpoint
  3. New comments land as pending (or approved if approval is off)
  4. Your team approves, rejects, marks as spam, or replies
  5. Only approved comments are returned to the public

Enabling Comments on a Model ​

Comments can be enabled on collection and document models. Singletons and dictionaries do not carry threads.

  1. Open the model in the content panel
  2. Open the Comments Settings tab
  3. Turn on Comments Enabled
  4. Adjust the settings below and click Save

Once enabled, the tab shows the public endpoint for the model, and a Comments tab appears next to it for moderation.

The settings are saved in the model's comments block:

Setting (UI label)KeyDefaultNotes
Comments EnabledenabledfalseAccept public comments on entries of this model
Require ApprovalrequireApprovaltrueNew comments stay hidden until a moderator approves them. Turning this off needs comments.auto_approve; without it comments still start as pending
Require EmailrequireEmailtrueCommenters must leave an email address. It is never shown publicly
Max Reply DepthmaxDepth4How deep replies can nest (0 to 10; 0 = no replies). Imported threads keep their original depth
Max Comment LengthmaxBodyLength5000100 to 20000 characters
Honeypot FieldhoneypottrueA hidden field _hp that catches spam bots
CAPTCHA Protectioncaptchanoneturnstile (Cloudflare Turnstile) or none. Needs comments.captcha
Rate Limit (per IP/min)rateLimitPerIp51 to 60 comments per IP address per minute on one entry
Email NotificationsnotificationstrueEmail the workspace owner and admins when a comment arrives

Only workspace owners and admins can change these settings.

Moderating Comments ​

Open the model's Comments tab. The filter bar shows the number of comments per status: Pending, Approved, Spam, Rejected, or All.

ActionWhat it does
ApproveShows the comment on your site
SpamHides the comment and keeps it in the moderation log
RejectHides the comment and keeps it in the moderation log
RestoreMoves a rejected or spam comment back to pending
DeleteRemoves the comment and all of its replies permanently
ReplyPublishes a reply from you as a moderator, immediately. Replying to a pending comment approves it first
Close comments on this entryBlocks new comments on that entry; existing approved comments keep showing. Reopen comments reverses it

Click a comment to open its details (author, email, website, source IP, the comment it replies to, and when it was moderated).

For many comments at once, select them with the checkboxes (or Select all) and use Approve, Spam, Reject, or Delete in the bulk bar. A bulk action covers up to 50 comments.

In the Comments tab, moderators are workspace owners and admins; other members with access to the project can view the queue but not change it. Through the AI chat, a project reviewer can also approve, reject, and reply (see Agent Tools).

Public API ​

Your site reads and submits comments through one public endpoint per entry. No authentication is needed.

GET  /api/comments/v1/{projectId}/{modelId}/{entryId}
POST /api/comments/v1/{projectId}/{modelId}/{entryId}
  • GET returns only approved comments, as threads, plus the model's public settings. It never returns emails, IP addresses, user agents, or referrers. It supports locale, page, limit (up to 100), and sort (oldest or newest) query parameters.
  • POST takes author (name, optional email and url), body, an optional parentId for a reply, and optional captchaToken and _hp fields. A successful response includes the comment's status.

For request and response details, see the Comments API reference.

Spam Protection ​

Studio applies several layers to public submissions:

  • Honeypot — a request that fills the hidden _hp field is silently accepted but dropped, so bots learn nothing
  • CAPTCHA — Cloudflare Turnstile, when enabled on the model
  • Rate limit — per IP address and entry
  • Validation — name, email, website, and length checks; HTML is sanitized
  • Approval — with Require Approval on, nothing is shown until you approve it

Importing WordPress Comments ​

If you migrated a WordPress site with the Contentrain WordPress import, the import writes a comments-export.json file (format contentrain-comments@1) next to your content.

  1. Make sure comments are enabled on the model that holds the posts
  2. Open the model's Comments Settings tab
  3. Under Import from WordPress, click Upload comments-export.json

Studio reports how many comments were received, imported, and already present, and how many threads were closed. Uploading the same file again is safe: comments already imported are skipped. Comments that belong to posts with no matching entry are reported and not imported, and a note appears if some comments still reference a parent that is not in the project. Import needs the comments.import feature and owner or admin access.

If your site was migrated by Contentrain Migrate, the project's setup wizard offers the same import as a step. See Migrated Sites.

Notifications and Webhooks ​

  • Email — when Email Notifications is on, the workspace owner and admins get an email for each new comment
  • Webhooks — two webhook events cover comments, available with comments.webhook_notification:
EventFires When
comment.submittedA visitor submits a comment or reply (payload: commentId, modelId, entryId, locale, parentId, status)
comment.approvedA comment is approved in Studio or through the agent (payload: commentId, modelId, entryId, locale, source)

Agent Tools ​

The AI chat agent can work through the queue for you:

ToolWhat it doesRoles
list_commentsLists comments by status, optionally for one model or entryviewer and above
approve_commentApproves a commentreviewer, admin, owner
reject_commentRejects a comment or marks it as spamreviewer, admin, owner
reply_commentPosts a public reply as the current user; approves a pending comment firstreviewer, admin, owner

None of these write to Git.

Released under the AGPL-3.0 License.