Content Check

Use this endpoint to get data about a piece of content. By default, it returns a spam score. You can configure it to return more data points including the language and sentiments.

Full URL: https://fortguard.io/api/v0/check/content (POST)

Request

{
    "model": "gpt-4o-mini",
    "context": "10 Healthy Habits to Boost Your Productivity",
    "content": "Click the link in my profile!",
    "language_detection": false,
    "sentiment_analysis": false,
    "sentiments": ['positive', 'negative', 'neutral'],
}
Field
Type
Default
Description
content
string
context
string
model
string
gpt-4o-mini
See Model
language_detection
boolean
false
sentiment_analysis
boolean
false
sentiments
string[]
['positive', 'negative', 'neutral']

Content

The content field is the content to check. It can be a comment, email, or any other text. Content can be in plain text, Markdown, or HTML. However, we highly recommend sending the content in Markdown format to include links as well as to reduce length.

Context

On a blog post about Gardening, a comment like "Have you heard about these amazing weight loss pills I found online?" is likely to be spam. But on a blog post about weight loss, it is likely to be a genuine comment. So, the context of the content is critical for accurate spam detection.

Set the context field is the context of the given content. For example, if the content is a comment, the context can be the title of the article. Setting a context is strongly recommended to get human-like spam detection accuracy.

Maximum length of the context is 255 characters (the excess characters will be truncated).

Model

The content check API uses OpenAI language models for spam detection, language detection, and sentiment analysis. You can set the model field to one of the following:

  • gpt-4o-mini (default)
  • gpt-4o
  • gpt-4-turbo
  • claude-3-haiku
  • claude-3.5-sonnet
  • claude-3-opus

API credits consumption depends on the model and the used GPT tokens.

Model
API Credits per 100 tokens
gpt-4o-mini
1
gpt-4o
17
gpt-4-turbo
50
claude-3-haiku
2
claude-3.5-sonnet
25
claude-3-opus
125

Response

{
    "spam_score": 5,
    "language_code": null,
    "sentiments": [],
}

Spam Score

In the response, you will get a spam_score field. The value of the spam_score field will be an integer between 0 and 5. The higher the number, the more likely the content is spam. If the spam_score is 0, the content is not spam. Generally, you may consider a content as spam if the spam_score is 4 or 5. However, you can set your own threshold based on your use case.

Language Detection

In some cases, you may need to restrict the content to a specific language. Instead of having to call a separate language detection API, you can easily set the language_detection field to true to get the language code of the content. The language code will be a two-letter code (ISO 639-1). For example, en for English, fr for French, de for German, etc.

Sentiment Analysis

In some cases, you may need to filter out content based on sentiment. You can set the sentiment_analysis field to true to get the sentiment of the content. By default, the following sentiments will be returned:

  • positive
  • negative
  • neutral

You can customize the sentiments to return by setting the sentiments field. For example, if you want to get offensive and violent content, set the sentiments field to ['offensive', 'violent']. Then, if the content is offensive or violent, the API will return the corresponding sentiment.

The output of the sentiment analysis will be an array of sentiments that match the given sentiments. If no sentiments matched, the output will be an empty array.

"sentiments": ["offensive"], // offensive
"sentiments": ["offensive", "violent"], // offensive AND violent
"sentiments": [], // nothing matched
ℹ️
Enabling language detection and sentiment analysis will increase the token usage, and therefore, the API credits consumption.