# Profanity Filter API

> Profanity Filter is a bad word filter API that scans text for offensive language and masks detected swear words with a chosen replacement character. It returns the sanitized text and a boolean flag indicating if profanity was present. Paid plans add the count of filtered words, each matched word with its position, and custom allow and block word lists.

**Endpoint:** `POST https://api.apiverve.com/v1/profanityfilter`  
**Category:** Text Processing  
**Cost:** 2 credits per call  
**Canonical page:** https://apiverve.com/marketplace/profanityfilter

## Overview

A profanity detection and text moderation API, so a profanity check is one call. Submit any string with an optional single-character mask, which defaults to an asterisk. The endpoint inspects the content against a list of profane words, swaps matches with the chosen mask character, and reports whether offensive terms appeared. Paid plans also return the total count of filtered words, can list every matched word with its start and end position when details=true, and accept allow and add lists to exempt words from the filter or block extra ones.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl -X POST "https://api.apiverve.com/v1/profanityfilter" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Today is so damn hot! Why the hell would anyone go outside?","mask":"*","details":true,"allow":"value","add":"value"}'
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `text` | string | Yes | The text to filter profanity words from |
| `mask` | string | No | The mask to replace the profanity words with. Should be a Single Character (e.g., *). default * |
| `details` | boolean | No | Add a matches list with each filtered word and its start and end position. default false |
| `allow` | string | No | Comma-separated words the filter should not flag, up to 100 single words (e.g. hell,damn). Premium field |
| `add` | string | No | Comma-separated extra words to flag and mask, up to 100 single words. Premium field |

## Response fields

- `isProfane` — boolean · Whether the text contained profanity words
- `filteredText` — string · The text with profanity words replaced by mask characters
- `mask` — string · The mask character used to replace profane words
- `trimmed` — boolean · Whether the text was truncated before filtering (always false)
- `profaneWords` — number · Number of profanity words found and filtered · (premium)
  - `matches.0.word` — string · (premium)
  - `matches.0.start` — number · (premium)
  - `matches.0.end` — number · (premium)

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "isProfane": true,
    "filteredText": "Today is so **** hot! Why the **** would anyone go outside?",
    "mask": "*",
    "trimmed": false,
    "profaneWords": 2,
    "matches": [
      {
        "word": "damn",
        "start": 12,
        "end": 16
      },
      {
        "word": "hell",
        "start": 30,
        "end": 34
      }
    ]
  }
}
```

## Use cases

- **Livestream Chat Overlay** — Display clean real-time viewer comments on screen by replacing detected profanities with asterisks before rendering video overlays.
- **E-Commerce Review Sanitization** — When shoppers submit product ratings, review pipelines scrub vulgar vocabulary and set the profanity flag before publishing feedback.
- **Classroom Discussion Boards** — Educational platforms screen student forum posts to mask inappropriate terminology automatically across shared school assignment boards.
- **Support Ticket Sanitization** — Flag hostile customer support messages automatically on submission by evaluating incoming complaint bodies for profane language.

## SDKs

- **npm** — `npm install @apiverve/profanityfilter` (https://www.npmjs.com/package/@apiverve/profanityfilter)
- **PyPI** — `pip install apiverve-profanityfilter` (https://pypi.org/project/apiverve-profanityfilter/)
- **NuGet** — `dotnet add package APIVerve.API.ProfanityFilter` (https://www.nuget.org/packages/APIVerve.API.ProfanityFilter)
- **Source** — https://github.com/apiverve/profanityfilter-api

## More

- Full reference: https://docs.apiverve.com/ref/profanityfilter
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
