Sign up free

Image to SVG API

Add image vectorization to your application.

Send PNG, JPG, GIF, BMP or WebP artwork and receive SVG paths with a saved conversion ID. Retrieve PDF, EPS or DXF from that conversion without tracing again.

See the requestAPI plans start at $19/month for 500 successful conversions. Browser allowances are separate.

One upload. A saved vector result.

This example uses native fetch and FormData on Node.js 22 or newer.

  • Create an API key in your dashboard, store it in the server environment and send the image as multipart form data. Let the HTTP client set the multipart boundary. No processing options are part of this endpoint's contract.
  • Store a UUID or another valid 8–128-character request ID with the job before running it, and set VECTALI_REQUEST_ID to that saved value. Reuse it for the same image after a timeout, including when restarting this script.
import { readFile, writeFile } from "node:fs/promises";
const apiKey = process.env.VECTALI_API_KEY;
if (!apiKey) throw new Error("Set VECTALI_API_KEY on your server.");

// Set a saved job ID once. Keep it for retries, including a script rerun.
const requestId = process.env.VECTALI_REQUEST_ID;
if (!requestId) throw new Error("Set VECTALI_REQUEST_ID to this job's saved ID.");
const body = new FormData();
body.append("image", new Blob([await readFile("logo.png")], {
  type: "image/png",
}), "logo.png");

const response = await fetch("https://api.vectali.com/api/v1/vectorize", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${apiKey}`,
    "Idempotency-Key": requestId,
  },
  body,
  signal: AbortSignal.timeout(240_000),
});

const result = await response.json();
if (!response.ok) {
  // Inspect the documented status/code before deciding whether to retry.
  throw new Error(`Vectali returned HTTP ${response.status}`);
}
if (typeof result.svg !== "string") throw new Error("Missing SVG result.");
await writeFile("logo.svg", result.svg, "utf8");
await writeFile("logo.conversion.json", JSON.stringify({
  request_id: requestId,
  conversion_id: result.conversion_id,
}, null, 2), "utf8");

The JSON response includes conversion_id, svg, processing_ms, paths and optimized_bytes. These measurements describe this conversion, not a guaranteed processing time or a quality score. Keep the original image and request ID until the result is confirmed.

Read the complete request and response contract

Retry the job without spending twice.

Persist one idempotency key per logical conversion. A completed replay with the same image returns its saved result without another conversion charge. An in-progress job returns 409 conversion_in_progress; wait and retry with the same key. A completed key reused for different image bytes returns an idempotency conflict. Generate a new key for a new image.

Handle 401 as an authentication problem and 402 as insufficient allowance. Follow the documented retry guidance for rate limits and busy responses; do not retry every error in a tight loop. The example shows a single request, not a production retry queue.

Implement error handling

Download other formats from the saved conversion.

With the same account's API key, request GET /api/v1/files/{conversion_id}/pdf. Replace pdf with svg, eps or dxf. The response contains the file bytes. A format export does not retrace or consume another conversion; keep the saved ID when an export needs a retry.

SVG and PDF support gradients and transparency. EPS uses a white matte. DXF exports closed polylines without fills; verify dimensions and duplicate edges before fabrication. Changing extensions does not preserve every visual property.

Check format behavior

Know the limits and data flow.

Each input must fit 10 MiB, 4,000,000 pixels total and 4,096 pixels per side. GIF and animated WebP use the first frame. Complex inputs may exceed time or memory budgets even inside those limits. The API runs on Vectali's servers and saves the source and result to private account history.

Call from your backend, authenticate your own users and keep Vectali keys out of browser code. This is not an arbitrary-origin public upload endpoint. For a local preview of an occasional image, use the browser converter instead.

Compare local browser conversion

Pay for successful conversions.

API plans start at $19/month for 500 successful conversions and reach 100,000 conversions per billing period. Failed conversions release reserved allowance. Monthly allowance does not roll over, and there are no automatic overage purchases. API, CLI and MCP share API allowance; Web Pro and browser credit packs do not fund it.

Compare API plans