Skip to content

Generation API

An SVG generation API. A prompt goes in, optimised markup comes back.

Put vector generation behind your own product: a design tool, a template engine, a content pipeline, a bulk asset job. JSON in, cleaned SVG out, with the result stored so you can fetch it again. This is a REST service you call from a server — not the browser SVG DOM that MDN documents under the same name.

request
curl -X POST \
  https://api.svgmakerai.com/svg/create-svg-from-text \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "faceted fox head, flat vector",
    "modelType": "normal",
    "width": 1024,
    "height": 1024
  }'
200 OK
{
  "success": true,
  "message": "AI SVG generated successfully
              and 1 credits deducted",
  "data": {
    "_id": "…",
    "title": "faceted fox head, fla…",
    "prompt": "faceted fox head, flat vector",
    "svgContent": "<svg viewBox=…>…</svg>",
    "generationMethod": "ai-text",
    "isPublic": false
  }
}

Three things called an SVG API

Which one you are looking for.

The phrase covers three unrelated things and only one of them is a service you call over the network. Two minutes here saves reading the wrong documentation.

The browser SVG DOM API

MDN, the SVG specification, Apache Batik

The JavaScript interfaces — SVGElement, SVGPathElement, SVGSVGElement — for reading and changing vector nodes already on a page. It ships with every browser, costs nothing and needs no account. If you are scripting shapes in a document, that is what you want and this page is not it.

An icon or logo REST API

Iconify, SVGL, svgapi.com

Services that return an existing icon from a catalogue by name or search. Enormous libraries, usually free, and the right answer whenever the artwork you need already exists and somebody has drawn it.

A generation API

This page

A service that creates artwork that did not exist before, from a description or an uploaded image, and hands back vector markup. Useful precisely when the asset is not in anybody's catalogue — per-user, per-listing, per-tenant artwork.

Endpoints

Two that generate. Nine that manage.

Only the first two consume credits. Everything else is workspace and gallery management and costs nothing.

API endpoints with method, auth and credit cost
MethodPathAuthCostBodyWhat it does
POST/svg/create-svg-from-textbearer1 – 2 creditsprompt, modelType, width, heightExpands the prompt, generates vector geometry, optimises the markup and stores the result in your workspace.
POST/svg/convert-image-to-svgbearer1 – 2 creditsmultipart: image, plus prompt, modelTypeRebuilds an uploaded raster image as layered vector paths. Files up to 10 MB.
POST/svg/save-svgbearerFreetitle, svgContent, category, isPublicStores markup you produced or edited yourself, so hand-authored files live alongside generated ones.
GET/svg/get-all-svgsbearerFreeLists everything in the calling account's workspace.
GET/svg/get-svg/:idpublicFreeFetches one file. Private files are only returned to their owner.
GET/svg/public-gallerypublicFreeReads the public gallery. No session needed.
PATCH/svg/toggle-public/:idbearerFreeisPublic, categoryPublishes or unpublishes one of your own files. Owner-only.
DELETE/svg/delete-svg/:idbearerFreeDeletes one file from your workspace.
GET/svg/get-public-svg/:idpublicFreeFetches a published file without a session. Returns nothing for anything still private.
POST/svg/public-gallery/:id/downloadpublicFreeRegisters a download against a gallery item. Use it if you are surfacing the gallery in your own interface and want the counts to stay honest.
DELETE/svg/clear-all-svgbearerFreeEmpties the calling account's workspace. There is no undo, so gate it behind a confirmation of your own.

Behaviour

Six things worth knowing before you integrate.

Bearer authentication

Send Authorization: Bearer <token>. Requests without a valid token get 401; an expired one gets 403.

Credits are checked first

If the balance is below the cost of the run, the request returns 400 with the shortfall named and nothing is charged.

Optimisation is not optional

Generated markup is cleaned before it is returned, so what you receive is already namespace-stripped and precision-trimmed.

Everything is stored

Each generation creates a record you can list, fetch, publish or delete. Storage failures do not fail the generation.

Two fidelity tiers

modelType defaults to normal at one credit. Setting it to premium uses the higher-fidelity vector model at two.

Errors are shaped consistently

Every response carries success and message. Failures add an error field with the underlying reason.

Failure modes

The four responses you will actually handle.

Every failure carries success: false and a human-readable message, so a single error path in your client covers all of them.

  • 400Missing prompt, or not enough credits for the tier you asked for.
  • 401No bearer token on a route that requires one.
  • 403Token present but expired or invalid — or the file is not yours.
  • 404No such file, or it is private and you are not the owner.

Questions

Integrating the API.

Is this the same as the SVG API on MDN?
No, and the collision is worth clearing up. MDN documents the browser's SVG DOM — the JavaScript interfaces for manipulating vector elements already in a page. That is part of the platform, free, and needs no account. This is a REST service you call from a server to generate artwork that does not exist yet. Different layer, different problem.
What can I build with an SVG generation API?
The cases that justify it are the ones where the artwork has to be per-something: a placeholder illustration per user, a cover image per article, an icon per tenant in a white-label product, or a bulk run over a spreadsheet of prompts. If the asset already exists in a catalogue, an icon API like Iconify is cheaper and faster.
How do I get access?
REST API access is part of the Business plan. Write to support@svgmakerai.com and we will get you set up with credentials and the current endpoint reference.
How does authentication work?
A bearer token in the Authorization header on every authenticated request. Public reads — fetching a public file or the gallery — need no token at all.
What comes back from a generation call?
JSON containing the stored record: the optimised SVG markup, the prompt it came from, the generation method, and an id you can use to fetch or delete it later.
How are credits consumed?
One per standard generation, two per premium. Storing, listing, fetching, publishing and deleting are free. Your balance is checked before any work starts.
Can I generate in batches?
Batch generation from a prompt list is part of the Business plan. Each item in the batch consumes credits at the usual rate.
What are the limits?
Image uploads are capped at 10 MB and JSON bodies at 50 MB. Generation is inherently slower than a normal request, so treat these as long-running calls and set your timeouts accordingly.

Put vector generation in your own product.

API access ships with the Business plan. Tell us what you are building and we will get you a key.

Request access