SVG Lab

Last updated · 26 October 2026

SVG Lab API

SVG Lab's Design Engine over plain HTTP, for agents and scripts: start a project, run Design Engine operations in it, generate SVG with AI Generate, place placeholder photos, and download the finished SVG, PNG, PDF or code.

Use when the task needs a real, editable vector file (logo, icon set, app screen, social graphic) rather than an SVG string pasted into chat. Every project opens in the SVG Lab editor, so a person can keep working on it.

The API is in early access. To get keys, write to support@svglab.app.

Keys

One full example

Start a project, draw in it, take the SVG:

curl -s https://svglab.app/api/v1/projects \
  -H "Authorization: Bearer $SVGLAB_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: coffee-1" \
  -d '{"name": "Coffee shop badge"}'

{"ok": true, "project": {"id": "3f6c2a7e-8b1d-4c55-9a0e-2d7b8f1e4c90",
  "name": "Coffee shop badge", "url": "https://svglab.app/?project=3f6c2a7e-8b1d-4c55-9a0e-2d7b8f1e4c90"},
  "credits": 1, "job": {"id": "b2e4...", "status": "succeeded"}}

curl -s https://svglab.app/api/v1/projects/3f6c2a7e-8b1d-4c55-9a0e-2d7b8f1e4c90/run \
  -H "Authorization: Bearer $SVGLAB_KEY" -H "Content-Type: application/json" \
  -d '{"ops": [
        {"op": "add_artboard", "args": {"name": "Badge", "width": 512, "height": 512}},
        {"op": "create_shapes", "args": {"artboard": "Badge", "shapes": [
          {"type": "shape", "kind": "ellipse", "x": 56, "y": 56, "width": 400, "height": 400, "style": {"fill": "#3B2418"}},
          {"type": "text", "content": "BREW", "x": 256, "y": 270, "font_family": "Fraunces", "font_size": 96, "style": {"fill": "#F3E3C7"}}]}}]}'

{"ok": true, "result": [{"ok": true, "name": "Badge"}, {"ok": true, "shape_ids": ["s4", "s5"]}],
  "created_ids": ["s4", "s5"], "warnings": [], "credits": 1}

curl -s "https://svglab.app/api/v1/projects/3f6c2a7e-8b1d-4c55-9a0e-2d7b8f1e4c90/export?format=svg&artboard=Badge" \
  -H "Authorization: Bearer $SVGLAB_KEY" -o badge.svg

run also takes code: JavaScript that calls await sl.op(name, args), so one call can build a whole screen. GET /api/v1/ops lists the operations and GET /api/v1/ops/{name} gives one's arguments.

Routes

RouteDoes
POST /projects, GET /projects, GET /projects/{id}Start, list, describe (listing is free)
POST /projects/{id}/runDesign Engine operations: ops or code
POST /projects/{id}/lookThe render with measured problems (overflow, overlap, contrast)
POST /generateAI Generate: a sentence or a picture in, SVG code out, marked as AI-generated in the file; optionally placed in a project
POST /projects/{id}/photosA free placeholder photo by description, cropped into a box, with the photographer's credit kept in the file
GET /projects/{id}/export?format=svg|png|pdf|codeThe finished file
GET /jobs/{id}, GET /usage, GET /guides/{topic}Jobs, receipts, the design guides

The OpenAPI 3.1 document has every field, generated from the same catalog the SVG Lab MCP serves.

Long runs, retries and limits

Partners

A partner key serves your own customers: send SVGLab-End-Customer: <your id for them> on every call, never an email address. Each end customer has its own daily cap, sees only its own projects and jobs, and can be paused on your Account page without pausing you. Receipts name the end customer.

Errors

Every error is {"ok": false, "error", "message", "fix"}, and fix says what to change.

errorWhat to change
missing_key, invalid_key, key_revoked (401)Send a current key as Authorization: Bearer; make one on your Account page.
missing_scope, account_suspended, team_workspace_not_readyUse a key with the scope named; write to support; use a personal workspace key.
credits_needed (402)Add credits on Billing.
key_daily_cap, end_customer_daily_cap, sandbox_credits_used_up, rate_limited (429)Wait until resets_at, raise the cap, or use a live key.
sandbox_no_ai_generate, sandbox_export_formatUse a live key.
end_customer_id_required, end_customer_id_email, end_customer_id_invalid, end_customer_not_partner, end_customer_suspendedPartner keys only: your own id (letters, digits, . _ : -); the partner can resume a paused customer.
bad_request, invalid_json, payload_too_large, webhook_url_invalid, idempotency_key_invalidFix the field the message names (JSON, under 16 MB, a public https webhook).
project_not_found, job_not_found, not_foundUse an id this key made or can see; check the path in the OpenAPI document.
operation_failed (422)The message names what to change in the operation.
idempotency_in_progress, idempotency_key_reusedPoll the job; use a new key for a new request.
editor_starting, still_runningSend it again after retry_after_s; check the project before repeating a long call.
export_failed, ai_generate_failed, ai_generate_unavailable, limiter_unavailable, credits_unavailable, api_not_ready, unavailableNothing was charged: try again in a minute.

Rules

The terms apply. Never present AI Generate output as made by a person, and never use the API for harmful content. Questions: support@svglab.app.