Word Count API
Count words, characters, sentences, and paragraphs in any text via REST API. Returns a comprehensive text statistics breakdown in a single call — useful for content length validation, readability analysis, and billing by word count.
Try it live →How it works
POST any text string. Returns: word count (splitting on whitespace), character count with spaces, character count without spaces, sentence count (splitting on terminal punctuation), paragraph count (splitting on double newlines), and average word length.
Use cases
- Validate that user-submitted content meets minimum or maximum length requirements
- Compute reading time estimates from word count in CMS systems
- Bill customers by word count for translation or editing services
- Analyze document length distribution across a corpus
API Reference
POST https://slopshop.gg/v1/text-word-count
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Input parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
text / input |
string | required | The text or data to process |
Example response
{
"data": {
"words": 142,
"characters": 832,
"characters_no_spaces": 695,
"sentences": 8,
"paragraphs": 3
},
"meta": {
"credits_used": 1,
"engine": "real",
"ms": 4
}
}
Examples
Three real-world scenarios showing how developers use Word Count in production.
curl -X POST https://slopshop.gg/v1/text-word-count \
-H "Authorization: Bearer $SLOPSHOP_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "In the fast-evolving world of software development, API-first design has become the cornerstone of modern application architecture..."}'
curl -X POST https://slopshop.gg/v1/text-word-count \
-H "Authorization: Bearer $SLOPSHOP_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Artificial intelligence is transforming how businesses operate across every industry..."}'
curl -X POST https://slopshop.gg/v1/text-word-count \
-H "Authorization: Bearer $SLOPSHOP_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Le chiffre d'affaires trimestriel de la société a augmenté de 15% par rapport au trimestre précédent..."}'
Code examples
curl
curl -X POST https://slopshop.gg/v1/text-word-count \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"input": "your data here"}'
Python
import requests
response = requests.post(
"https://slopshop.gg/v1/text-word-count",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"input": "your data here"}
)
result = response.json()
print(result["data"])
Node.js
const response = await fetch("https://slopshop.gg/v1/text-word-count", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({ input: "your data here" })
});
const { data } = await response.json();
console.log(data);
CLI
# Install the Slopshop CLI
npm install -g slopshop
# Set your API key
export SLOPSHOP_KEY=your_api_key
# Call text-word-count
slop text-word-count '{"input": "your data here"}'
Pricing
Credits are purchased in bundles starting at $1 for 1,000 credits. All compute APIs like this one use 1 credit per call — that's $0.001. See all pricing tiers.
Related APIs in Text Processing
View the full API catalog · Try in playground · Documentation