Login
Back to Blog
"Recraft API Tutorial: Professional AI Design and Image Generation"

"Recraft API Tutorial: Professional AI Design and Image Generation"

C
Crazyrouter Team
February 22, 2026
38 viewsEnglishTutorial
Share:

Recraft has carved out a unique niche in the AI image generation space by focusing on what designers actually need: clean vector graphics, consistent brand assets, and production-ready designs. Unlike general-purpose image generators, Recraft is built for professional design workflows. This guide shows you how to use its API.

What is Recraft?#

Recraft is an AI design tool that generates professional-quality images with a focus on:

  • Vector graphics (SVG): Clean, scalable vector output — not just raster images
  • Brand consistency: Generate assets that match your brand colors and style
  • Icon generation: Create icon sets with consistent style
  • Illustration styles: Multiple curated styles from flat design to 3D
  • Text rendering: Accurate text placement in designs
  • Background removal: Built-in transparent background support

What sets Recraft apart from DALL-E or Midjourney is its focus on usable design assets rather than artistic images.

Recraft vs Other Image Generation Tools#

FeatureRecraftDALL-E 3MidjourneyIdeogram
Vector output (SVG)✅ Native❌ No❌ No❌ No
Icon generation✅ Excellent⚠️ Basic⚠️ Basic⚠️ Basic
Brand colors✅ Yes❌ No❌ No❌ No
Text in images✅ Excellent✅ Good⚠️ Fair✅ Excellent
Transparent BG✅ Native❌ No❌ No❌ No
Style consistency✅ Excellent⚠️ Variable⚠️ Variable⚠️ Variable
Photorealism⚠️ Good✅ Excellent✅ Excellent✅ Good
API available✅ Yes✅ Yes⚠️ Unofficial✅ Yes

Getting Started with Recraft API#

Authentication#

bash
# Get your API key from https://www.recraft.ai/
# API base URL: https://external.api.recraft.ai/v1

Generate a Raster Image#

python
import requests
import json

API_KEY = "your-recraft-api-key"
BASE_URL = "https://external.api.recraft.ai/v1"

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

# Generate a raster image
response = requests.post(
    f"{BASE_URL}/images/generations",
    headers=headers,
    json={
        "prompt": "A modern tech company logo with abstract geometric shapes, blue and purple gradient",
        "style": "digital_illustration",
        "model": "recraftv3",
        "size": "1024x1024"
    }
)

result = response.json()
image_url = result["data"][0]["url"]
print(f"Image URL: {image_url}")

Generate Vector Graphics (SVG)#

This is Recraft's killer feature:

python
# Generate SVG vector output
response = requests.post(
    f"{BASE_URL}/images/generations",
    headers=headers,
    json={
        "prompt": "A set of 4 flat design icons: cloud, lock, gear, chart — consistent line weight, minimal style",
        "style": "icon",
        "model": "recraftv3",
        "response_format": "svg",
        "size": "1024x1024"
    }
)

result = response.json()
svg_content = result["data"][0]["url"]  # or b64_json for inline SVG

# Save as SVG file
with open("icons.svg", "w") as f:
    f.write(svg_content)

Generate with Brand Colors#

python
# Create a style with your brand colors first
style_response = requests.post(
    f"{BASE_URL}/styles",
    headers=headers,
    json={
        "style": "digital_illustration",
        "colors": [
            {"rgb": [66, 133, 244]},   # Google Blue
            {"rgb": [234, 67, 53]},     # Google Red
            {"rgb": [251, 188, 4]},     # Google Yellow
            {"rgb": [52, 168, 83]}      # Google Green
        ]
    }
)

style_id = style_response.json()["id"]

# Generate using your brand style
response = requests.post(
    f"{BASE_URL}/images/generations",
    headers=headers,
    json={
        "prompt": "A friendly robot mascot waving hello",
        "style_id": style_id,
        "model": "recraftv3",
        "size": "1024x1024"
    }
)

Node.js Example#

javascript
const axios = require('axios');

const API_KEY = 'your-recraft-api-key';
const BASE_URL = 'https://external.api.recraft.ai/v1';

async function generateDesign(prompt, options = {}) {
  const response = await axios.post(
    `${BASE_URL}/images/generations`,
    {
      prompt,
      style: options.style || 'digital_illustration',
      model: 'recraftv3',
      size: options.size || '1024x1024',
      response_format: options.format || 'url',
      ...options
    },
    {
      headers: {
        'Authorization': `Bearer ${API_KEY}`,
        'Content-Type': 'application/json'
      }
    }
  );

  return response.data;
}

// Generate an icon set
generateDesign(
  'A navigation icon set: home, search, profile, settings, notifications — flat design, 2px stroke',
  { style: 'icon', format: 'svg' }
).then(result => {
  console.log('SVG URL:', result.data[0].url);
});

