Express
Content Moderation Middleware for Express
One middleware, every route protected.
Block unsafe requests before they reach your handlers.
What it detects
- • POST request bodies
- • PUT/PATCH updates
- • File uploads via multer
- • WebSocket message frames
- • GraphQL mutation inputs
- • Custom rules
Why developers choose Vettly
- • Drop in as Express middleware
- • Works with multer for image uploads
- • Sub-300ms decisions
- • Audit logs for every blocked request
Example request
bashimport express from 'express';
import { Vettly } from '@vettly/sdk';
const vettly = new Vettly({ apiKey: process.env.VETTLY_API_KEY });
const app = express();
app.use(express.json());
app.post('/messages', async (req, res) => {
const result = await vettly.check({
content: req.body.text,
contentType: 'text',
policyId: 'default',
});
if (result.action === 'block') return res.status(400).json({ blocked: true });
// ...persist message
res.json({ ok: true });
});Example response
json{
"flagged": true,
"action": "block",
"categories": {
"harassment": 0.93,
"hate": 0.02
},
"policy": "default",
"latency_ms": 142
}Compared to wordlist middleware
AI categories catch novel evasions that wordlists miss, with no maintenance overhead.
Keep exploring
Content Moderation API
One endpoint for text, image, and video moderation.
Image Moderation API
Policy-driven image checks with clear allow, review, and block actions.
Video Moderation API
Async video moderation without stitching together multiple vendors.
Content Moderation in Next.js
Add content moderation to a Next.js App Router project in minutes. Server-side API routes, React Server Components, and edge runtime examples.
Get an API key
Start making decisions in minutes with a Developer plan and clear upgrade paths.
Get an API key