To get a text moderation by its ID, use the text.get function:

index.ts
import { ContentMod } from "@contentmod/sdk";

const contentMod = new ContentMod({
  publicKey: "<YOUR_PUBLIC_KEY>",
  secretKey: "<YOUR_SECRET_KEY>",
});

const moderationId = "<MODERATION_ID>";

const textMod = await contentMod.text.get(moderationId);

console.log(textMod);

Please refer to the Get Text Api Response for more information on the TextModerationResponse object.

Properties

text
string
required

Text to moderate

Example: Some bad text

options
object

An object of options for the moderation request

Response

The TextModerationResponse object contains the following properties:

id
string
required

The ID of the moderation request.

Example: 27fbdc0b-b295-46ce-93f5-81b2fc08a381

isSafe
boolean
required

Whether the text is considered safe.

Example: true

confidence
number
required

Confidence of the safety of the text from 1-100.

Example: 90

sentiment
string
required

Sentiment of the text, either negative, neutral or positive.

available sentiment values are:

  • negative
  • neutral (default)
  • positive

Example: positive

sentimentScore
number
required

Sentiment score from 1-100 (negative, neutral, positive).

Example: 90

riskScores
object
required

Overall risk score from 1-100.

Example: 90

topics
array
required

General topics the text depicts, lowercase and no punctuation.

Example: ["politics", "sports"]

nsfwCategories
array
required

An array of the categories of the text. The available categories are:

  • adult_content
  • suggestive_imagery
  • strong_language
  • violence_gore
  • horror_disturbing
  • alcohol
  • tobacco
  • substance_use
  • gambling
  • dating_relationship
  • medical_procedures”
  • crude_humor
  • political_content

Example: [{"category": "sexual", "severity": 90}]

summary
object
required

Summary of the text.

Example: {"profanity": true, "totalFlags": 1, "contentRating": "G", "language": "en"}

suggestedActions
object
required

Suggested actions for the text.

Example: {"reject": true, "review": true}

content
string
required

The original text.

Example: This is the original text

filteredContent
string
required

The text with profanity replaced by *.

Example: This is a filtered text

request
object
required

The request object.

Example: {"requestId": "27fbdc0b-b295-46ce-93f5-81b2fc08a381", "timestamp": "2023-04-05T12:00:00.000Z"}

meta
object
required

The metadata of the request object that the user provided.

Example: {"userId": "12345"}

hash
string
required

The SHA-256 hash of the text. Used for content comparison purposes. Example: 93a08bd10cd367bf83f12ba6590fcaef2f8deec8a47ce4ce88a15c7dda325ffa