API Documentation& Developer Guide

Integrate SatireGen's powerful satirical comic generation capabilities into your applications with our comprehensive API and developer tools.

API Visualization

Getting Started

Welcome to the SatireGen API! Our powerful API allows you to integrate automated satirical comic generation into your applications, websites, or services.

Quick Start

  1. Sign up for an API key
  2. Read the documentation
  3. Make your first API call
  4. Integrate into your app

Features

  • Real-time comic generation
  • Multiple character archetypes
  • Customizable styles
  • Batch processing support

Authentication

All API requests require authentication using an API key. Include your API key in the Authorization header of each request.

// Example Authorization header
Authorization: Bearer YOUR_API_KEY

Security Note

Keep your API key secure and never expose it in client-side code. Store it securely on your server.

API Endpoints

Generate Comic

POST
https://api.satiregen.com/v1/comics/generate

Generate a new satirical comic strip from news content.

Parameters
  • text (string) - News content
  • characters (array) - Character types
  • style (string) - Visual style
  • format (string) - Output format
Response
  • comic_id - Unique identifier
  • image_url - Comic image URL
  • narrative - Satirical text
  • created_at - Timestamp

Get Comic Status

GET
https://api.satiregen.com/v1/comics/{comic_id}

Check the status of a comic generation request.

Parameters
  • text (string) - News content
  • characters (array) - Character types
  • style (string) - Visual style
  • format (string) - Output format
Response
  • comic_id - Unique identifier
  • image_url - Comic image URL
  • narrative - Satirical text
  • created_at - Timestamp

Batch Generation

POST
https://api.satiregen.com/v1/comics/batch

Generate multiple comics in a single request.

Parameters
  • text (string) - News content
  • characters (array) - Character types
  • style (string) - Visual style
  • format (string) - Output format
Response
  • comic_id - Unique identifier
  • image_url - Comic image URL
  • narrative - Satirical text
  • created_at - Timestamp

Request Format

Basic Request Structure

// POST /v1/comics/generate
Content-Type:
application/json
Authorization:
Bearer YOUR_API_KEY
// Request Body
{
"text": "Bitcoin prices surge 300% after celebrity tweet...",
"characters": ["santa", "executive"],
"style": "editorial",
"format": "png"
}

Parameter Details

ParameterTypeRequiredDescription
textstringYesNews content or topic (50-2000 chars)
charactersarrayNoCharacter types: santa, executive, hidden
stylestringNoVisual style: editorial, modern, abstract
formatstringNoOutput format: png, jpeg, webp

Response Format

Success Response

// HTTP 200 OK
{
"success": true,
"data": {
"comic_id": "cmc_12345abcdef",
"status": "processing",
"progress": 0,
"estimated_time": 30,
"created_at": "2025-01-15T10:30:00Z"
}
}

Completed Response

// HTTP 200 OK - Completed
{
"success": true,
"data": {
"comic_id": "cmc_12345abcdef",
"status": "completed",
"image_url": "https://cdn.satiregen.com/comics/cmc_12345abcdef.png",
"narrative": "In the wild world of crypto...",
"panels": [
{ "panel": 1, "description": "..." },
{ "panel": 2, "description": "..." },
{ "panel": 3, "description": "..." },
{ "panel": 4, "description": "..." }
],
"created_at": "2025-01-15T10:30:00Z"
}
}

Code Examples

JSJavaScript/Node.js


// Using fetch API
const generateComic = async (newsText) => {
  const response = await fetch('https://api.satiregen.com/v1/comics/generate', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: JSON.stringify({
      text: newsText,
      characters: ['santa', 'executive'],
      style: 'editorial'
    })
  });
  const data = await response.json();
  return data;
};

PYPython


# Using requests library
import requests
import json

def generate_comic(news_text):
    url = 'https://api.satiregen.com/v1/comics/generate'
    headers = {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_API_KEY'
    }
    data = {
        'text': news_text,
        'characters': ['santa', 'executive'],
        'style': 'editorial'
    }
    response = requests.post(url, headers=headers, json=data)
    return response.json()

PHPPHP


// Using cURL
function generateComic($newsText) {
  $url = 'https://api.satiregen.com/v1/comics/generate';
  $data = array({
    'text' => $newsText,
    'characters' => array('santa', 'executive'),
    'style' => 'editorial'
  });
  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
  curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Authorization: Bearer YOUR_API_KEY'));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $response = curl_exec($ch);
  curl_close($ch);
  return json_decode($response, true);
}

Error Handling

The API uses standard HTTP status codes and returns detailed error information in JSON format.

// Error Response Example
{
"success": false,
"error": {
"code": "INVALID_REQUEST",
"message": "The provided text is too short. Minimum 50 characters required.",
"details": {
"field": "text",
"provided_length": 25,
"minimum_length": 50
}
}
}

Common Error Codes

CodeHTTP StatusDescription
INVALID_REQUEST400Request validation failed
UNAUTHORIZED401Invalid or missing API key
RATE_LIMIT_EXCEEDED429Too many requests
COMIC_NOT_FOUND404Comic ID not found
INTERNAL_ERROR500Server error

Rate Limits

Rate limits are enforced to ensure fair usage and system stability. Limits are based on your subscription plan.

Free

10
requests/minute

Pro

100
requests/minute

Enterprise

1000
requests/minute
Rate Limit Headers
  • X-RateLimit-Limit - Request limit per window
  • X-RateLimit-Remaining - Requests remaining
  • X-RateLimit-Reset - Reset timestamp

Webhooks

Receive real-time notifications when comic generation is complete by configuring webhooks.

Webhook Payload

{
"event": "comic.completed",
"timestamp": "2025-01-15T10:35:00Z",
"data": {
"comic_id": "cmc_12345abcdef",
"status": "completed",
"image_url": "https://cdn.satiregen.com/comics/cmc_12345abcdef.png",
"narrative": "Satirical narrative text..."
}
}

Webhook Events

  • comic.completed - Comic generation finished
  • comic.failed - Comic generation failed
  • batch.completed - Batch processing finished