API reference

Base URL: https://api.smoltext.sprapp.com. All endpoints accept and return JSON.

Authentication

Pass your key from the dashboard as a bearer token:

Authorization: Bearer sk_live_xxxxxxxxxxxx

Calls without a key fall back to the anonymous free tier (10/day, rate-limited by IP).

POST /v1/compress

Compress one string. One billable call.

// request
{ "text": "192.168.1.100 GET /api/v1/users", "turbo": false }

// response
{
  "compressed": "Ab...",      // base64 wire payload
  "bytesIn": 31,
  "bytesOut": 11,
  "ratio": 0.355,
  "savingsPct": 64.5,
  "incompressible": false,
  "usage": { "used": 12, "limit": 100000, "remaining": 99988, "window": "month", "period": "2026-06" }
}

turbo: true uses greedy mode — faster, marginally less compression. Incompressible input is stored raw (lossless) and returns incompressible: true.

POST /v1/decompress

// request
{ "compressed": "Ab..." }

// response
{ "text": "192.168.1.100 GET /api/v1/users", "usage": { ... } }

POST /v1/batch

Compress up to 1000 strings in one request. Counts N billable calls.

// request
{ "items": ["a@b.com", "10.0.0.1", "{\"k\":1}"], "turbo": false }

// response
{ "results": [ { "compressed": "...", "bytesIn": 7, ... }, ... ], "count": 3, "usage": { ... } }

GET /v1/usage

Current period usage for the authenticated key.

{ "email": "you@co.com", "plan": "starter",
  "usage": { "used": 1240, "limit": 100000, "remaining": 98760, "window": "month", "period": "2026-06" } }

POST /v1/signup

{ "email": "you@co.com" }  →  { "api_key": "sk_live_...", "plan": "free" }

POST /v1/checkout auth

Returns a Lemon Squeezy hosted checkout URL to upgrade. Body: { "plan": "starter" | "pro" | "scale", "interval": "monthly" | "annual" } (interval defaults to monthly; annual = 2 months free).

Errors

{ "error": "quota_exceeded", "message": "free plan allows 10 calls/day. Upgrade..." }
Statuscodemeaning
400bad_request / bad_email / bad_payloadmalformed input
401missing_key / invalid_keyauth failed
413input_too_large / batch_too_largeover 64KB or 1000 items
429quota_exceededplan limit hit
5xxinternal / stripe_errorserver side

Limits