Character Counter API
Count characters (grapheme clusters), characters without spaces, UTF-8 bytes, words and lines, plus X post weighted length, SMS encoding and segments, and common platform limits.
POST /api/v1/tools/character-counterMCP character_counterText & WritingCount characters, bytes, words and lines, and check limits for X posts, Instagram captions and bios, LinkedIn, meta tags and SMS segments in GSM-7 or UCS-2.
Input
Send these as a JSON object. Unknown fields are rejected.
- input
- The text to count. (string, required)
curl https://pithlab.com/api/v1/tools/character-counter \n -H "Authorization: Bearer $PITHLAB_KEY" \n -H "Content-Type: application/json" \n -d '{"input":"Hello, world! 👋"}'Example response
{
"ok": true,
"result": {
"characters": 15,
"withoutSpaces": 13,
"bytes": 18,
"words": 2,
"lines": 1,
"x": {
"length": 16,
"urls": 0,
"limit": 280
},
"sms": {
"encoding": "UCS-2",
"units": 16,
"segments": 1,
"perSegment": 70,
"remaining": 54,
"nonGsm": [
"👋"
]
},
"limits": [
{
"id": "x",
"name": "X post",
"limit": 280,
"count": 16,
"over": false
},
{
"id": "instagram-caption",
"name": "Instagram caption",
"limit": 2200,
"count": 15,
"over": false
},
{
"id": "instagram-bio",
"name": "Instagram bio",
"limit": 150,
"count": 15,
"over": false
},
{
"id": "linkedin-post",
"name": "LinkedIn post",
"limit": 3000,
"count": 15,
"over": false
},
{
"id": "meta-title",
"name": "Meta title",
"limit": 60,
"count": 15,
"over": false
},
{
"id": "meta-description",
"name": "Meta description",
"limit": 160,
"count": 15,
"over": false
}
]
}
}