Java Profanity Filter
Moderate content in Java using the built-in HttpClient (Java 11+) — no external HTTP libraries needed.
Quick start in Java
var body = """
{"text":"%s","context":"chat","mode":"balanced"}
""".formatted(text);
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.theprofanityapi.com/v1/check"))
.header("Authorization", "Bearer " + System.getenv("PROFANITY_API_KEY"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
// parse response.body() with your JSON library Why context-aware matters
A plain word list flags "this game is sick" or medical text full of
anatomical terms. The Profanity API runs a five-layer pipeline that
scores intent, so "die" in a gaming taunt and "die" in a real
threat are handled differently. Pick a context and the engine
adjusts strictness automatically.
Other integrations
- Node.js
- TypeScript
- Python
- PHP
- Ruby
- Go
- C# / .NET
- Rust
- Kotlin
- Swift
- Dart
- Elixir
- Express.js
- Next.js
- NestJS
- Nuxt
- Fastify
- Django
- Flask
- FastAPI
- Laravel
- Symfony
- Ruby on Rails
- Spring Boot
- ASP.NET Core
- Phoenix
- React
- Vue
- SvelteKit
- Angular
- React Native
- Flutter
- WordPress
- Discord Bot
Ready to ship moderation?
Get an API key and 300 free requests a month. No credit card required.
Get started free →