TextLens API for Java

Add text analysis to your Java app with a single HTTP call. Readability grades (8 formulas), sentiment scoring, keyword extraction, and SEO analysis — no NLP libraries to configure, no model files to download.

From the team behind textlens — 96 npm downloads/week

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.ckmtools.dev/v1/analyze"))
    .header("Content-Type", "application/json")
    .header("X-API-Key", System.getenv("TEXTLENS_KEY"))
    .POST(HttpRequest.BodyPublishers.ofString(
        "{\"text\": \"" + text + "\"}")
    )
    .build();

HttpResponse<String> response = client.send(request,
    HttpResponse.BodyHandlers.ofString());
// parse response.body() with your JSON library
// result.readability.consensus_grade → "Grade 8"
// result.sentiment.label → "positive"
Join the Waitlist

What you get

8 Readability Formulas

Flesch-Kincaid, Gunning Fog, SMOG, Coleman-Liau, ARI, Dale-Chall, Linsear Write, consensus grade. No single Java library covers all eight.

Sentiment + Keywords

AFINN sentiment for long-form content. TF-IDF keyword extraction with relevance scores. SEO quality scoring.

No Library Dependencies

No Stanford CoreNLP (150MB+ model files), no OpenNLP training data. Works in Spring Boot, Quarkus, Micronaut, or any Java HTTP client.

What you get back

One endpoint returns everything you need:

{
  "readability": {
    "flesch_kincaid_grade": 8.2,
    "gunning_fog": 10.1,
    "smog": 9.4,
    "coleman_liau": 11.2,
    "ari": 8.9,
    "dale_chall": 7.1,
    "linsear_write": 8.0,
    "consensus_grade": "Grade 8"
  },
  "sentiment": {
    "score": 3,
    "label": "positive",
    "comparative": 0.23
  },
  "keywords": [
    { "word": "readability", "score": 0.87 },
    { "word": "analysis", "score": 0.72 }
  ],
  "seo": {
    "score": 78,
    "word_count": 342
  }
}

The code

Java 11+ HttpClient — stdlib, zero extra dependencies recommended
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.ckmtools.dev/v1/analyze"))
    .header("Content-Type", "application/json")
    .header("X-API-Key", System.getenv("TEXTLENS_KEY"))
    .POST(HttpRequest.BodyPublishers.ofString(
        "{\"text\": \"" + text + "\"}")
    )
    .build();

HttpResponse<String> response = client.send(request,
    HttpResponse.BodyHandlers.ofString());
// parse response.body() with your JSON library
// result.readability.consensus_grade → "Grade 8"
// result.sentiment.label → "positive"
OkHttp
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(
    "{\"text\":\"" + text + "\"}",
    MediaType.get("application/json")
);
Request request = new Request.Builder()
    .url("https://api.ckmtools.dev/v1/analyze")
    .addHeader("X-API-Key", System.getenv("TEXTLENS_KEY"))
    .post(body)
    .build();
try (Response response = client.newCall(request).execute()) {
    String json = response.body().string();
}
Spring RestTemplate / WebClient (Spring Boot)
@Service
public class TextAnalysisService {
    @Value("${textlens.api-key}")
    private String apiKey;

    public Map<String, Object> analyze(String text) {
        HttpHeaders headers = new HttpHeaders();
        headers.set("X-API-Key", apiKey);
        headers.setContentType(MediaType.APPLICATION_JSON);
        return restTemplate
            .exchange(
                "https://api.ckmtools.dev/v1/analyze",
                HttpMethod.POST,
                new HttpEntity<>(Map.of("text", text), headers),
                new ParameterizedTypeReference<Map<String, Object>>() {}
            ).getBody();
    }
}

No Java NLP library covers this

Stanford CoreNLP requires model downloads ranging from 150MB to 4GB depending on the analysis pipeline. OpenNLP requires training data files for each task. Apache Lucene covers tokenization and search indexing but not readability grades or AFINN sentiment scoring. TextLens API covers all of it in one HTTP call — works with Java 11+ HttpClient (stdlib, zero extra deps), OkHttp, or Spring RestTemplate. Runs in Spring Boot, Quarkus, Micronaut, or any framework that can make an HTTP request.

Join the Waitlist

TextLens API is in development. Join the waitlist to get notified at launch.

Backed by the textlens npm package — 96 downloads/week.

Get Early Access

$0 — no credit card required

Pricing

Free

$0 /mo
  • 1,000 requests/mo
  • 10 req/min rate limit
  • 5,000 char max per request
Get Started

Starter

$9 /mo
  • 10,000 requests/mo
  • 60 req/min rate limit
  • 25,000 char max per request
Subscribe

Team

$79 /mo
  • 500,000 requests/mo
  • 300 req/min rate limit
  • 500,000 char max per request
Subscribe

Using Ruby? See Ruby-specific examples →

Using Go? See Go-specific examples →

See all library comparisons →