Profanity Filter
Detect and censor profanity in text. Returns a censored copy of the input and the list of flagged words found.
Overview
Use Cases
- User-generated content moderation
- Chat and comment filtering
- Forum and community platforms
- Child-safe application layers
Features
Case-insensitive detection
Censors flagged words with asterisks
Returns deduplicated list of flagged words
Preserves surrounding punctuation and whitespace
API Endpoints
Check Profanity
Checks text for profanity, returning a censored version and the list of flagged words.
POST
https://requiems.xyz/v1/validation/profanity
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| text | string |
Required | The text to check for profanity. |
Try it out
Live DemoRequest
The text to check for profanity.
Sending request...
Response Fields
| Field | Type | Description |
|---|---|---|
| has_profanity | boolean |
Whether any profanity was detected in the text |
| censored | string |
The input text with profane words replaced by asterisks |
| flagged_words | array<string> |
Deduplicated list of profane words found (lowercase) |
Code Examples
curl -X POST https://requiems.xyz/v1/validation/profanity \
-H "requiems-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Some text to check"}'
import requests
url = "https://requiems.xyz/v1/validation/profanity"
headers = {
"requiems-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {"text": "Some text to check"}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
const response = await fetch('https://requiems.xyz/v1/validation/profanity', {
method: 'POST',
headers: {
'requiems-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({ text: 'Some text to check' })
});
const data = await response.json();
console.log(data.data.has_profanity);
console.log(data.data.censored);
require 'net/http'
require 'json'
uri = URI('https://requiems.xyz/v1/validation/profanity')
request = Net::HTTP::Post.new(uri)
request['requiems-api-key'] = 'YOUR_API_KEY'
request['Content-Type'] = 'application/json'
request.body = { text: 'Some text to check' }.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
data = JSON.parse(response.body)
puts data['data']['has_profanity']
puts data['data']['censored']
Error Responses
validation_failed
The text field is missing or empty.
bad_request
The request body is missing or malformed.
internal_error
Unexpected server error.
Batch Check Profanity
Check up to 50 texts for profanity in a single request. Results are returned in input order.
POST
https://requiems.xyz/v1/validation/profanity/batch
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| texts | array<string> |
Required | List of texts to check (1β50 items, each non-empty). |
Try it out
Live DemoRequest
List of texts to check (1β50 items, each non-empty).
Sending request...
Response Fields
| Field | Type | Description |
|---|---|---|
| results | array<object> |
Per-item results in input order. |
| results[].text | string |
The original text that was checked. |
| results[].result.has_profanity | boolean |
Whether any profanity was detected. |
| results[].result.censored | string |
Text with profane words replaced by asterisks. |
| results[].result.flagged_words | array<string> |
Deduplicated list of detected profane words (lowercase). |
| total | integer |
Total number of items processed. |
Code Examples
curl -X POST https://requiems.xyz/v1/validation/profanity/batch \
-H "requiems-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"texts": ["hello world", "some bad word here"]}'
import requests
url = "https://requiems.xyz/v1/validation/profanity/batch"
headers = {
"requiems-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {"texts": ["hello world", "some bad word here"]}
response = requests.post(url, headers=headers, json=payload)
for item in response.json()["data"]["results"]:
print(item["text"], item["result"]["has_profanity"])
const response = await fetch('https://requiems.xyz/v1/validation/profanity/batch', {
method: 'POST',
headers: {
'requiems-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({ texts: ['hello world', 'some bad word here'] })
});
const { data } = await response.json();
data.results.forEach(item => {
console.log(item.text, item.result.has_profanity);
});
require 'net/http'
require 'json'
uri = URI('https://requiems.xyz/v1/validation/profanity/batch')
request = Net::HTTP::Post.new(uri)
request['requiems-api-key'] = 'YOUR_API_KEY'
request['Content-Type'] = 'application/json'
request.body = { texts: ['hello world', 'some bad word here'] }.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
data = JSON.parse(response.body)['data']
data['results'].each { |item| puts "#{item['text']}: #{item['result']['has_profanity']}" }
Error Responses
validation_failed
The texts array is missing, empty, or exceeds 50 items.
bad_request
The request body is missing or malformed.
Frequently Asked Questions
Each character of a flagged word is replaced with an asterisk (*), preserving the word length. Surrounding punctuation and whitespace are kept intact.
No. Detection is case-insensitive, so "BULLSHIT", "Bullshit", and "bullshit" are all detected. The censored output replaces the original casing with asterisks.
No. The flaggedWords array contains each detected word only once, regardless of how many times it appears in the input.