// Generate a marketing banner
generateDesign(
  'A SaaS product hero banner showing a dashboard with analytics charts, modern flat design, blue theme',
  { size: '1536x1024' }
).then(result => {
  console.log('Banner URL:', result.data[0].url);
});

cURL Example#

bash
# Generate a vector icon
curl -X POST https://external.api.recraft.ai/v1/images/generations \
  -H "Authorization: Bearer your-recraft-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A minimalist cloud computing icon, single color, clean lines",
    "style": "icon",
    "model": "recraftv3",
    "response_format": "svg",
    "size": "1024x1024"
  }'

Available Styles#

Style IDDescriptionBest For
realistic_imagePhotorealistic generationProduct mockups, stock photos
digital_illustrationClean digital artMarketing materials, blog images
vector_illustrationFlat vector styleInfographics, presentations
iconIcon generationUI icons, app icons
hand_drawnSketch-like styleCasual branding, notebooks
3d_illustration3D rendered lookModern UI, landing pages

Practical Use Cases#

1. Generate App Icons#

python
response = requests.post(
    f"{BASE_URL}/images/generations",
    headers=headers,
    json={
        "prompt": "App icon for a meditation app, lotus flower, gradient from purple to blue, rounded corners, iOS style",
        "style": "icon",
        "model": "recraftv3",
        "size": "1024x1024"
    }
)

2. Create Marketing Illustrations#

python
response = requests.post(
    f"{BASE_URL}/images/generations",
    headers=headers,
    json={
        "prompt": "Isometric illustration of a team collaborating on a software project, laptops, whiteboards, modern office",
        "style": "digital_illustration",
        "model": "recraftv3",
        "size": "1536x1024"
    }
)

3. Generate Consistent Icon Sets#

python
# Generate multiple icons with consistent style
icons = [
    "dashboard analytics icon",
    "user profile icon",
    "settings gear icon",
    "notification bell icon",
    "search magnifying glass icon"
]

for icon_prompt in icons:
    response = requests.post(
        f"{BASE_URL}/images/generations",
        headers=headers,
        json={
            "prompt": f"{icon_prompt}, minimal line art, 2px stroke, single color",
            "style": "icon",
            "model": "recraftv3",
            "response_format": "svg",
            "size": "512x512"
        }
    )
    # Save each icon

Pricing#

PlanPriceGenerations/monthFeatures
Free$050Basic styles, raster only
Pro$25/month1,000All styles, SVG, brand colors
Business$80/month5,000Priority, API access, team
APIPay-per-useUnlimited$0.04-0.08 per image

Cost Comparison for 1,000 Images/Month#

ProviderMonthly CostVector Support
Recraft Pro$25✅ Yes
Recraft API~$40-80✅ Yes
DALL-E 3 API~$40-80❌ No
Midjourney$30-60❌ No
Crazyrouter (DALL-E 3)~$30-60❌ No

For non-vector image generation needs, Crazyrouter offers access to DALL-E 3, Midjourney, and other image models at competitive prices alongside 300+ text AI models.

Frequently Asked Questions#

Can Recraft generate true SVG vector files?#

Yes. Recraft is one of the few AI image generators that outputs native SVG files. These are true vector graphics that can be scaled to any size without quality loss and edited in tools like Figma, Illustrator, or Inkscape.

How does Recraft compare to DALL-E for design work?#

Recraft is better for design assets (icons, illustrations, brand materials) due to its vector output, style consistency, and brand color support. DALL-E 3 is better for photorealistic images and creative art.

Can I use Recraft-generated assets commercially?#

Yes. All paid plans include commercial usage rights. The free tier has some restrictions — check Recraft's terms for details.

Does Recraft support batch generation?#

The API supports sequential generation. For batch processing, you can parallelize requests (respecting rate limits). There's no native batch endpoint yet.

Can I fine-tune Recraft with my own brand assets?#

Recraft supports brand color palettes and style presets. Full fine-tuning with custom images is available on enterprise plans.

Is there an OpenAI-compatible API for Recraft?#

Recraft's API follows a similar structure to OpenAI's images API but isn't fully compatible. For a unified API experience across multiple image models, consider using Crazyrouter which provides OpenAI-compatible access to various image generation models.

Summary#

Recraft fills an important gap in the AI image generation market by focusing on professional design needs. If you need vector graphics, consistent icon sets, or brand-aligned illustrations, Recraft is the tool to use.

For broader AI model access including text generation, image generation, and more, Crazyrouter provides a unified API to 300+ models. Combine Recraft for design assets with Crazyrouter for everything else.

Related Articles