All API responses are JSON. JSON request bodies should use:
Content-Type: application/jsonTypical error response:
{
"ok": false,
"error": "message"
}/api/encrypt and /api/decrypt use the same pipeline array. Each step needs a type; key-based algorithms may include key.
[
{ "type": "base64" },
{ "type": "aes_256_gcm", "key": "secret" }
]Supported type values:
base16, base32, base58, base64, base85
aes_256_gcm, chacha20_poly1305, xchacha20_poly1305, aes_256_cbc
sha256, sha512, blake3, md5
js_hex_escape, js_unicode_escape, js_binary_string, js_jjencode, js_aaencode
js_jsfuck, js_eval_wrap, js_constructor_wrap, js_base36_tostring
bf_text, bf_emoji
Hash steps are one-way and cannot be reversed by /api/decrypt.
Runs the pipeline in order.
{
"text": "hello world",
"pipeline": [
{ "type": "base64" },
{ "type": "aes_256_gcm", "key": "secret" }
]
}Response:
{
"ok": true,
"ciphertext": "...",
"pipeline_desc": "Base64 -> AES-256-GCM",
"plaintext_hash": "..."
}Symmetric encryption outputs are Base64-wrapped for text transport.
Runs the provided pipeline in reverse order.
{
"text": "...",
"pipeline": [
{ "type": "base64" },
{ "type": "aes_256_gcm", "key": "secret" }
],
"expected_hash": "optional sha256 hex"
}Response:
{
"ok": true,
"plaintext": "hello world",
"verified": null,
"hash_match": null
}If expected_hash is omitted, verified and hash_match are null; otherwise they are booleans.
Automatically detects and decodes layered text.
{
"text": "SGVsbG8",
"key": "",
"max_depth": 8,
"pipeline": []
}Response:
{
"ok": true,
"plaintext": "Hello",
"pipeline_desc": "AI decode: undo Base64",
"attempts": 1,
"still_encoded": false,
"steps": ["Base64"]
}max_depth defaults to 8 and is clamped to 1 through 12. pipeline is optional and is tried first when provided.
{
"text": "secret message",
"pieces": 3
}Response:
{
"ok": true,
"pieces": ["...", "...", "..."]
}{
"pieces": ["...", "...", "..."]
}Response:
{
"ok": true,
"text": "secret message"
}{
"template": "sk-{date:MMDD}-{word:tech}-{random:hex:8}"
}Response:
{
"ok": true,
"text": "sk-0501-kubernetes-a3f12c9b"
}Template variables are documented in TEMPLATES.md.
These audit endpoints are admin-only. Configure an admin token with
--admin-token <token> or VEILTEXT_ADMIN_TOKEN, then send it as
X-Admin-Token: <token> or Authorization: Bearer <token>.
| Method | Path | Purpose |
|---|---|---|
| GET | /api/history |
List backend audit history records |
| DELETE | /api/history |
Clear backend audit history |
| DELETE | /api/history/:id |
Delete one backend audit record |
| Method | Path | Purpose |
|---|---|---|
| GET | /api/template-data |
Read word banks and template data |
| PUT | /api/template-data |
Replace template data |
| DELETE | /api/template-data |
Reset template data to defaults |
Returns basic UI settings:
{
"ok": true,
"settings": {
"theme": "auto",
"language": "auto"
}
}Updates in-memory AI settings:
{
"ai_provider": "openai",
"ai_endpoint": "https://api.openai.com/v1",
"ai_key": "sk-...",
"ai_model": "gpt-4o-mini"
}Tests AI connectivity with the provided provider, endpoint, key, and model.
AI assistant endpoint. The model can call built-in tools; the server performs up to 4 tool rounds.
{
"message": "base64 encode hello",
"provider": "openai",
"endpoint": "https://api.openai.com/v1",
"key": "sk-...",
"model": "gpt-4o-mini"
}Response:
{
"ok": true,
"reply": "...",
"actions": []
}Available tools:
encrypt, decrypt, generate, puzzle_split, puzzle_merge, web_search, get_time, system_info