Public API Reference

Comprehensive API documentation for SVGMaker. Learn how to generate, edit, and convert SVGs using our public API.

Getting Started

Start building with SVGMaker API in minutes

Generate SVGs

Create stunning vector graphics from text descriptions using advanced AI

Edit Images

Transform existing images and SVGs with AI-powered modifications

Convert to SVG

Convert raster images (PNG, JPEG) to scalable vector format

Base URL

https://svgmaker.io/api

All API endpoints are relative to this base URL

Quick Start Guide

1

Get Your API Key

Sign up at SVGMaker and generate your API key

2

Make Your First Request

Generate your first SVG with a simple API call

Terminal
curl -X POST https://svgmaker.io/api/generate \
  -H "Content-Type: application/json" \
  -H "x-api-key: svgmaker-io{your-api-key}" \
  -d '{
    "prompt": "A simple geometric logo with blue and white colors",
    "quality": "medium"
  }'
3

Get Your SVG

Receive a high-quality SVG file ready for use

JSON Response
{
  "svgUrl": "https://storage.googleapis.com/.../generated.svg",
  "creditCost": 2,
  "quality": "medium"
}

You're Ready!

Your first SVG is just an API call away. Explore the endpoints below to unlock the full power of SVGMaker.

Authentication

Secure your API requests with API key authentication

API Key Header

All API endpoints require authentication via an API key passed in the x-api-key header.

x-api-key: svgmaker-io{your-api-key}

Security Best Practices

Keep your API key secure and never share it publicly

Store API keys in environment variables, not in your code

Rotate your API keys regularly for enhanced security

Monitor your API usage to detect any unauthorized access

Credit System

Understand how credits work and choose the right plan for your needs

Credit Pricing

OperationQualityCreditsDescription
ConvertNA1 creditConvert raster images to SVG
GenerateLow1 creditBasic quality SVG generation
GenerateMedium2 creditsStandard quality SVG generation
GenerateHigh4 creditsPremium quality SVG generation
EditNA3 creditsAI-powered image/SVG editing

Core API Endpoints

Explore the main API endpoints for generating, editing, and converting SVGs

Generate SVG

Create stunning SVG graphics from text descriptions using advanced AI technology.

Method
POST
Endpoint
/api/generate
Credits
1-4depending on quality
Headers
HTTP Headers
Content-Type: application/json
x-api-key: svgmaker-io{your-api-key}
Request Body
JSON Schema
{
  "prompt": "string",
  "quality": "low|medium|high",
  "aspectRatio": "auto|portrait|landscape|square|wide|tall",
  "background": "auto|transparent|opaque",
  "stream": "boolean",
  "base64Png": "boolean",
  "svgText": "boolean",
  "styleParams": {
    "style": "string",
    "color_mode": "string",
    "image_complexity": "string",
    "category": "string",
    "composition": "string",
    "advanced": {
      "stroke_weight": "thin|medium|thick",
      "corner_style": "none|rounded|sharp",
      "shadow_effect": "none|soft|hard"
    }
  }
}
Example Request
Terminal
curl -X POST https://svgmaker.io/api/generate \
  -H "Content-Type: application/json" \
  -H "x-api-key: svgmaker-io{your-api-key}" \
  -d '{
    "prompt": "A minimalist mountain landscape with geometric shapes",
    "quality": "high",
    "aspectRatio": "landscape",
    "background": "transparent",
    "base64Png": true,
    "svgText": true,
    "styleParams": {
      "style": "minimalist",
      "color_mode": "monochrome",
      "composition": "center-object"
    }
  }'
Example Response
JSON Response
{
  "svgUrl": "https://storage.googleapis.com/your-bucket/generated-svg.svg",
  "creditCost": 4,
  "base64Png": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
  "svgText": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1024 1024\">...</svg>",
  "prompt": "A minimalist mountain landscape with geometric shapes",
  "quality": "high",
  "revisedPrompt": "A minimalist mountain landscape featuring clean geometric mountain shapes..."
}

Edit SVG/Image

Transform existing images and SVGs with AI-powered modifications and enhancements.

Method
POST
Endpoint
/api/edit
Credits
3 credits
Headers
HTTP Headers
Content-Type: multipart/form-data
x-api-key: svgmaker-io{your-api-key}
Request Body (Form Data)
FieldTypeRequiredDescription
imageFileYesImage file to edit (PNG, JPEG, WebP, SVG)
promptstringYesEdit instructions as a simple text string
styleParamsstringNoJSON string containing style parameters
qualitystringNoQuality level: "low", "medium", "high" (default: "medium")
aspectRatiostringNoAspect ratio: "auto", "portrait", "landscape", "square", "wide", "tall" (default: "auto")
backgroundstringNoBackground: "auto", "transparent", "opaque" (default: "auto")
streambooleanNoEnable streaming response (default: false)
base64PngbooleanNoInclude base64-encoded PNG preview in response (default: false)
svgTextbooleanNoInclude SVG source code as text in response (default: false)
Example Request
Terminal
curl -X POST https://svgmaker.io/api/edit \
  -H "x-api-key: svgmaker-io{your-api-key}" \
  -F "image=@input-image.png" \
  -F "prompt=Add a golden frame around this image" \
  -F "quality=medium" \
  -F "aspectRatio=square" \
  -F "background=transparent" \
  -F "base64Png=true" \
  -F "svgText=true"
Example Response
JSON Response
{
  "svgUrl": "https://storage.googleapis.com/your-bucket/edited-svg.svg",
  "originalImageUrl": "https://storage.googleapis.com/your-bucket/original-image.png",
  "creditCost": 3,
  "base64Png": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
  "svgText": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1024 1024\">...</svg>",
  "prompt": "Add a golden frame around this image",
  "quality": "medium"
}

