Documentation

POST
https://api.moderatehatespeech.com/api/v1/toxic/
Retrieve Toxicity Score
Retrieves a predicted class and confidence score given a string of text.
Request Fields
Headers
Content-Type:
application/json
All body values should be passed as key-value, JSON-encoded data.
Body
token
(string)
Ex: 912ec823b2c449eba5410a8d495ab570
API Key
text
(string)
Ex: Lorem, ipsum doris
Text to avaluate
Response Fields
Headers
Content-Type:
application/json
Returned data is in JSON format
Body
response
(string)
Ex: Success
"Success" or error message if request failed.
class
(string)
Ex: flag
"flag" if comment flagged as toxic, otherwise "normal"
confidence
(float)
Ex: 0.993
Confidence score of the predict class, from 0.5 to 1.
Example
Request
curl --url https://api.moderatehatespeech.com/api/v1/toxic/ \
--request POST \
--data '{"token":"912ec823b2c449eba5410a8d495ab570","text":"Lorem Ipsum Doris"}' \
–h "Content-Type: application/json"
Response
{
"response":"Success",
"class":"flag",
"confidence":"0.993"
}
POST
https://api.moderatehatespeech.com/api/v1/moderate/
Retrieve Toxicity Moderation Score
Retrieves a predicted class and confidence score given a string of text.
Request Fields
Headers
Content-Type:
application/json
All body values should be passed as key-value, JSON-encoded data.
Body
token
(string)
Ex: 912ec823b2c449eba5410a8d495ab570
API Key
text
(string)
Ex: Lorem, ipsum doris
Text to avaluate
Response Fields
Headers
Content-Type:
application/json
Returned data is in JSON format
Body
response
(string)
Ex: Success
"Success" or error message if request failed.
class
(string)
Ex: flag
"flag" if comment flagged as toxic, otherwise "normal"
confidence
(float)
Ex: 0.993
Confidence score of the predict class, from 0.5 to 1.
Example
Request
curl --url https://api.moderatehatespeech.com/api/v1/moderate/ \
--request POST \
--data '{"token":"912ec823b2c449eba5410a8d495ab570","text":"Lorem Ipsum Doris"}' \
–h "Content-Type: application/json"
Response
{
"response":"Success",
"class":"flag",
"confidence":"0.993"
}