Social media character counter API
Paste a post and see at once how it fits on X, Threads, Bluesky, Mastodon, LinkedIn, Instagram, Facebook, TikTok, Pinterest, YouTube and Google Business Profile.
- Endpoint:
POST https://postboost.co/app/api/tools/social-media-character-counter(operationIdcountCharacters) - Web tool: postboost.co/tools/social-media-character-counter
- Also on the web: X character counter (
network: "x"), Threads character counter (network: "threads"), Bluesky character counter (network: "bluesky") - Token: optional (limits)
- MCP: tool
count-charactersonhttps://postboost.co/mcp/tools
Request
| Field | Type | Default | Description |
|---|---|---|---|
text | string | "" | The post text, up to 10,000 characters (twice the longest network limit); 5,000 without an API token. |
network | string: x, threads, bluesky, mastodon, linkedin, instagram, facebook, tiktok, pinterest, youtube_title, youtube, gbp | Count for one network only; all networks when omitted. |
Call it
- curl
- Python
- Node.js
- PHP
- Go
- Ruby
- Java
- C#
- Rust
- CLI
curl -X POST https://postboost.co/app/api/tools/social-media-character-counter \
-H 'Content-Type: application/json' \
-d '{"text":"New post: https://postboost.co/tools","network":"x"}'
from postboost import ApiClient, Configuration
from postboost.api.free_tools_api import FreeToolsApi
from postboost.models import FreeToolCountCharactersRequest
with ApiClient(Configuration()) as client:
api = FreeToolsApi(client)
result = api.count_characters(FreeToolCountCharactersRequest.from_dict({"text": "New post: https://postboost.co/tools", "network": "x"}))
print(result.to_dict())
import { FreeToolsApi } from 'postboost';
const api = new FreeToolsApi();
const { body } = await api.countCharacters({ text: "New post: https://postboost.co/tools", network: "x" });
console.log(body);
use PostBoostClient\Api\FreeToolsApi;
use PostBoostClient\Model\FreeToolCountCharactersRequest;
$api = new FreeToolsApi(new GuzzleHttp\Client());
$result = $api->countCharacters(new FreeToolCountCharactersRequest(['text' => "New post: https://postboost.co/tools", 'network' => "x"]));
echo $result;
import (
"context"
"encoding/json"
"fmt"
postboost "github.com/postboost-co/postboost-go"
)
var request postboost.FreeToolCountCharactersRequest
if err := json.Unmarshal([]byte(`{"text":"New post: https://postboost.co/tools","network":"x"}`), &request); err != nil {
panic(err)
}
client := postboost.NewAPIClient(postboost.NewConfiguration())
result, _, err := client.FreeToolsAPI.CountCharacters(context.Background()).FreeToolCountCharactersRequest(request).Execute()
fmt.Println(result, err)
require 'postboost'
api = PostBoost::FreeToolsApi.new
result = api.count_characters(PostBoost::FreeToolCountCharactersRequest.new({ text: "New post: https://postboost.co/tools", network: "x" }))
puts result.to_hash
import com.postboost.ApiClient;
import com.postboost.api.FreeToolsApi;
import com.postboost.model.FreeToolCountCharactersRequest;
import com.postboost.model.FreeToolCountCharactersResponse;
FreeToolsApi api = new FreeToolsApi(new ApiClient());
FreeToolCountCharactersRequest request = FreeToolCountCharactersRequest.fromJson("{\"text\":\"New post: https://postboost.co/tools\",\"network\":\"x\"}");
FreeToolCountCharactersResponse result = api.countCharacters(request);
System.out.println(result.toJson());
using Newtonsoft.Json;
using PostBoost.Client.Api;
using PostBoost.Client.Client;
using PostBoost.Client.Model;
var api = new FreeToolsApi(new Configuration());
var request = JsonConvert.DeserializeObject<FreeToolCountCharactersRequest>(@"{""text"":""New post: https://postboost.co/tools"",""network"":""x""}");
var result = await api.CountCharactersAsync(request);
Console.WriteLine(result.ToJson());
use postboost::apis::configuration::Configuration;
use postboost::apis::free_tools_api;
use postboost::models::FreeToolCountCharactersRequest;
let config = Configuration::new();
let request: FreeToolCountCharactersRequest = serde_json::from_str(r##"{"text":"New post: https://postboost.co/tools","network":"x"}"##)?;
let result = free_tools_api::count_characters(&config, request).await?;
println!("{:?}", result);
echo '{"text":"New post: https://postboost.co/tools","network":"x"}' | ./postboost-cli --content-type application/json countCharacters -
With a token, send Authorization: Bearer YOUR_API_TOKEN as a default header (how, per SDK).
Response
{
"hashtags": 0,
"networks": [
{
"key": "x",
"label": "X (Twitter) post",
"limit": 280,
"count": 33,
"remaining": 247,
"over": false
}
]
}
With MCP
Connect https://postboost.co/mcp/tools (setup) and ask, for example: Count characters as each network counts them with the PostBoost count-characters tool.
Errors
| Status | When |
|---|---|
401 | The Authorization header holds an invalid token. Leave it out to call as a guest. |
413 | The JSON body is larger than 128 KB. |
422 | A field is invalid; the body lists the errors per field. |
429 | A limit is reached; see limits. |