TestingAPIs is still being built. If something breaks, email support@testingapis.com.

Reads a plain-text body and counts its bytes, characters, lines and words

POSThttps://api.testingapis.com/api/bodies/textSign in to see this endpoint's URL

Up to 1MB is analysed; larger bodies are counted and flagged with truncated.

Request body

Optional. text/plain. Plain text; counts characters, lines and words.

Example body
Hello
world

Responses

200
Text statistics and the text itself.
400
Body is not valid UTF-8.
415
Content-Type is not text/plain.

Example

Request
curl -X POST "https://api.testingapis.com/api/bodies/text" \
  -H "Content-Type: text/plain" \
  -d 'Hello
world' \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response200 OK
{
  "contentType": "text/plain",
  "bytes": 11,
  "characters": 11,
  "lines": 2,
  "words": 2,
  "truncated": false,
  "text": "Hello\nworld"
}

Sign in to see the details

The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.