API reference
All endpoints are POST, JSON in and JSON out, versioned under /api/v1. Authentication is a bearer key. Requests without a valid key return 401; over-quota requests return 429.
Authentication
Create a key on your account page. The full key is shown once; we store only a SHA-256 hash. Send it as:
Authorization: Bearer tbc_live_xxxxxxxxxxxxxxxx
Revoking a key takes effect immediately. Rotate by creating a new key and deleting the old one.
Text statistics
POST /api/v1/text-stats
Request
curl -X POST https://toolsbyclick.com/api/v1/text-stats \
-H "Authorization: Bearer tbc_live_..." \
-H "Content-Type: application/json" \
-d '{"text":"Small tools, done properly."}'Response
{
"ok": true,
"words": 4,
"characters": 26,
"characters_no_spaces": 22,
"sentences": 1,
"paragraphs": 1
}Unit conversion
POST /api/v1/units
Request
curl -X POST https://toolsbyclick.com/api/v1/units \
-H "Authorization: Bearer tbc_live_..." \
-H "Content-Type: application/json" \
-d '{"measure":"length","value":100,"from":"cm","to":"in"}'Response
{
"ok": true,
"measure": "length",
"input": { "value": 100, "unit": "cm" },
"result": { "value": 39.37007874, "unit": "in" }
}Colour conversion
POST /api/v1/color
Request
curl -X POST https://toolsbyclick.com/api/v1/color \
-H "Authorization: Bearer tbc_live_..." \
-H "Content-Type: application/json" \
-d '{"color":"#6366F1","against":"#FFFFFF"}'Response
{
"ok": true,
"hex": "#6366F1",
"rgb": { "r": 99, "g": 102, "b": 241 },
"hsl": { "h": 239, "s": 84, "l": 67 },
"contrast_against": 4.47
}Errors
| Status | When | Body |
|---|---|---|
| 400 | Invalid or missing fields | { "ok": false, "error": "…" } |
| 401 | Missing, invalid or revoked key | { "ok": false, "error": "unauthorized" } |
| 403 | Key exists but the plan has no API access | { "ok": false, "error": "forbidden" } |
| 429 | Monthly allowance exhausted | { "ok": false, "error": "quota_exceeded" } |