Profanity Filter API
The Profanity Filter API detects and censors swear words, bad words, and profanity in any text.
From 2,603 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 359ms | 387ms | 455ms | 690ms | 1044ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
/v1/profanityfilter GET
https://api.api-ninjas.com/v1/profanityfilter
Returns the censored version (bad words replaced with asterisks) of any given text and whether the text contains profanity.
Parameters
textrequiredInput text. Maximum 1000 characters.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON object with the following fields or an error if the request is unsuccessful.
originalThe original input text.
censoredThe text with profanity replaced by asterisks.
has_profanityWhether the text contains profanity (
trueorfalse).
Sample Request Live Demo!
https://api.api-ninjas.com/v1/profanityfilter?text=damn it!Headers
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/profanityfilter?text=hello%20world" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
Frequently Asked Questions
Can I use the Profanity Filter API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Profanity Filter API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.How do I get an API key and start using the Profanity Filter API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.What happens if a request to the Profanity Filter API fails?
The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.What does the Profanity Filter response include and how is text censored?
The/v1/profanityfilterGET endpoint returns a JSON object withoriginal(your input text),censored(the same text with bad words replaced by asterisks), andhas_profanity(a boolean that istrueorfalse). If the request is unsuccessful you will receive an error instead, as described in our error codes.Is there a limit on how much text I can submit?
Yes, the requiredtextquery parameter accepts a maximum of 1000 characters per request, so longer documents must be split into chunks before sending. See pricing for the request volume allowed on each plan.Can I just check whether text contains profanity without censoring it?
Every call returns thehas_profanityboolean, so you can use that flag alone for moderation gating and ignore thecensoredoutput if you do not need the masked text. To also analyze the tone or intent of the same content, pair it with the Sentiment API.How can I clean up user text before filtering profanity?
The endpoint filters whatevertextyou pass, so pre-processing user input can improve results, for example correcting typos with the Spell Check API or detecting the input language first with the Text Language API.