API Documentation

Complete guide to using the JSON to TOON Converter API

Authentication
All API requests require authentication using an API key

Getting Your API Key

  1. Sign up for an account
  2. Verify your email address
  3. Go to your dashboard
  4. Create an API key
  5. Copy and securely store your API key

Using Your API Key

Include your API key in the Authorization header:

Authorization: Bearer sk_your_api_key_here
Pricing
Token-based pricing model

Free Tier

10,000 tokens per month (resets monthly)

Pricing Model

  • 1 million tokens = $2
  • Tokens never expire
Endpoints
Available API endpoints

POST /api/v1/json-to-toon

Convert JSON to TOON format

Request Examples

curl -X POST https://toonconverter.app/api/v1/json-to-toon \
  -H "Authorization: Bearer sk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "json": "{\"name\": \"John\", \"age\": 30}"
  }'

Response

{
  "toon": "name: John\nage: 30",
  "originalTokens": 15,
  "toonTokens": 8,
  "tokensSaved": 7,
  "percentageSaved": 46.67,
  "tokensUsed": 8,
  "freeTierUsed": true
}
Rate Limits
API usage limits

100 requests per minute per API key

Rate limit headers are included in responses:

  • X-RateLimit-Limit: Maximum requests allowed
  • X-RateLimit-Remaining: Remaining requests
  • X-RateLimit-Reset: Reset timestamp
Payload Limits
Request size restrictions
  • Maximum payload size: 10MB
  • Maximum tokens per request: 100,000
  • Request timeout: 30 seconds
Error Handling
Common error responses and how to handle them

400 Bad Request

Invalid request format or conversion failed

{
  "error": "Conversion failed",
  "message": "Invalid JSON format"
}

401 Unauthorized

Missing or invalid API key

{
  "error": "Unauthorized",
  "message": "Invalid or missing API key"
}

402 Payment Required

Insufficient tokens

{
  "error": "Insufficient tokens",
  "message": "You need 1000 tokens but only have 500"
}

413 Payload Too Large

Request exceeds size limits

{
  "error": "Payload too large",
  "message": "Maximum payload size is 10MB"
}

429 Too Many Requests

Rate limit exceeded

{
  "error": "Rate limit exceeded",
  "message": "Too many requests. Please try again later."
}

500 Internal Server Error

Server error occurred

{
  "error": "Internal server error",
  "message": "An error occurred while processing your request"
}

Error Handling Example (Python)

import requests

try:
    response = requests.post(url, headers=headers, json=data)
    response.raise_for_status()  # Raises exception for 4xx/5xx
    result = response.json()
except requests.exceptions.HTTPError as e:
    error_data = e.response.json()
    print(f"Error {e.response.status_code}: {error_data.get('message')}")
except requests.exceptions.RequestException as e:
    print(f"Request failed: {e}")