Perspective API
Overview
Perspective is a free NLP API from Jigsaw (Google) that scores text for toxic, obscene, insulting, or threatening content, returning a probability between 0 and 1 for each attribute. It is widely used for building comment moderation systems and community safety tools. The API supports multiple languages and can analyze text for a range of harmful content types.
Beginner Tip
Use a threshold of 0.7 or higher for the TOXICITY attribute when auto-moderating comments—lower thresholds can produce too many false positives for legitimate content. Always combine automated scoring with human review for edge cases.
Available Data
Example Response
{
"url": "https://example.com",
"safe": true,
"threat_level": "none",
"categories": [
"clean"
],
"scan_date": "2025-01-15T10:00:00Z"
} Field Reference
attributeScores Map of requested attribute names to their score objects (e.g., TOXICITY, INSULT, THREAT). attributeScores.TOXICITY.summaryScore.value Probability score from 0 to 1 that the text is toxic; scores above 0.7 are generally considered high risk. attributeScores.TOXICITY.summaryScore.type Scoring type used, typically 'PROBABILITY' indicating a probability estimate. languages List of language codes detected in or specified for the analyzed text. detectedLanguages Languages automatically detected in the submitted comment text. Implementation Example
const url = "https://perspectiveapi.com/";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
headers: {
"X-API-Key": "YOUR_API_KEY"
}
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data); What Can You Build?
Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.
Common Errors & Troubleshooting
Matrix Score Breakdown
Partially tested on Apr 5, 2026
Technical Specifications
Related Tags
Similar APIs
View All →AI For Thai
AI For Thai is a free collection of AI-powered APIs specifically designed for the Thai language, covering NLP tasks like word segmentation, sentiment analysis, and text-to-speech.
Cloudmersive
⭐ Beginner's PickCloudmersive Image Recognition API offers a suite of image processing capabilities including captioning, face detection, NSFW content classification, and object recognition.
Dialogflow
Dialogflow is Google's Natural Language Processing platform that lets you build conversational interfaces like chatbots and voice assistants.
Hirak FaceAPI
⭐ Beginner's PickHirak FaceAPI provides face detection and recognition capabilities including age estimation and gender classification from images.
Imagga
⭐ Beginner's PickImagga is an image recognition API that can automatically tag images with descriptive labels, perform visual search, and detect inappropriate (NSFW) content.