API Reference

Access Iconly programmatically. Generate icons, process images, manage your library, and query your account — all via REST API.

Beta — The Iconly API is currently in beta. Endpoints, request formats, and rate limits may change without notice. We recommend pinning to specific behaviors rather than relying on undocumented response fields.

Build with an Agent

Download a skills file to give your AI agent or coding assistant full knowledge of the Iconly API.

Download All Skills (ZIP)

Or fetch via command line:

curl -o iconly-skills.zip https://iconly.ai/docs/api/skills-bundle/

Authentication

All authenticated API requests require an API key passed via the X-API-Key header. API keys use the ik_ prefix.

1

Generate a Key

Go to Settings → API Key in your Iconly dashboard and click Generate API Key. Copy the key immediately — it won't be shown again.

2

Include in Requests

Pass your key in the X-API-Key header with every request:

curl https://iconly.ai/api/tokens/ \ -H "X-API-Key: ik_your_api_key_here"
Key security — Treat your API key like a password. Do not commit it to version control or expose it in client-side code. If compromised, regenerate it immediately from your dashboard.

Base URL & Request Format

All API endpoints are served from:

https://iconly.ai/api/

POST requests must include a JSON body and the Content-Type: application/json header. GET requests use query parameters where applicable.

All responses return JSON with Content-Type: application/json.

Rate Limits

Requests are throttled per user. If you exceed a limit, you'll receive a 429 Too Many Requests response.

Generation Icon, creative, and email generation — 10 requests/min
Processing Recolor, thickness, smooth, crop — 30 requests/min
Upload File uploads — 20 requests/min

Token System

Every generation costs tokens. Your monthly allocation depends on your plan. Check your balance anytime with GET /api/tokens/.

Generation Costs

Base generation 6–8 tokens (depends on AI model used)
Color flag +2 tokens
Medium detail +1 token
High detail +2 tokens
Canvas size ±2 tokens (128px–2048px)
Social creative 12–75 tokens total (12 or 25 per format/copy; multi-format platforms generate 3 sizes)
Email template 12–25 tokens (depends on speed mode)

Free Operations

Recolor, thickness, smoothing, and crop & recenter cost 0 tokens. Smart background removal costs 1 token.

Generate Icon

POST
POST /api/generate-icon/

Generate an icon from a text description. Returns a base64-encoded WebP image.

Request Body

