Text to SVG Generation
Generate SVG graphics from text descriptions using AI models.
Batch Processing
Process multiple requests in sequence with different parameters.
Batch Configuration (JSON):
[
{
"mode": "text2svg_flux",
"prompt": "red circle",
"steps": 20,
"cfg_scale": 7.5,
"seed": 12345,
"denoise": 1.0,
"remove_bg": 1,
"contiguous_bg_removal": 1,
"max_colors": 16
},
{
"mode": "text2svg_flux",
"prompt": "blue square",
"steps": 25,
"cfg_scale": 8.0,
"seed": 54321,
"denoise": 1.0,
"remove_bg": 1,
"contiguous_bg_removal": 1,
"max_colors": 16
}
]
Process Batch
📚 API Documentation
Complete reference for the DiffSVG Microservice REST API.
🎨 POST /generate
Primary endpoint - Generate SVG content from text prompts or convert images to SVG.
Select Prompt Template for Examples:
Custom Request (Basic)
Text to SVG Template
Text to SVG Flux Template
Image to SVG Template
📥 Request Format:
Note: The kwargs object contains workflow parameters that are passed to the ComfyUI workflow. Any parameter with a corresponding GenericInputNode label in the workflow can be included as a kwarg. Common parameters include positive_prompt, negative_prompt, steps, cfg_scale, seed, denoise, remove_bg, contiguous_bg_removal, and max_colors.
{
"mode": "text2svg_flux",
"prompt_style": "vector",
"kwargs": {
"positive_prompt": "simple red circle on white background",
"steps": 20,
"cfg_scale": 7.5,
"seed": 12345,
"denoise": 1.0,
"remove_bg": 1
},
"base_image": "data:image/jpeg;base64,..." // Only for img2svg mode
}
📤 Response Format:
{
"execution_time": 2.34,
"svgs": ["... ", ...], // SVG files (categorized)
"eps": ["%!PS-Adobe...", ...], // EPS/PostScript files
"unknown_texts": ["...", ...], // Other text formats
"images": ["data:image/png;base64,..."] // PNG images
}
🌐 CURL Example:
curl -X POST http://127.0.0.1:8000/generate \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"mode": "text2svg_flux",
"prompt_style": "vector",
"kwargs": {
"positive_prompt": "simple red circle on white background",
"steps": 20,
"cfg_scale": 7.5,
"seed": 12345,
"denoise": 1.0,
"remove_bg": 1
}
}'
🎭 GET /prompt-styles
Discovery endpoint - Get available prompt styles, API templates, and their parameters.
📤 Response Format:
{
"prompt_styles": ["embroidery", "vector", "foil_stamp", "laser_engraving", "screen_print", "stencil", "vector_logo"],
"api_prompts": ["text2svg", "text2svg_flux", "img2svg"],
"prompt_style_details": {
"embroidery": "Embroidery patch style with flat colors and bold outlines",
"vector": "Clean minimal vector style with bold lines and simple shapes",
"foil_stamp": "Metallic foil stamping effect with raised appearance"
},
"api_prompt_details": {
"text2svg": "Standard text-to-SVG generation workflow",
"text2svg_flux": "Advanced text-to-SVG using Flux model for higher quality",
"img2svg": "Convert existing images to SVG format"
},
"api_prompt_parameters": {
"text2svg_flux": {
"steps": 20,
"cfg_scale": 8,
"denoise": 1,
"positive_prompt": "(centered, simple design, flat colors:1.1)..."
}
}
}
🌐 CURL Example:
curl -X GET http://127.0.0.1:8000/prompt-styles
✅ Public endpoint - No authentication required
⏱️ GET /rate-limit-status
Rate limit monitoring - Check your current rate limit status and remaining quota.
📤 Response Format:
{
"limit": 10,
"window_seconds": 60,
"current_usage": 3,
"remaining": 7,
"reset_time": "2024-01-15T10:30:00Z"
}
🌐 CURL Example:
curl -X GET http://127.0.0.1:8000/rate-limit-status \
-H "Authorization: Bearer YOUR_API_KEY"
🔒 Requires authentication
🔄 POST /reload-prompts
Development endpoint - Reload API prompt templates from disk (useful during development).
📤 Response Format:
{
"status": "success",
"message": "API prompts reloaded successfully"
}
🌐 CURL Example:
curl -X POST http://127.0.0.1:8000/reload-prompts \
-H "Authorization: Bearer YOUR_API_KEY"
🔒 Requires authentication
🔐 Authentication
Most endpoints require API key authentication via the Authorization header:
Authorization: Bearer YOUR_API_KEY
Public endpoints: /prompt-styles
Protected endpoints: /generate, /rate-limit-status, /reload-prompts
🚦 Rate Limiting
The API implements sliding window rate limiting with the following response headers:
X-RateLimit-Limit: 10
X-RateLimit-Remaining: 9
X-RateLimit-Reset: 1640995200
Default limits: 10 requests per 60-second window (configurable via environment variables)
📋 HTTP Status Codes
The API returns standard HTTP status codes:
200 OK - Request successful
400 Bad Request - Invalid parameters or malformed request
401 Unauthorized - Missing or invalid API key
429 Too Many Requests - Rate limit exceeded
500 Internal Server Error - Server-side processing error