Authentication
Create a key on your account page and send it in the Authorization header as Bearer ndl_…. The key is shown once, so store it somewhere safe, such as an environment variable. Keep it on your server: anyone with the key can spend your credits. You can revoke a key at any time.
Pages on this site can also call the API with the signed-in visitor's session, without a key.
Vectorize an image
POST /api/public/vectorize
Send multipart/form-data. API calls are free and unlimited during the beta.
| Field | What it is |
|---|---|
imagefile, required | PNG, JPEG or WEBP, up to 50 MB. |
modestring, optional | simple, detailed or auto (default). Simple suits logos and flat art; detailed suits shaded illustrations. |
Examples
curl
curl https://nodalvector.com/api/public/vectorize \
-H "Authorization: Bearer $NODAL_API_KEY" \
-F "image=@logo.png" \
-F "mode=auto" \
| jq -r .svg > logo.svgNode.js 18+
import { readFile, writeFile } from "node:fs/promises";
const form = new FormData();
form.append("image", new Blob([await readFile("logo.png")], { type: "image/png" }), "logo.png");
form.append("mode", "auto");
const res = await fetch("https://nodalvector.com/api/public/vectorize", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.NODAL_API_KEY}` },
body: form,
});
if (!res.ok) throw new Error((await res.json()).error);
const { svg } = await res.json();
await writeFile("logo.svg", svg);Response
A JSON object.
{
"svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" ...>…</svg>",
"png": "iVBORw0KGgo…",
"width": 1024,
"height": 768,
"aspect_ratio": "4:3",
"stats": { "paths": 212, "colors": 14, "linearGradients": 3, "radialGradients": 1, "detail": "detailed" },
"account": { "credits": 9, "plan": "none", … }
}| Field | What it is |
|---|---|
svg | The vector, as an SVG document string. |
png | The source image as base64 PNG, rotated upright. |
width, height | Size of the SVG in pixels, matching the source. |
aspect_ratio | The image's shape as a simple ratio, e.g. 4:3. |
stats | Counts from the trace: paths, colors, linearGradients, radialGradients, and the detail level used. |
account | Credits and plan left after this call. |
Errors
Errors come back as JSON with an error message you can show to people.
| Status | Meaning |
|---|---|
400 | Missing image, wrong file type, file over 50 MB, or an unknown mode. |
401 | Missing or invalid API key (or, from the browser, not signed in). |
402 | Out of credits (code: no_credits). Buy a pack or plan, then retry. |
5xx | The trace failed. The credit is returned automatically. |
Limits
- One image per request, up to 50 MB.
- Up to 10 API keys per account.
- Unlimited plans and Lifetime cover up to 500 images a month.
- Nothing you send is stored. The result goes straight back in the response.