{
"success": true,
"data": {
"risk_level": "low",
"recommendation": "accept"
},
"execution_ms": 120
}
{
"success": false,
"code": 101,
"type": "invalid_key",
"description": "The API Key is missing or invalid."
}
Profanity detection
curl --request POST \
--url https://v2.greipapi.com/score/text \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"format": "<string>",
"mode": "<string>",
"source": "<string>"
}
'import requests
url = "https://v2.greipapi.com/score/text"
payload = {
"text": "<string>",
"format": "<string>",
"mode": "<string>",
"source": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({text: '<string>', format: '<string>', mode: '<string>', source: '<string>'})
};
fetch('https://v2.greipapi.com/score/text', 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://v2.greipapi.com/score/text",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'text' => '<string>',
'format' => '<string>',
'mode' => '<string>',
'source' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://v2.greipapi.com/score/text"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"format\": \"<string>\",\n \"mode\": \"<string>\",\n \"source\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://v2.greipapi.com/score/text")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"format\": \"<string>\",\n \"mode\": \"<string>\",\n \"source\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://v2.greipapi.com/score/text")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"<string>\",\n \"format\": \"<string>\",\n \"mode\": \"<string>\",\n \"source\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body
{
"success": true,
"data": {
"risk_level": "low",
"recommendation": "accept"
},
"execution_ms": 120
}
{
"success": false,
"code": 101,
"type": "invalid_key",
"description": "The API Key is missing or invalid."
}
Risk Scoring
Profanity Detection
This method helps safeguard your website or app by detecting offensive or inappropriate language in user inputs. By screening for profanity and other harmful content before it’s made public, you can maintain a positive user environment, protect your brand, and prevent abusive behavior on your platform.
API v2 returns risk_level and recommendation for the submitted text (no legacy score-only or word-list fields).
{
"success": true,
"data": {
"risk_level": "low",
"recommendation": "accept"
},
"execution_ms": 120
}
{
"success": false,
"code": 101,
"type": "invalid_key",
"description": "The API Key is missing or invalid."
}
POST
/
score
/
text
Profanity detection
curl --request POST \
--url https://v2.greipapi.com/score/text \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"format": "<string>",
"mode": "<string>",
"source": "<string>"
}
'import requests
url = "https://v2.greipapi.com/score/text"
payload = {
"text": "<string>",
"format": "<string>",
"mode": "<string>",
"source": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({text: '<string>', format: '<string>', mode: '<string>', source: '<string>'})
};
fetch('https://v2.greipapi.com/score/text', 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://v2.greipapi.com/score/text",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'text' => '<string>',
'format' => '<string>',
'mode' => '<string>',
'source' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://v2.greipapi.com/score/text"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"format\": \"<string>\",\n \"mode\": \"<string>\",\n \"source\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://v2.greipapi.com/score/text")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"format\": \"<string>\",\n \"mode\": \"<string>\",\n \"source\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://v2.greipapi.com/score/text")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"<string>\",\n \"format\": \"<string>\",\n \"mode\": \"<string>\",\n \"source\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body
{
"success": true,
"data": {
"risk_level": "low",
"recommendation": "accept"
},
"execution_ms": 120
}
{
"success": false,
"code": 101,
"type": "invalid_key",
"description": "The API Key is missing or invalid."
}
Authentication
Include your API key in theAuthorization header:
Authorization: Bearer <api_key>
POST /score/text with a JSON body (not a GET request).
JSON body
string
required
The text you want to filter.Sample value:
This is a sample text without profanity!string
default:"JSON"
The format command is used to get a response in a specific format.Expected values:
JSON, XML, CSV, or NewlineFor more information please refer to Response format.string
default:"live"
The mode command is used 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.string
Optional label for your own analytics or support correlation (for example a product or channel name).
Response properties
boolean
required
true when the request succeeded; false on error.object
required
Hide properties
Hide properties
string
required
Overall profanity risk for the submitted text (
low, medium, or high). Greip classifies matches into levels: the highest severity wins (risky phrases and words first, then medium-risk, then low-risk). A clean text returns low.string
required
Suggested action (
accept, review, or reject) derived from risk_level.integer
required
Time taken to process the request (milliseconds).
Was this page helpful?