Kleiders
Kleiders / Developer Docs

API Documentation

Integrate Kleiders' AI design engine into your own applications. Generate photorealistic garment designs, transform sketches, and export production-ready patterns — all via a simple REST API.

REST API v1Base URL: https://api.kleiders.com/v1

Overview

The Kleiders API gives you programmatic access to our AI-powered fashion design platform. With a few API calls, you can generate photorealistic garment images from text prompts, transform rough sketches into production-ready visuals, and export manufacturing-ready sewing patterns scaled to custom body measurements.

The API is built on standard REST principles. All requests use JSON, responses include pagination and error details, and authentication is handled via bearer tokens. Every generation is immutable and retrievable — once created, your designs are permanently stored and can be referenced by their unique ID.

01

Get your API key

Generate a key from your dashboard settings. Available on Studio plan and above.

02

Make your first call

Send a text prompt to the generations endpoint and receive design images in seconds.

03

Export patterns

Convert any generation into DXF, SVG, or PDF pattern files with custom measurements.

Authentication

All API requests require a valid API key passed via the Authorization header as a Bearer token. API keys are prefixed with kld_live_ for production and kld_test_ for sandbox environments.

You can generate and manage API keys from your Dashboard → Settings → API Keys. Each key can be scoped to specific permissions (read-only, generation, export) and can be revoked at any time.

bash
curl https://api.kleiders.com/v1/generations \
  -H "Authorization: Bearer kld_live_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A tailored navy wool blazer with peak lapels",
    "mode": "text-to-image",
    "count": 4
  }'

Keep your keys secure

Never expose API keys in client-side code or public repositories. Use environment variables and server-side API routes. If a key is compromised, revoke it immediately from your dashboard.

Rate Limits

Rate limits protect the platform and ensure fair usage across all users. Limits are enforced per API key and reset at the start of each calendar month (UTC). When you exceed a limit, the API responds with a 429 Too Many Requests status code and includes a Retry-After header.

PlanText-to-ImageSketch-to-RealisticPattern ExportsRate
Free Trial5 total1 total5 req/min
Starter250/mo50/mo100/mo30 req/min
Serious Founder1,250/mo250/mo300/mo60 req/min
Studio5,000/mo800/moUnlimited120 req/min
EnterpriseCustomCustomUnlimitedCustom

Response headers include X-RateLimit-Remaining and X-RateLimit-Reset so you can monitor usage programmatically.

Text-to-Image

Generate photorealistic garment images from natural language descriptions. The model understands fabric types, silhouettes, colors, fit, and styling context to produce high-fidelity design concepts.

Endpoint

POST/v1/generations

Parameters

promptstringRequiredNatural language description of the garment to generate.
modestringRequired"text-to-image" for this endpoint.
stylestring"photorealistic" (default), "editorial", "technical-flat", or "mood-board".
countintegerNumber of variations to generate (1–8). Default: 4.
sizestringOutput resolution: "512x512", "1024x1024" (default), or "2048x2048".
javascript
import Kleiders from '@kleiders/sdk';

const kld = new Kleiders({ apiKey: process.env.KLEIDERS_API_KEY });

const generation = await kld.generations.create({
  prompt: "Oversized linen shirt, sand colorway, relaxed fit",
  mode: "text-to-image",
  style: "photorealistic",
  count: 4,
  size: "1024x1024",
});

// Each result contains a high-res URL and metadata
console.log(generation.results);
// → [{ id, url, prompt, created_at, metadata }, ...]

Sketch-to-Realistic

Upload a hand-drawn sketch, flat illustration, or mood board image and transform it into a photorealistic garment visualization. Pair it with a text prompt to guide fabric choices, styling, and colorway.

Endpoint

POST/v1/generations

Parameters

modestringRequired"sketch-to-realistic" for this endpoint.
imagefileRequiredSource sketch image (PNG, JPG, WebP). Max 10MB.
promptstringOptional text guidance for fabric, color, and styling.
fidelitystring"low", "medium" (default), or "high" — how closely to follow the sketch.
countintegerNumber of variations (1–4). Default: 2.
javascript
import Kleiders from '@kleiders/sdk';
import fs from 'fs';

const kld = new Kleiders({ apiKey: process.env.KLEIDERS_API_KEY });

const sketch = fs.readFileSync('./my-sketch.png');

const generation = await kld.generations.create({
  mode: "sketch-to-realistic",
  image: sketch,               // PNG, JPG, or WebP
  prompt: "Premium silk evening gown, midnight blue",
  fidelity: "high",             // how closely to follow the sketch
  count: 2,
});

console.log(generation.results[0].url);

Pattern Export

Convert any generated design into manufacturing-ready pattern files. Provide body measurements and the engine will produce graded sewing patterns in your preferred CAD format, complete with seam allowances, grain lines, and piece labeling.

Endpoint

POST/v1/patterns/export

Parameters

generation_idstringRequiredThe ID of the generation to export patterns from.
formatstringRequired"svg", "dxf", or "pdf".
measurementsobjectRequiredBody measurements: bust, waist, hips, height, and unit ("cm" or "in").
seam_allowancenumberSeam allowance in the measurement unit. Default: 1.5cm.
include_gradingbooleanGenerate a full size range (XS–XL). Default: false.
javascript
const pattern = await kld.patterns.export({
  generation_id: "gen_abc123",
  format: "dxf",                // "svg" | "dxf" | "pdf"
  measurements: {
    bust: 92,
    waist: 74,
    hips: 98,
    height: 170,
    unit: "cm",
  },
  seam_allowance: 1.5,          // centimeters
  include_grading: true,         // generate size range S–XL
});

// Download the production-ready pattern file
console.log(pattern.download_url);
console.log(pattern.pieces);
// → [{ name: "Front Bodice", ... }, { name: "Back Panel", ... }]

Webhooks

Receive real-time notifications when generations complete, patterns are exported, or errors occur. Webhooks eliminate the need for polling and enable seamless integration with your internal workflows.

All webhook payloads are signed with HMAC-SHA256 using your webhook secret. Always verify signatures before processing events to prevent spoofing.

Available Events

generation.completedFired when an AI generation finishes processing and images are ready.
generation.failedFired when a generation fails due to content policy, timeout, or server error.
pattern.exportedFired when a pattern export has completed and the file is ready for download.
usage.thresholdFired when API usage reaches 80% or 100% of your plan limit.
javascript
// POST https://api.kleiders.com/v1/webhooks
const webhook = await kld.webhooks.create({
  url: "https://yourapp.com/api/kleiders-webhook",
  events: [
    "generation.completed",
    "generation.failed",
    "pattern.exported",
  ],
  secret: "whsec_your_signing_secret",
});

// Verify incoming webhook signatures
import { verifyWebhookSignature } from '@kleiders/sdk';

export async function POST(req) {
  const payload = await req.text();
  const signature = req.headers.get('x-kleiders-signature');

  const event = verifyWebhookSignature(payload, signature, secret);
  // → { type: "generation.completed", data: { ... } }
}

SDKs & Libraries

Official client libraries that handle authentication, retries, pagination, and type safety out of the box. Install your preferred SDK and start building in minutes.

Node.js / TypeScript

Stable
npm install @kleiders/sdk

Python

Stable
pip install kleiders

Ruby

Beta
gem install kleiders

Go

Coming Soon
go get github.com/kleiders/kleiders-go

Ready to build?

API access is available on the Studio plan and above. Get your API key and start integrating Kleiders into your design workflow today.