Skip to main content
Want to skip the docs? Use the MCP Server
Endpoint availability: Free and aboveLearn more
{
  "data": {
    "isML": true,
    "text": "This is just a normal text",
    "totalBadWords": null,
    "riskScore": 0,
    "isSafe": true,
    "status": "success",
    "executionTime": 120
  }
}
{
  "status": "error",
  "code": 101,
  "type": "invalid_key",
  "description": "The API Key is missing or invalid."
}
GET
/
scoring
/
profanity
Profanity Detection
curl --request GET \
  --url https://greipapi.com/scoring/profanity \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://greipapi.com/scoring/profanity"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://greipapi.com/scoring/profanity', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://greipapi.com/scoring/profanity",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://greipapi.com/scoring/profanity"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://greipapi.com/scoring/profanity")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://greipapi.com/scoring/profanity")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "data": {
    "isML": true,
    "text": "This is just a normal text",
    "totalBadWords": null,
    "riskScore": 0,
    "isSafe": true,
    "status": "success",
    "executionTime": 120
  }
}
{
  "status": "error",
  "code": 101,
  "type": "invalid_key",
  "description": "The API Key is missing or invalid."
}

Query Parameters

text
string
required
The text you want to filterSample value: This is a sample text without profanity!
scoreOnly
string
default:"no"
Returns only the score of the text and whether it’s safe or not.Expected values: yes, or no.
listBadWords
string
default:"no"
Used to list the bad words in an array.Expected values: yes, or no.
format
string
default:"JSON"
The format command is used to get a response in a specific format.Expected values: JSON, XML, or CSVFor more information please refer to Response Format.
mode
string
default:"live"
The mode command is used to in the development stage to simulate the integration process before releasing it to the production environment.Expected values: live, or test.For more information please refer to Development Environment.
callback
string
The callback command can help you make the response as a JSONP format.Expected values: any name that can be used as a function name in Javascript, e.g: myFunctionName.For more information please refer to JSONP Callback.

Response properties

data
object
required
status
string
required
The response status.Expected values: success, or error.
executionTime
integer
required
Time spent in milliseconds to process the data.
This method returns a score for the text you pass.We classify profanity into 4 different level. The first level contains the most risky words and phrases (risky). The second level contains the medium-risk words and phrases. Whereas, the third level contains the low-risk words.When you use the API, the response will the determine the score of the text you passed as follows:
  • riskScore = 0 means that this text is completely safe.
  • riskScode = 1 means that this is a high-risk text.
  • riskScode = 2 means that this is a medium-risk text.
  • riskScode = 3 means that this is a low-risk text.