subject required Text description of the icon (e.g. "rocket ship").
style Icon style slug. Can be a base style (line, glyph, outline, pixel, isometric) or a preset style (glassmorphism, neon, photorealistic, clay-3d, etc.). Base styles are monochrome and respect the color parameter. Preset styles have their own built-in prompt, palette, and output size. Default: line
flags Array of flag strings that control generation behavior (e.g. ["color", "detail-high"]). See the Flags table below for all available flags. Flags that add features increase token cost.
template_id UUID of a user-created custom prompt template. When set, the template's saved settings (color, detail level, thickness, smoothing, crop, background removal, flags) override the corresponding request parameters.
preset_id Slug of a built-in preset template (e.g. glassmorphism, neon, clay-3d). Takes priority over style. Get available presets from GET /api/prompt-templates/.
color Hex color code (e.g. #FF5733). Applies to base styles only — preset styles determine their own palette. Default: #000000
model low or high. High uses a premium AI model for better results. Default: low
attached_image Base64 image for AI refinement — send a previous icon back with new instructions. Requires a paid plan.
icon_id UUID of a library icon to use as the attached image for refinement. Alternative to sending attached_image directly — the server fetches the image from your library.
iconify Boolean. When true with attached_image, converts the attached image into an icon in the specified style. Requires a paid plan.
use_as_reference Boolean. When true with attached_image, generates a new icon matching the reference's visual style. Requires a paid plan.

Flags

Pass flags in the flags array to control generation and post-processing behavior. Only one flag per group (detail, bias) can be active at a time — if multiple are provided, the last one wins.

color Allow full color output instead of the default black/white. +2 tokens
detail-low Extremely simple, minimal geometric shapes
detail-medium Moderate detail on the subject. +1 token
detail-high Very high detail on the subject. +2 tokens
allow-text Allow text, letters, or words to appear in the icon (normally suppressed)
ai-bg Generate a background scene or environment instead of a plain white background. Skips background removal.
keep-bg Skip the automatic background removal post-processing step. The raw AI output is returned as-is (after recoloring and canvas sizing).
bias-{color} Bias the output toward a color theme (e.g. bias-blue, bias-red)
{ "subject": "rocket ship", "style": "line", "flags": ["color", "detail-high", "ai-bg"] }

Response

{ "image_data": "base64-encoded WebP image", "remaining_tokens": 293, "monthly_tokens": 280, "bonus_tokens": 13, "token_cap": 300 }

Token Cost

6–8 base tokens, plus modifiers for color, detail level, canvas size, and model tier. See Token System above.

Parameter Precedence

When multiple parameters target the same behavior, the following precedence rules apply:

Template Resolution

Only one template source is used per request, resolved in this order:

  1. preset_id — checked first. If a matching preset exists, it is used.
  2. style — if preset_id is not set, the style value is checked against presets. If it matches a preset slug (e.g. glassmorphism), that preset is used instead of the base style.
  3. template_id — only used if neither preset_id nor a preset-style match was found.
Template Overrides

When a template or preset is active, its saved settings override request parameters:

  • Color mode (color flag) is replaced by the template's use_color setting
  • Detail level flags (detail-low, detail-medium, detail-high) are replaced by the template's detail_level
  • allow-text, ai-bg, keep-bg, and bias-{color} flags are replaced by the template's corresponding settings
  • Post-processing (thickness, smoothing, crop, background removal) uses the template's saved values
Attached Image Modes

When attached_image (or icon_id) is provided, these modes are mutually exclusive and resolved in this order:

  1. iconify: true — converts the image into an icon. Wins over all other modes.
  2. use_as_reference: true — uses the image as a style reference. Only activates if iconify is not set.
  3. Otherwise — treated as a refinement (iterates on the attached icon using the prompt).

All three modes force the premium AI model regardless of the model parameter, and skip template post-processing (thickness, smoothing, crop).

Image Source

attached_image (raw base64) takes priority over icon_id. If both are provided, icon_id is ignored. The server only fetches the library icon when no attached_image is present.

Background Removal

Background removal is applied automatically unless any of these conditions are met:

  • The ai-bg flag is set (keeps the AI-generated background)
  • The keep-bg flag is set (skips removal entirely)
  • A template with background removal set to none is active
Canvas Size

When using use_as_reference, the reference image's dimensions override the template's output_size setting.

Post-Processing

Recolor, thickness, smoothing, and crop endpoints are free (0 tokens). Smart background removal costs 1 token. All accept a base64-encoded image and return a processed base64 WebP.

Recolor

POST /api/recolor/
image_data required Base64-encoded image
color required Hex color code (e.g. #FF5733)

Adjust Thickness

POST /api/adjust-thickness/
image_data required Base64-encoded image
thickness required Integer from -10 (thinner) to 10 (thicker)

Smooth / Sharpen Edges

POST /api/smooth-edges/
image_data required Base64-encoded image
strength required Integer from -10 (sharpen) to 10 (smooth)
algorithm Smoothing algorithm. Options: selective (default), gaussian, morphological, supersample, contour

Crop & Recenter

POST /api/crop-recenter/
image_data required Base64-encoded image
crop_percent required Integer from 0 to 50 — percentage of padding to add around the icon

Response (all free processing endpoints)

{ "image_data": "base64-encoded WebP image" }

Remove Background

POST /api/remove-bg/

Strength-based background removal that removes white/light backgrounds. Free (0 tokens).

image_data required Base64-encoded image
strength required Integer from 0 to 10 — higher values remove more background

Smart Background Remove

POST /api/smart-remove-bg/

AI-powered background removal using Replicate. Costs 1 token per use.

image_data required Base64-encoded image

Response

{ "image_data": "base64-encoded WebP with transparent background", "remaining_tokens": 292 }

Vector Generation

POST /api/generate-vector/

Generate an SVG vector graphic from a text description. Returns raw SVG markup. Costs 18 tokens per generation.

subject required Text description of the vector (max 200 characters)
style simple (default), detailed, duotone, filled, or animated
save Set true to save the vector to your library (default false)
name Custom name for the saved icon (defaults to subject)

Styles

simple Clean stroke-only icon with minimal detail and uniform stroke width
detailed Rich illustration with varied line weights, interior details, and textures
duotone Flat two-color illustration using filled shapes (no strokes)
filled Solid filled shapes with a single accent color and optional thin outlines
animated Stroke icon with looping CSS @keyframes animations embedded in the SVG

Response

{ "success": true, "svg": "<svg viewBox=\"0 0 100 100\" ...>...</svg>", "name": "rocket ship", "remaining_tokens": 482, "icon_id": "uuid-string" }

The icon_id field is only present when save is true. All vectors use a viewBox of 0 0 100 100 and are fully scalable.

Saving to Library

Vectors can also be saved to the library separately via the Library Add endpoint with icon_type: "vector" and svg_data containing the SVG markup.

Library

List Library Icons

GET /api/library/list/

Returns all icons in your personal library, ordered by most recently created.

Response

{ "icons": [ { "id": "uuid", "name": "rocket", "slug": "rocket", "css_class": "ci ci-rocket", "url": "https://cdn.iconly.ai/...", "style": "line", "created_at": "2025-01-15T10:30:00Z", "has_modifications": false, "is_colored": false, "detail_level": "none", "icon_type": "image", "svg_data": null } ] }

Add to Library

POST /api/library/add/
name required Name for the icon (used to generate the CSS class). Duplicates are auto-suffixed.
image_data required* Base64-encoded image. Required when icon_type is image.
icon_type image (default) or vector
svg_data SVG markup string (required when icon_type is vector)
style Icon style slug. Default: line
is_colored Boolean. Whether the icon uses multiple colors. Default: false
detail_level Detail level metadata: none, low, med, high. Default: none

Response

{ "success": true, "css_class": "ci ci-rocket", "icon_id": "uuid", "icon_type": "image", "url": "https://cdn.iconly.ai/..." }

Public Icons

GET /api/public/list/

Browse the public icon library. No authentication required.

Query Parameters

offset Pagination offset. Default: 0
limit Number of results. Default: 100, max: 200
style Filter by style (e.g. line, glyph)
search Search by icon name
colored true or false — filter by color

Response

{ "icons": [ { "id": "uuid", "name": "shopping-cart", "description": "A minimal line-art shopping cart", "style": "line", "tags": "shopping, cart, ecommerce", "is_colored": false, "url": "https://cdn.iconly.ai/...", "webp_url": "https://cdn.iconly.ai/...", "thumb_url": "https://cdn.iconly.ai/...", "css_class": "ci-line ci-shopping-cart", "detail_url": "/icons/line/shopping-cart/" } ], "total": 1250, "has_more": true }

Account & Tokens

Get Token Balance

GET /api/tokens/

Response

{ "monthly_tokens": 280, "bonus_tokens": 20, "total_tokens": 300, "monthly_token_cap": 300, "tier": "pro", "tier_name": "Pro", "total_tokens_used": 1547, "total_images_generated": 312, "is_subscription": true, "has_active_trial": false, "trial_expires_at": null }

Get Account Stats

GET /api/account/stats/

Account information including tier, tokens, and usage statistics.

Response

{ "email": "[email protected]", "username": "yourname", "email_verified": true, "tier": "pro", "tier_name": "Pro", "has_active_trial": false, "trial_expires_at": null, "member_since": "2025-01-15T10:30:00Z", "monthly_tokens": 280, "monthly_token_cap": 300, "bonus_tokens": 20, "total_available_tokens": 300, "total_tokens_used": 1547, "total_images_generated": 312, "library_icon_count": 48, "custom_icon_size": 512 }

Prompt Templates

GET /api/prompt-templates/

List your saved prompt templates, built-in presets, and base styles. Pass a template's id as template_id or a preset's id as preset_id in the generate-icon request to use it.

Query Parameters

all Set to 1 to return all presets and styles, ignoring niche filtering. Default: filtered by your niche preferences.

Response

{ "templates": [ { "id": "uuid", "name": "Thick Outline", "prompt_text": "Bold outline icon with thick strokes...", "use_color": false, "thickness": 3, "smoothing": 2, "crop_percent": 10, "detail_level": "low", "output_size": 512, "bg_removal": "flood", "allow_text": false, "ai_bg": false, "keep_bg": false, "bias_color": "", "order": 0, "is_preset": false } ], "presets": [ { "id": "glassmorphism", "name": "Glassmorphism", "prompt_text": "Frosted glass icon...", "use_color": true, "detail_level": "none", "output_size": 512, "niches": ["apps"], "is_preset": true } ], "styles": [ { "id": "line", "name": "Line Art", "description": "Clean minimalist icons with uniform strokes.", "niches": ["default", "apps"] } ] }

Social Creatives

Pro/Max only — This endpoint requires a Pro or Max subscription.
POST /api/generate-creative/

Generate social media graphics with AI-written copy. Returns HTML creative(s) ready for rendering. Multi-format platforms (Facebook, Instagram) generate 3 size variants; single-size formats support 1–3 copies.

Request Body

platform required Format: facebook, instagram, square, portrait, story, landscape, wide, standard
context required Describe the creative — product, campaign, message
icon_ids Array of icon UUIDs from your library to include
media_assets Array of media asset objects ({id, name, url, width, height}) to include in the design
colors Array of 3 hex color strings (primary, secondary, accent)
model fast (12 tokens/format) or thinking (25 tokens/format). Default: thinking
brand_fonts Array of font name strings to use in the design
reference_media A media asset object ({id, name, url, width, height}) to use as a visual reference for the design
refine_layout Boolean. When true, runs a second AI pass to fix text overlaps and layout issues. Default: false
num_copies Number of independent creative copies to generate (1–3). Only applies to single-size formats. Default: 1

Token Cost

Base cost per format/copy: 12 (fast) or 25 (thinking). Multi-format platforms (Facebook, Instagram) generate 3 sizes at 3× base cost. Single-size formats with multiple copies multiply accordingly. Range: 12–75 tokens.

Response

{ "id": "uuid", "creatives": ["<div class='creative'>...</div>"], "text_content": "Generated copy text", "ad_copy": {"headline": "...", "body": "...", "cta": "..."} }

Email Templates

Pro/Max only — This endpoint requires a Pro or Max subscription.
POST /api/generate-email/

Generate a responsive HTML email template with AI. Returns production-ready HTML.

Request Body

email_type required Type: newsletter, promotional, welcome, transactional, announcement, event_invite
context required Describe the email content and purpose
icon_ids Array of icon UUIDs from your library to embed
media_assets Array of media asset objects ({id, name, url, width, height}) to include
colors Array of 3 hex color strings (primary, secondary, accent)
model fast (12 tokens) or thinking (25 tokens). Default: thinking
brand_fonts Array of font name strings to use in the template
reference_media A media asset object to use as a visual reference for the design

Response

{ "id": "uuid", "creatives": ["<!DOCTYPE html><html>...</html>"], "text_content": "Generated email copy", "ad_copy": {"subject": "...", "preview": "...", "body": "..."} }

Brands

Max only — Brand endpoints require a Max subscription (API key access).

Create and manage brand profiles to apply consistent branding across social creatives and email templates. Pass brand colors, fonts, and context when generating creatives.

List Brands

GET /api/brands/

Response

{ "brands": [ { "id": "uuid", "name": "My Brand", "domain": "mybrand.com", "description": "A short brand description", "aesthetic": "Clean, modern, minimal", "colors": {"primary": "#1a1a2e", "secondary": "#16213e", "accent": "#0f3460"}, "logo_url": "https://...", "products": ["Product A", "Product B"], "features": ["Feature 1", "Feature 2"], "fonts": ["Inter", "Playfair Display"], "links": [{"text": "About", "url": "/about"}], "contact": {"email": "[email protected]"}, "crawl_url": "https://mybrand.com", "crawled_at": "2026-01-15T12:00:00Z" } ] }

Create Brand

POST /api/brands/

Request Body

name required Brand name (must be unique per account)
url Website URL to crawl. If provided, the brand is created and automatically crawled in one step (costs 10 tokens). Returns populated brand data plus discovered_media.
domain Website domain (e.g. mybrand.com)
description Short brand description
colors Object with primary, secondary, accent hex color strings
fonts Array of font name strings
logo_url URL to brand logo image
aesthetic Visual aesthetic description (e.g. “Clean, modern, minimal”)
products Array of product/service names
features Array of key brand features

Get / Update / Delete Brand

GET /api/brands/{brand_id}/ PUT /api/brands/{brand_id}/ DELETE /api/brands/{brand_id}/

PUT accepts the same fields as create. DELETE removes the brand permanently.

Crawl Brand Website

POST /api/brands/{brand_id}/crawl/

Crawl a website to auto-populate brand data (colors, fonts, products, aesthetic, etc.). Costs 10 tokens. Can also be triggered during creation by passing url to POST /api/brands/.

url required Website URL to crawl

Response

{ "brand": { ... }, "discovered_media": [ {"url": "https://...", "alt": "Hero image", "is_logo": false} ] }

Using Brands with Creatives

When generating social creatives or email templates, include brand data in your request:

# 1. Fetch your brand brand = GET /api/brands/{brand_id}/ # 2. Include brand context in generate-creative POST /api/generate-creative/ { "platform": "instagram", "context": "Brand: My Brand\nWebsite: mybrand.com\nBrand Info: ...\n\nYour creative description here", "colors": ["#1a1a2e", "#16213e", "#0f3460"], "brand_fonts": ["Inter", "Playfair Display"] }

HTML Screenshot

Max only — This endpoint requires a Max subscription.
POST /api/html-screenshot/

Render HTML to a PNG or WebP image using Playwright. Designed for converting social creatives and email templates to images, but works with any HTML. Optionally capture a specific element using a CSS selector.

Request Body

html required HTML content to render
width Viewport width in pixels (1–4096). Default: 1080
height Viewport height in pixels (1–4096). Default: 1080
scale Device scale factor (1–4). Default: 2 (2× resolution)
format png or webp. Default: png
selector CSS selector to capture a specific element instead of the full page (e.g. #card, .hero-section)

Response

{ "image": "data:image/png;base64,..." }

Example: Convert a Social Creative to PNG

# 1. Generate a creative creative = POST /api/generate-creative/ html = creative["creatives"][0] # 2. Convert to image POST /api/html-screenshot/ { "html": html, "width": 1080, "height": 1080, "scale": 2, "format": "png" }

Error Handling

All errors return a JSON object with an error field:

{ "error": "Insufficient tokens" }

Status Codes

200 Success
400 Bad request — missing or invalid parameters
401 Unauthorized — missing or invalid API key
403 Forbidden — insufficient tokens, wrong tier, or unverified account
404 Not found — resource doesn't exist
429 Rate limited — too many requests, wait and retry
500 Server error — try again or contact support

Code Examples

Python

import requests import base64 API_KEY = "ik_your_api_key_here" BASE = "https://iconly.ai/api" # Generate an icon resp = requests.post(f"{BASE}/generate-icon/", json={ "subject": "rocket ship", "style": "line", "color": "#000000", "flags": ["color", "detail-high"] }, headers={"X-API-Key": API_KEY}) data = resp.json() image_bytes = base64.b64decode(data["image_data"]) with open("rocket.webp", "wb") as f: f.write(image_bytes) print(f"Tokens remaining: {data['remaining_tokens']}")

JavaScript

const API_KEY = "ik_your_api_key_here"; const BASE = "https://iconly.ai/api"; // Generate an icon const resp = await fetch(`${BASE}/generate-icon/`, { method: "POST", headers: { "Content-Type": "application/json", "X-API-Key": API_KEY, }, body: JSON.stringify({ subject: "rocket ship", style: "line", color: "#000000", flags: ["color", "detail-high"], }), }); const data = await resp.json(); console.log(`Tokens remaining: ${data.remaining_tokens}`); // Display the image const img = document.createElement("img"); img.src = `data:image/webp;base64,${data.image_data}`; document.body.appendChild(img);

curl

# Check token balance curl https://iconly.ai/api/tokens/ \ -H "X-API-Key: ik_your_api_key_here" # Generate an icon with flags curl -X POST https://iconly.ai/api/generate-icon/ \ -H "Content-Type: application/json" \ -H "X-API-Key: ik_your_api_key_here" \ -d '{"subject": "rocket ship", "style": "line", "flags": ["color"]}' # Generate without background removal curl -X POST https://iconly.ai/api/generate-icon/ \ -H "Content-Type: application/json" \ -H "X-API-Key: ik_your_api_key_here" \ -d '{"subject": "rocket ship", "style": "line", "flags": ["keep-bg"]}' # Recolor an icon (free) curl -X POST https://iconly.ai/api/recolor/ \ -H "Content-Type: application/json" \ -H "X-API-Key: ik_your_api_key_here" \ -d '{"image_data": "base64...", "color": "#3b82f6"}'