Text Processing 1 credit COMPUTE

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

API Reference

POST https://slopshop.gg/v1/text-word-count
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Input parameters

ParameterTypeRequiredDescription
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.

Example 1
Validate content length
Check that a blog post meets a minimum 500-word requirement.
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..."}'
Example 2
Calculate reading time
Estimate reading time for an article to display on a blog homepage.
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..."}'
Example 3
Bill by word count
Count words in a translated document to compute the invoice amount.
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 per call
1
credits
Cost per call
$0.001
at Starter tier
Tier
COMPUTE
Pure compute

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