---
title: "SVG AI API & MCP Server — Generate and Vectorize SVGs Programmatically | SVG AI"
description: "REST API and MCP server for SVG AI. Generate SVGs from text or image references, or trace raster artwork into vector paths. Connect from AI assistants or your own code."
url: "https://www.svgai.org/docs"
---

[SVG AI

SVG AI](https://www.svgai.org/)

[Tools](https://www.svgai.org/tools)[Pricing](https://www.svgai.org/pricing)[Blog](https://www.svgai.org/blog)[API](https://www.svgai.org/docs)

[Login](https://www.svgai.org/login) [Sign Up](https://www.svgai.org/signup)

Developer documentation

# SVG AI API & MCP Server

Use SVG AI from your own code or from AI assistants. Two capabilities: **generate** designs a new SVG from a text brief, an image, or both; **vectorize** traces an existing image into SVG paths.

Quick facts

- Base URL: `https://www.svgai.org`
- MCP endpoint: `https://www.svgai.org/api/mcp` (streamable HTTP)
- Auth: an API key from the [API & MCP console](https://www.svgai.org/dashboard/api), sent as `Authorization: Bearer sk_svgai_…`
- API & MCP generation and vectorization use your SVG AI credit balance and require paid account access through a subscription or credit purchase. Website starter credits alone do not unlock API use; an account without a purchase receives `402 payment_required`. [View plans and credit packs](https://www.svgai.org/pricing)
- No code needed to try it: the [console](https://www.svgai.org/dashboard/api) has one-click setup and a live playground.

Reference and discovery

- [OpenAPI specification](https://www.svgai.org/openapi.json)
- [API endpoint index (JSON)](https://www.svgai.org/api/v1)
- [Agent guide (llms.txt)](https://www.svgai.org/llms.txt)
- [Agent workflow instructions](https://www.svgai.org/agents.md)
- [Authentication reference (Markdown)](https://www.svgai.org/auth.md)
- [This page as Markdown](https://www.svgai.org/docs.md)
- [Pricing reference (Markdown)](https://www.svgai.org/pricing.md)
- [SVG workflow skill](https://www.svgai.org/.well-known/agent-skills/index.json)
- [MCP server metadata](https://www.svgai.org/server.json)
- [API catalog](https://www.svgai.org/.well-known/api-catalog)
- [Resource discovery catalog](https://www.svgai.org/.well-known/ard.json)
- [Authentication](https://www.svgai.org/docs#auth)
- [Generate](https://www.svgai.org/docs#generate)
- [Vectorize](https://www.svgai.org/docs#vectorize)
- [Errors](https://www.svgai.org/docs#errors)

<a id="ways"></a>

## Three ways to use it

Pick whichever matches how you work. REST uses an API key; MCP supports OAuth or an API key. Both use your SVG AI account and credit balance.

Claude

1. Hand it to your agent

Copy the setup message from the console and paste it into Claude Code, Cursor, Codex, or another compatible coding agent. The message contains connection instructions and an account check to confirm the setup.

Claude  ChatGPT

2. Chat in Claude or ChatGPT

Add SVG AI as a connector in a supported client, then ask: "make me a flat vector coffee-cup logo" and the SVG comes back in chat.

3. Call the REST API

Send HTTP requests from your own application to generate SVGs, trace images, check credits and retrieve generation results.

The [console](https://www.svgai.org/dashboard/api) has a **Copy setup message** button: paste that one message into your assistant and follow its connection steps. Checking your balance confirms authentication without generating an image. You can also use the manual commands below.

<a id="choosing"></a>

## Generate vs. vectorize

Use **vectorize** to trace the shapes and colors in an existing image. Use **generate** for a new design or a reinterpretation of a reference. Inspect traced edges, small details and colors before using the result.

| Capability | Generate | Vectorize |
| --- | --- | --- |
| What it does | Composes a clean, flat, vector-native design and returns final SVG paths. An input image is used as the subject or reference and redrawn as clean vector artwork. | Traces the input image into SVG paths. The result follows the source artwork, but edges, fine details and colors can change. |
| Best for | New logos, icons, illustrations; turning photos, sketches, or rough rasters into polished SVGs; restyling. | Logos, icons, and flat artwork that are already clean and just need to become real vectors. |
| Background | `transparent_background` defaults to `"auto"` — SVG AI decides from the design. | An opaque background is traced too. Pass `remove_background: true` to request background removal before tracing. |
| Cost | Varies by model and number of variations. Check [current operation costs](https://www.svgai.org/docs#credits). | Charged per image; optional background removal is included. Check [current operation costs](https://www.svgai.org/docs#credits). |
| Retrieving the result | Returns a result or a processing response with a polling URL. | Returns the traced SVG in the response. |

**Classic** is fast and great for icons and simpler designs. **Ultra** renders more detail and handles text-heavy logos and complex briefs better. Generations made through the API also appear in your SVG AI dashboard.

<a id="auth"></a>

## Authentication

There are two ways to authenticate: **OAuth 2.1** for MCP clients (recommended — no key handling at all) and **API keys** for the REST API or any client where you prefer a header.

<a id="oauth"></a>

### OAuth 2.1 (MCP clients)

Add `https://www.svgai.org/api/mcp` to Claude, ChatGPT, or any MCP client *without credentials*. The client discovers the flow automatically, your browser opens SVG AI's sign-in and consent screen, and tokens are issued behind the scenes — you never see or paste a secret. The server implements the current MCP authorization spec:

- Protected-resource metadata (RFC 9728) at `/.well-known/oauth-protected-resource`; authorization-server metadata (RFC 8414) at `/.well-known/oauth-authorization-server`. Unauthenticated calls to `/api/mcp` return 401 with a `WWW-Authenticate: Bearer resource_metadata="…"` challenge.
- Authorization-code flow with PKCE (S256 only) and dynamic client registration (RFC 7591) at `POST /api/oauth/register`.
- Access tokens are audience-bound (RFC 8707) and last 1 hour; refresh tokens last 60 days and rotate on every use — a replayed refresh token revokes the whole session.
- Connected apps are listed in the [console](https://www.svgai.org/dashboard/api) and can be disconnected instantly.

<a id="api-keys"></a>

### API keys (REST, or manual MCP setup)

Create a key in the [API & MCP console](https://www.svgai.org/dashboard/api) (Dashboard → API & MCP). The full key is shown once, at creation. Send it on every request:

```bash
Authorization: Bearer sk_svgai_...        # preferred
x-api-key: sk_svgai_...                   # alternative header
```

Keys can be revoked any time from the console. Rate limits: 20 generations and 30 vectorizations per minute per account.

<a id="generate"></a>

## POST /api/v1/generate

Create one or more SVGs from a prompt, an image, or both.

| Field | Type | Description |
| --- | --- | --- |
| prompt | string | What to create, in plain language. Optional when an image is provided. Max 4,000 chars. |
| image | string | Base64 source/reference image (raw or data URL). PNG, JPEG, or WebP, up to 8 MB. |
| image\_url | string | Alternative to `image`: a publicly reachable http(s) URL. |
| model | string | `"classic"` (default) or `"ultra"`. Check the credits endpoint for current costs. |
| variations | integer | 1–4 designs per request (default 1). Each variation is charged. |
| transparent\_background | string | `"auto"` (default), `"on"`, or `"off"`. |
| aspect\_ratio | string | `"default"` or `"square"` (forces a 1:1 canvas). |
| wait | boolean | Default `true`: wait for completion within the request's wait window. If it is still processing, the response includes a polling URL. With `false`, return HTTP 202 and poll the generation. |

```bash
curl -X POST https://www.svgai.org/api/v1/generate \
  -H "Authorization: Bearer sk_svgai_..." \
  -H "Content-Type: application/json" \
  -d '{"prompt": "minimal fox logo, orange and white", "model": "classic"}'
```

Complete response example

Example response with sample identifiers, credit balances and a simple square SVG.

```json
{
  "object": "svg.generation",
  "id": "6dce86db-468b-4bc9-b877-379a9c0894a1",
  "status": "completed",
  "model": "classic",
  "credits_used": 2,
  "credits_remaining": 18,
  "svgs": [
    {
      "design_id": "8acc61ce-59b4-4562-b67c-9e4a1ca55115",
      "status": "completed",
      "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\"><path fill=\"#ea580c\" d=\"M12 12h40v40H12z\"/></svg>"
    }
  ]
}
```

A failed generation refunds its credits automatically. If the request outlives the wait window, you receive HTTP 202 with `status: "processing"`, a `poll_url`, and a matching `Location` response header. Polling still requires your API key. Use the existing generation's polling URL before retrying a request that may already have been accepted: creating a generation again can spend credits again.

<a id="poll"></a>

### GET /api/v1/generations/:id

Fetch the state and results of an earlier generation by its `id`, using the same account's API key. The response contains `object`, `id`, `status`, and `svgs`; it omits model, credit fields, and polling URL. Keep polling while the status is `processing`.

<a id="vectorize"></a>

## POST /api/v1/vectorize

Trace an existing image into SVG paths. Send `image` (base64) or `image_url`; images should be at least 256×256 pixels.

**Backgrounds are not removed automatically** — an opaque background becomes filled paths in the SVG. Pass `remove_background: true` to isolate the main subject on a transparent background before tracing (no extra credits). Inspect the returned SVG on your intended background. If background removal fails, the original image is traced instead and the response reports `background_removed: false`.

```bash
curl -X POST https://www.svgai.org/api/v1/vectorize \
  -H "Authorization: Bearer sk_svgai_..." \
  -H "Content-Type: application/json" \
  -d '{"image_url": "https://example.com/logo.png", "remove_background": true}'
```

Illustrative response

```json
{
  "object": "svg.vectorization",
  "status": "completed",
  "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\"><path fill=\"#ea580c\" d=\"M12 12h40v40H12z\"/></svg>",
  "background_removed": false,
  "credits_used": 1,
  "credits_remaining": 17
}
```

<a id="credits"></a>

## GET /api/v1/credits

Check this endpoint for current operation costs and `api_access` before generating or vectorizing. Website starter credits alone do not unlock API use. The example below uses sample account values.

```json
{
  "object": "credit.balance",
  "credits_remaining": 148,
  "subscription_active": true,
  "api_access": true,
  "costs": { "generate_classic": 2, "generate_ultra": 4, "vectorize": 1 },
  "topup_url": "https://svgai.org/pricing"
}
```

<a id="errors"></a>

## Errors

REST handler errors contain `{ "error": { "type", "message" } }` with a matching HTTP status. A failed generation can also include its generation fields alongside the error. MCP uses its own JSON-RPC error and tool-result formats.

Check authentication without spending credits

A request without an API key returns HTTP 401:

```bash
curl -i https://www.svgai.org/api/v1/credits
```

```json
{
  "error": {
    "type": "authentication_error",
    "message": "Missing API key. Pass it as \"Authorization: Bearer sk_svgai_...\" (create keys at https://svgai.org/dashboard/api)."
  }
}
```

| Type | Status | Meaning |
| --- | --- | --- |
| invalid\_request | 400 | Malformed input; the message says which field. |
| authentication\_error | 401 | Missing, invalid, or revoked API key. |
| insufficient\_credits | 402 | Includes `credits_remaining` and `credits_required`. |
| payment\_required | 402 | The account has never purchased — API & MCP use paid credits. Includes `upgrade_url`. |
| not\_found | 404 | The API endpoint does not exist, or no generation with that id exists for the authenticated account. |
| rate\_limit\_exceeded | 429 | May include `retry_after_seconds` and the matching `Retry-After` HTTP header. Follow the supplied delay when present. |
| generation\_error | 502 | The pipeline failed; credits were refunded. |
| server\_error | 500 | An unexpected failure; check an accepted generation before retrying. |

<a id="rate-limits"></a>

### Request rate limits

Authenticated REST responses can include `RateLimit-Policy` and `RateLimit`. These describe the account's request limit, shared across its API keys; they count requests, not credits. The policy identifies its quota and window, while the observation gives remaining requests and a window hint in seconds.

Headers are omitted when no valid, unexpired limiter observation is available, including before authentication, during a limiter outage, or after a long generation outlives the observation. Concurrent requests can change availability. Follow `Retry-After` when a rate-limit error includes it. Retrying an accepted generation can create another charged request; use its polling URL to retrieve the result. The header syntax follows the [IETF HTTPAPI RateLimit draft](https://datatracker.ietf.org/doc/draft-ietf-httpapi-ratelimit-headers/).

<a id="mcp"></a>

## MCP server (for AI assistants)

The MCP server at `https://www.svgai.org/api/mcp` exposes three tools — `generate_svg`, `vectorize_image`, and `get_credits` — over streamable HTTP. Authenticate with [OAuth](https://www.svgai.org/docs#oauth) (just add the URL — the sign-in happens in your browser) or with an API key header. Every setup below is one-click in the [console](https://www.svgai.org/dashboard/api).

The public [server metadata](https://www.svgai.org/server.json) describes the endpoint and its connection details in MCP Registry format. OAuth discovery is available at [protected-resource metadata](https://www.svgai.org/.well-known/oauth-protected-resource) and [authorization-server metadata](https://www.svgai.org/.well-known/oauth-authorization-server). Tool calls remain authenticated, and generation and vectorization require paid access.

### Claude Claude Code

```bash
claude mcp add --transport http svgai https://www.svgai.org/api/mcp \
  --header "Authorization: Bearer sk_svgai_..."
```

### Claude Claude (claude.ai)

Settings → Connectors → *Add custom connector* → URL `https://www.svgai.org/api/mcp` — no key needed: Claude walks you through SVG AI's sign-in and consent screen (OAuth). Prefer a key? Add an `Authorization` header with value `Bearer sk_svgai_…` instead.

### ChatGPT ChatGPT (developer mode)

Settings → Apps & Connectors → enable Developer mode → *Create connector* with the same URL — OAuth sign-in works here too, or use the Authorization header.

### Cursor, Windsurf, VS Code & other MCP clients

```json
{
  "mcpServers": {
    "svgai": {
      "url": "https://www.svgai.org/api/mcp",
      "headers": { "Authorization": "Bearer sk_svgai_..." }
    }
  }
}
```

Notes

- Use `https://www.svgai.org` (with www) — the apex domain redirects.
- Inspect the SVG at its intended size and in your target application before publishing or cutting it.
- Questions or higher limits: [contact us](https://www.svgai.org/contact).

SVG AI

SVG AI helps you create professional vector graphics from text prompts, including logos, icons, illustrations, and text-to-SVG designs.

## Product

- [AI SVG Generator](https://www.svgai.org/)
- [AI Icon Generator](https://www.svgai.org/ai-icon-generator)
- [SVG to MP4 Converter](https://www.svgai.org/tools/svg-to-video)
- [Pricing](https://www.svgai.org/pricing)

## Popular Converters

- [PNG to SVG](https://www.svgai.org/convert/png-to-svg)
- [SVG to PNG](https://www.svgai.org/convert/svg-to-png)
- [Image to SVG](https://www.svgai.org/convert/image-to-svg)
- [SVG to JPG](https://www.svgai.org/convert/svg-to-jpg)
- [SVG to PDF](https://www.svgai.org/convert/svg-to-pdf)
- [View All →](https://www.svgai.org/convert)

## Resources

- [What is SVG?](https://www.svgai.org/blog/guides/what-is-svg)
- [SVG Gallery](https://www.svgai.org/gallery)
- [SVG Animation](https://www.svgai.org/animate)
- [Blog](https://www.svgai.org/blog)
- [Learn Center](https://www.svgai.org/blog)
- [API & MCP Docs](https://www.svgai.org/docs)
- [Sitemap](https://www.svgai.org/sitemap)

## Legal

- [Privacy & Cookies](https://www.svgai.org/privacy)
- [Terms of Service](https://www.svgai.org/terms)

2026 SVG AI. All rights reserved.

[X (Twitter)](https://x.com/svg_ai) [LinkedIn](https://www.linkedin.com/company/svgai/) [YouTube](https://www.youtube.com/@svg-ai) [Instagram](https://www.instagram.com/svgai_org/)
