API

PixelToPath API

Vectorize images programmatically with one REST call. Upload a PNG, JPG, BMP or WebP file, get a clean, production-ready SVG back. Black & white line art is traced by Potrace, color images by VTracer — the same engines as the free online converter.

10 free conversions every month · No credit card required

10 free conversions / month • 1 REST call • Potrace + VTracer engines • Credits never expire

Quickstart

Three steps and you are converting images to SVG from your terminal, your scripts or your app.

1 · Create your account

Register on the client portal with your email and a password (10+ characters). No credit card required.

2 · Create an API key

In the portal, create a key. It is shown once — store it safely. Keys look like ptp_live_… and can be revoked at any time.

3 · Call /v1/convert

Send your image as multipart/form-data with your key in the Authorization header. The SVG comes back in the response body.

Your first conversion

curl -sS -f -X POST https://api.pixel-to-path.com/v1/convert \
  -H "Authorization: Bearer ptp_live_YOUR_KEY" \
  -F "[email protected]" \
  -F "colormode=binary" \
  -o logo.svg

Interactive reference: pixel-to-path.com/v1/docs (OpenAPI/Swagger).

Authentication

Every request is authenticated with a Bearer token in the Authorization header:

Authorization: Bearer ptp_live_0123abc…
  • Keys are secrets: they are stored hashed server-side and displayed only once at creation. Lost key? Revoke it and create a new one.
  • One account, several keys: create up to 5 active keys to separate your projects. Your monthly free quota is counted per account, not per key.
  • Instant revocation: a revoked key stops working immediately, from the portal or the API response of a banned account.

POST /v1/convert

Upload + conversion in a single stateless call. One successful call costs at most 1 credit — failed, invalid or rate-limited calls cost nothing.

Request (multipart/form-data)

Field Type Default Description
file file The image to convert. PNG, JPEG, BMP or WebP · max 20 MB · max 50 Mpx · min 64×64 px.
colormode string color <code>color</code> uses the VTracer engine, <code>binary</code> uses Potrace (black & white).
mode string spline Color (VTracer) only — ignored in binary mode. spline | polygon | none
hierarchical string stacked Color (VTracer) only — ignored in binary mode. stacked | cutout
filter_speckle int 4 Color (VTracer) only — ignored in binary mode. 0–16 — remove small noise patches.
color_precision int 6 Color (VTracer) only — ignored in binary mode. 1–8 — number of significant bits per color channel.
layer_difference int 16 Color (VTracer) only — ignored in binary mode. 0–64 — distance between color layers.
corner_threshold int 60 0–180 — corner detection angle (both engines).
length_threshold float 4.0 3.5–10 — minimum segment length (both engines).
splice_threshold int 45 0–180 — path splicing angle (both engines).
path_precision int 3 0–8 — decimal digits in path coordinates.
invert bool false Binary (Potrace) only — ignored in color mode. Trace the light areas instead of the dark ones.
turdsize int 2 Binary (Potrace) only — ignored in color mode. 0–20 — suppress speckles up to this size.
alphamax float 1.0 Binary (Potrace) only — ignored in color mode. 0–1.334 — corner smoothing threshold.
opttolerance float 0.2 Binary (Potrace) only — ignored in color mode. 0–10 — curve optimization tolerance.

Two engines, chosen by "colormode"

The API runs the exact same engines as the free online converter and the desktop app:

binary — Potrace

Black & white tracing of line art, scans, sketches and logos. The dark part of the image (grayscale < 50%) is traced on a white background. Fine-tune the output with turdsize (noise removal), alphamax (corner smoothing) and opttolerance (path optimization).

color — VTracer

Layered color vectorization for illustrations, cartoons and photos. Control the level of detail with filter_speckle, color_precision, layer_difference and the curve fitting with mode (spline, polygon, none).

Images are preprocessed exactly like on the website: the longest side is resized to 1500 px before conversion, and the API returns the detected image type (line_art, logo, photo or illustration) in the X-Detected-Type header.

Response

On success: 200 OK with image/svg+xml — the body is the SVG file itself. Informative headers:

Header Description
X-Credits-RemainingPaid credits left on the account, after this call's debit.
X-Free-RemainingFree conversions left this month.
X-Detected-TypeDetected image type (info): line_art, logo, photo or illustration.
X-Processing-TimeServer processing time in seconds.

GET /v1/me

Account status for the key used to call it. Free — never counted against your quota, never debited.

Example response

GET /v1/me
Authorization: Bearer ptp_live_…

{
  "key": { "name": "prod", "prefix": "ptp_live_0123abc", … },
  "usage": {
    "month": "2026-09", "free_used": 7, "free_limit": 10,
    "free_remaining": 3, "resets_at": "2026-10-01T00:00:00+00:00"
  },
  "credits": { "balance": 120 }
}

Errors

Every error returns a consistent JSON envelope. Failed calls never consume credits.

