API Documentation

Everything you need to integrate moder8r into your application

Perspective API - Suggest Score

Submit feedback on attribute scores to help improve moderation accuracy. Compatible with Google's Perspective API suggestscore endpoint.

No quota consumed. Suggest score requests do not count against your monthly usage quota or rate limits. This matches Google's Perspective API behavior.

POST
/v1alpha1/comments:suggestscore

Suggest Score

Provide feedback on what the correct attribute scores should be for a given comment. This data is stored for model improvement and does not consume API quota.

Parameters

NameTypeRequiredDescription
commentobject
Required
Object with a "text" field (required) containing the original comment text.
Example: { "text": "The comment that was scored" }
attributeScoresobject
Required
Map of attribute names to suggested score objects. Each should contain a summaryScore with a value (0.0 to 1.0) and type.
Example: { "TOXICITY": { "summaryScore": { "value": 0.9, "type": "PROBABILITY" } } }
clientTokenstring
Optional
An opaque token echoed back in the response. Useful for tracking feedback submissions.
Example: "feedback-123"
communityIdstring
Optional
Identifier for the community providing the feedback.
Example: "my-forum"
contextobject
Optional
Additional context for the feedback, such as surrounding conversation entries.
Example: { "entries": [{ "text": "Previous message" }] }

Base URLs

MethodURL
Subdomainhttps://perspective.moder8r.app/v1alpha1/comments:suggestscore
Path-basedhttps://moder8r.app/api/perspective/v1alpha1/comments:suggestscore

Authentication

Same methods as the Analyze endpoint: ?key=m8r_sk_... query parameter or Authorization: Bearer m8r_sk_... header.

Request

cURL Request
curl -X POST 'https://perspective.moder8r.app/v1alpha1/comments:suggestscore?key=m8r_sk_your_key_here' \
  -H "Content-Type: application/json" \
  -d '{
    "comment": { "text": "This comment is obviously toxic." },
    "attributeScores": {
      "TOXICITY": {
        "summaryScore": { "value": 0.9, "type": "PROBABILITY" }
      }
    },
    "clientToken": "feedback-123"
  }'

Response

Success Response
{
  "clientToken": "feedback-123"
}

Response Fields

clientToken

Echoed from the request if provided. If no clientToken was sent, the response is an empty object {}.

Code Examples

JavaScript / Node.js

// JavaScript / Node.js
const response = await fetch(
  'https://perspective.moder8r.app/v1alpha1/comments:suggestscore',
  {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer m8r_sk_your_key_here',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      comment: { text: 'This is clearly spam and should be removed.' },
      attributeScores: {
        TOXICITY: { summaryScore: { value: 0.2, type: 'PROBABILITY' } },
        SPAM: { summaryScore: { value: 0.95, type: 'PROBABILITY' } },
      },
      clientToken: 'feedback-456',
    }),
  }
);

const data = await response.json();
// { "clientToken": "feedback-456" }

When to Use Suggest Score

Use this endpoint when you have ground-truth labels for comments — for example, when a human moderator has reviewed and scored content. This feedback helps improve scoring accuracy over time.

Common use cases:

  • A moderator overrides an automated decision (false positive or false negative)
  • User-reported content that was reviewed by a human
  • Batch corrections after reviewing moderation logs