Convert Image to SVG

Transform raster images into scalable vector graphics with AI-powered conversion.

Method
POST
Endpoint
/api/convert
Credits
1 credit
Headers
HTTP Headers
Content-Type: multipart/form-data
x-api-key: svgmaker-io{your-api-key}
Request Body (Form Data)
FieldTypeRequiredDescription
fileFileYesImage file to convert (PNG, JPEG, WebP, etc.)
streambooleanNoEnable streaming response (default: false)
svgTextbooleanNoInclude SVG source code as text in response (default: false)
Example Request
Terminal
curl -X POST https://svgmaker.io/api/convert \
  -H "x-api-key: svgmaker-io{your-api-key}" \
  -F "file=@image-to-convert.png" \
  -F "stream=false" \
  -F "svgText=true"
Example Response
JSON Response
{
  "svgUrl": "https://storage.googleapis.com/bucket-name/converted-svg.svg",
  "originalImageUrl": "https://storage.googleapis.com/bucket-name/original-image.png",
  "creditCost": 1,
  "quality": "medium",
  "svgText": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1024 1024\">...</svg>"
}

Advanced Features

Unlock powerful capabilities with streaming, custom formats, and style parameters

Streaming Responses

When stream=true is set, responses are sent as Server-Sent Events (SSE) for real-time updates.

Content Type
HTTP Header
Content-Type: text/event-stream
Stream Event Types
Stream Events
{"status": "processing", "message": "Received request..."}
{"status": "processing", "message": "Generating image..."}
{"status": "processing", "message": "Processing SVG paths..."}
{"status": "complete", "svgUrl": "https://...", "simulationMode": false}
Error in Stream
Error Event
{"status": "error", "error": "Error message", "errorType": "general_error"}

Response Format Options

Base64 PNG Output (base64Png)

When base64Png=true is included in requests to /api/generate or /api/edit, the response will include a base64Png field containing a base64-encoded PNG preview of the generated SVG.

JSON Response
{
  "svgUrl": "https://...",
  "base64Png": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
  "creditCost": 2
}
SVG Source Code Output (svgText)

When svgText=true is included in requests to any endpoint, the response will include a svgText field containing the raw SVG source code.

JSON Response
{
  "svgUrl": "https://...",
  "svgText": "<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024">...</svg>",
  "creditCost": 2
}

SDK Documentation

Integrate SVGMaker into your applications with our official SDKs

Node.js SDK

Installation
Terminal
npm install svgmaker-sdk-node
Basic Usage
JavaScript
import SVGMakerClient from 'svgmaker-sdk-node';

// Initialize the client
const client = new SVGMakerClient('svgmaker-io{your-api-key}');

// Generate an SVG
const result = await client.generate({
  prompt: 'A geometric mountain landscape',
  quality: 'high',
  styleParams: {
    style: 'minimalist',
    color_mode: 'monochrome'
  },
  base64Png: true,
  svgText: true
});

console.log(result.svgUrl);
API Methods
Generate SVG

Create SVGs from text prompts

Edit SVG/Image

Modify existing images

Convert Image to SVG

Convert raster to vector

Configuration Options
JavaScript
const client = new SVGMakerClient('svgmaker-io{your-api-key}', {
  baseUrl: 'https://svgmaker.io/api',
  timeout: 30000,
  retries: 3,
  rateLimit: {
    requestsPerMinute: 60
  }
});
Error Handling
JavaScript
try {
  const result = await client.generate({
    prompt: 'A beautiful landscape'
  });
} catch (error) {
  if (error.code === 'INSUFFICIENT_CREDITS') {
    console.log('You need more credits');
  } else if (error.code === 'RATE_LIMITED') {
    console.log('Rate limit exceeded');
  } else {
    console.log('An error occurred:', error.message);
  }
}

Built-in Security

Automatic API key management

Request validation and sanitization

Secure error handling

Performance Features

Automatic retry logic

Rate limiting protection

Connection pooling

Why Use Our SDK?

Type Safety

Full TypeScript support with comprehensive type definitions

Easy Integration

Simple API that matches your existing code patterns

Active Support

Regular updates and community-driven improvements

Error Handling

Handle errors gracefully with proper status codes and error messages

HTTP Status Codes

Status CodeDescriptionAction Required
200SuccessProcess response normally
400Bad Request - Invalid parametersCheck request parameters
401Unauthorized - Invalid or missing API keyVerify API key
402Payment Required - Insufficient creditsPurchase more credits
413Payload Too Large - File size exceeds limitReduce file size
429Too Many Requests - Rate limit exceededImplement backoff strategy
500Internal Server ErrorRetry later

Common Error Examples

Insufficient Credits
JSON Error
{
  "error": "Insufficient credits",
  "creditsRequired": 4
}
Content Safety Rejection
JSON Error
{
  "error": "Content that is not allowed by our safety system",
  "errorType": "content_safety"
}
File Too Large
JSON Error
{
  "error": "File size exceeds 25 MB limit"
}
Invalid File Format (Convert)
JSON Error
{
  "error": "SVG files are already in vector format and do not need conversion"
}

Error Handling Best Practices

Always check status codes before processing responses

Handle rate limits by implementing exponential backoff

Validate file formats before uploading

Check credit balance before making requests

Implement retry logic for transient errors

Log errors for debugging and monitoring

Support

Get help and resources to make the most of SVGMaker API

Contact Information

Email Support

Get direct help from our technical team

Contact Support

Chat Support

Get instant help from our technical team

Chat Support

Learning Resources

Blog Articles

Learn from our detailed guides and tutorials

Read Blogs