Before you start
- Base URL: https://toonverter.com/api
- All endpoints speak JSON over HTTPS
- Rate limits are generous for evaluation—reach out if you need higher throughput
Quick start with cURL
curl https://toonverter.com/api/convert \
-H "Content-Type: application/json" \
-d '{
"input_data": "{\"name\": \"Nova\", \"role\": \"moderator\"}",
"direction": "json_to_toon"
}'
Python helper with retries
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
session = requests.Session()
session.mount(
"https://",
HTTPAdapter(max_retries=Retry(total=3, backoff_factor=0.5)),
)
payload = {
"input_data": "{\"session\": 42, \"status\": \"active\"}",
"direction": "json_to_toon",
}
resp = session.post("https://toonverter.com/api/convert", json=payload, timeout=10)
resp.raise_for_status()
print(resp.json()["output"])
Node/Edge function example
import fetch from "node-fetch";
export async function convertJsonToToon(payload) {
const response = await fetch("https://toonverter.com/api/convert", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
input_data: JSON.stringify(payload),
direction: "json_to_toon",
}),
});
if (!response.ok) {
throw new Error(`TOON API error: ${response.status}`);
}
const data = await response.json();
return data.output;
}
Validate before the LLM sees it
Call /api/validate with the same payload to ensure malformed JSON or TOON never reaches downstream agents. Responses are lightweight and perfect for guardrails or CI jobs.
Production rollout tips
- Wrap the API with your internal observability (latency + token delta)
- Cache conversions for idempotent responses
- Use the history section in the UI for manual QA spot checks
- Document failure fallbacks (e.g., slide back to JSON if API is unreachable)