NewConnect Claude, Gemini, ChatGPT, and other AI agents to API Ninjas via our MCP server

Profanity Filter API

The Profanity Filter API detects and censors swear words, bad words, and profanity in any text.

(4.6)

From 2,603 users

3,200+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
359ms387ms455ms690ms1044ms

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

  • text  required

    Input text. Maximum 1000 characters.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON object with the following fields or an error if the request is unsuccessful.

  • original

    The original input text.

  • censored

    The text with profanity replaced by asterisks.

  • has_profanity

    Whether the text contains profanity (true or false).

Sample Request Live Demo!

text

Try this endpoint live with a free API key

Instant access — no credit card required.

https://api.api-ninjas.com/v1/profanityfilter?text=damn it!

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON
{
    original:"damn it!",
    censored:"**** it!",
    has_profanity:true
}

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

  • 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.
  • Sign up for a free account to instantly get your API key, then pass it in the X-Api-Key header on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.
  • 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.
  • 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.
  • The /v1/profanityfilter GET endpoint returns a JSON object with original (your input text), censored (the same text with bad words replaced by asterisks), and has_profanity (a boolean that is true or false). If the request is unsuccessful you will receive an error instead, as described in our error codes.
  • Yes, the required text query 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.
  • Every call returns the has_profanity boolean, so you can use that flag alone for moderation gating and ignore the censored output 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.
  • The endpoint filters whatever text you 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.