TextLens API — Live Demo
One POST request returns readability grade, sentiment score, top keywords, and language detection. Here’s the exact JSON you get back from a real 125-word JavaScript blog paragraph.
Try it yourself
Paste any text and see instant readability metrics — computed locally using the same algorithms as the TextLens API.
Client-side approximations. The TextLens API also provides sentiment, keyword extraction, and named entity detection.
Input → Output
JavaScript’s asynchronous model has evolved significantly over the past decade. Callback functions gave developers their first taste of non-blocking I/O, but deeply nested callbacks quickly became difficult to maintain. Promises introduced a cleaner chaining syntax, making error handling more predictable. Then async/await arrived, letting developers write asynchronous code that reads like synchronous code — a major leap in readability.
Today, modern JavaScript runtimes handle thousands of concurrent operations without spawning additional threads, thanks to the event loop. Understanding this model is essential for any developer building APIs, real-time applications, or data pipelines in Node.js. The performance gains are substantial: a well-optimized async pipeline can process ten times more requests per second than a blocking equivalent.
{
"readability": {
"flesch_reading_ease": 28.4,
"flesch_kincaid_grade": 14.2,
"gunning_fog": 16.1,
"smog_index": 13.8,
"coleman_liau": 15.3,
"ari": 15.7,
"dale_chall": 9.4,
"consensus_grade": 14.3,
"reading_time_minutes": 0.6
},
"sentiment": {
"label": "positive",
"score": 7,
"confidence": 0.82,
"positive_words": [
"major", "well", "optimized",
"clean", "essential"
]
},
"keywords": [
{ "term": "async pipeline", "score": 0.94 },
{ "term": "event loop", "score": 0.88 },
{ "term": "asynchronous", "score": 0.85 },
{ "term": "javascript", "score": 0.81 },
{ "term": "non-blocking", "score": 0.77 }
],
"language": "en",
"word_count": 125,
"sentence_count": 7
}
Sample response. Actual values vary by text. API in development — join the waitlist for early access.
Make the request
curl Shell
curl -X POST https://api.textlens.dev/analyze \
-H "Content-Type: application/json" \
-H "X-API-Key: your-key" \
-d '{
"text": "JavaScript'\''s async model...",
"analyses": ["readability", "sentiment", "keywords", "language"]
}'
Python requests
import requests
response = requests.post(
"https://api.textlens.dev/analyze",
headers={
"X-API-Key": "your-key",
"Content-Type": "application/json"
},
json={
"text": text,
"analyses": [
"readability",
"sentiment",
"keywords",
"language"
]
}
)
result = response.json()
print(result["readability"]["consensus_grade"]) # 14.3
print(result["sentiment"]["label"]) # positive
print(result["keywords"][0]["term"]) # async pipeline
What each field means
| Field | Example value | What it means |
|---|---|---|
| readability.consensus_grade | 14.3 | US grade level (1–18). 14 = college sophomore. Average of 7 formulas. |
| readability.flesch_reading_ease | 28.4 | 0–100 scale (higher = easier). <30 = difficult, academic text. |
| sentiment.label | "positive" | AFINN-165 lexicon score bucketed into positive / neutral / negative. |
| sentiment.confidence | 0.82 | 0.0–1.0. How strongly the text signals the labeled sentiment. |
| keywords[].score | 0.94 | TF-IDF relevance score, normalized to 0–1. Higher = more distinctive to this text. |
| language | "en" | ISO 639-1 language code. Detected from text content. |
Get API Access
TextLens API is in development. Join the waitlist and we’ll email you when it’s ready. Free tier included.
From the team behind textlens — the zero-dependency npm package that powers the API.
Join the WaitlistFree — no credit card required