HTTP/1.1 402 Payment Required
{
  "error": {
    "code": "quota_exceeded",
    "message": "Monthly free quota used and no credits left.",
    "usage": { "free_used": 10, "free_limit": 10, "credits": 0 }
  }
}
HTTP Code When
401invalid_api_keyMissing, malformed, unknown or revoked API key.
402quota_exceededMonthly free quota used and no credits left.
403account_bannedThe account is banned — all its keys are refused.
403ip_blockedCaller IP is blocklisted.
413file_too_largeFile larger than 20 MB.
422invalid_image / image_too_small / invalid_paramsInvalid image, image too small or invalid parameter value.
429rate_limitedPer-key rate limit exceeded (see below). Includes a Retry-After header.
500internal_errorConversion failed server-side — no credit is charged.

Rate limits

Limits apply per API key, not per IP, so a shared office or CI runner is never penalized for someone else's traffic.

Limit Value
Requests per minute, per key60
Requests per day, per key2 000
Concurrent conversions, per key2 (extra calls wait, then 429)
Max file size / resolution20 MB / 50 Mpx

Pricing

Every new account gets 10 free conversions every month, no credit card required. Need more? Buy prepaid images — any quantity (in batches of 50), with volume discounts. They never expire and stack with your monthly free quota (free conversions are consumed first).

Free

€0/month

  • 10 conversions / month
  • Both engines (Potrace + VTracer)
  • Up to 5 API keys
Create an account

Prepaid images

€0.050/ image

Volume pricing — the more images you buy, the cheaper each one gets
Images50–450500–2 4502 500–9 95010 000–49 95050 000+
€/image0.0500.0400.0300.0200.010
  • 1 image bought = 1 conversion (credits never expire)
  • Never expires, stacks with the free tier
  • Any quantity: €0.040/image from 500, down to €0.010/image
Buy images

Automatic credit: your balance is updated within seconds of the payment, via the payment webhook. Refunds deduct the purchased credits, capped at the current balance. Secure checkout by Lemon Squeezy (VAT handled automatically).

Code examples

Copy-paste and adapt. The API speaks plain multipart/form-data, so any HTTP client works.

cURL

curl -sS -f -X POST https://api.pixel-to-path.com/v1/convert \
  -H "Authorization: Bearer ptp_live_YOUR_KEY" \
  -F "[email protected]" \
  -F "colormode=color" \
  -F "filter_speckle=4" \
  -o photo.svg

Python

import requests

resp = requests.post(
    "https://api.pixel-to-path.com/v1/convert",
    headers={"Authorization": "Bearer ptp_live_YOUR_KEY"},
    files={"file": open("photo.jpg", "rb")},
    data={"colormode": "color", "filter_speckle": 4},
)
resp.raise_for_status()
print(resp.headers["X-Credits-Remaining"], "credits left")
with open("photo.svg", "wb") as f:
    f.write(resp.content)

JavaScript

const form = new FormData();
form.append("file", new Blob([imageBytes]), "photo.jpg");
form.append("colormode", "color");

const resp = await fetch("https://api.pixel-to-path.com/v1/convert", {
  method: "POST",
  headers: { "Authorization": "Bearer ptp_live_YOUR_KEY" },
  body: form,
});
if (!resp.ok) {
  const { error } = await resp.json();
  throw new Error(`${error.code}: ${error.message}`);
}
const svg = await resp.text();
console.log(resp.headers.get("X-Credits-Remaining"), "credits left");

Frequently asked questions

What counts as one conversion?

One successful POST /v1/convert call that returns an SVG. Failed calls (invalid image, wrong parameters, rate limited, server error) and GET /v1/me calls are never charged.

How is the monthly free quota counted?

Per account, on the UTC calendar month — it resets on the 1st at 00:00 UTC. Creating several API keys does not multiply the free quota: all keys of an account share the same 10 free conversions.

Do credits expire?

No. Purchased credits stay on your account until you use them. They are consumed only after your 10 free monthly conversions are exhausted.

How do I get more conversions in a month?

Buy prepaid images from the client portal — any quantity, in batches of 50. You always see exactly how many images you get: 50 images €2.50, 500 images €20, 2,500 €75, 10,000 €200, 50,000 €500. Credits are added to your account automatically within seconds of the payment — no license key, nothing to enter.

What happens if I lose my API key?

Keys are stored hashed, so they cannot be recovered. Revoke the lost key in the portal and create a new one — it takes effect immediately.

Which image formats are supported?

PNG, JPEG, BMP and WebP, up to 20 MB and 50 megapixels, at least 64×64 pixels. Images larger than 1500 px on their longest side are resized before conversion, exactly like on the free website.

Choose Your Version

Same powerful engine - pick the format that fits your workflow.

🌐

Online Tool

Free

Convert images right in your browser. No install, no account.

Open the tool
💻

Desktop App

Free & open source

The full converter on your machine, for Windows & Linux.

Download free
⌨️

Desktop App Pro

€39 one-time

Hot folder, batch conversion and CLI for heavy workloads.

Get Pro
🔌

API

Free tier + credit packs

One REST call: send an image, get a clean SVG. 10 free/month.

Get an API key

Ready to vectorize at scale?

Create your account, grab a key and make your first call in under two minutes.

Get your free API key