Vectorize Image
Submit an image and convert it to vector SVG. Returns the SVG content directly in the response.
Quick Reference
POST/api/v1/vectorizemultipart/form-datahttps://api.veclify.comAuthentication
Include an Authorization header with your API key:
Authorization: Bearer vf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxObtain an API key from the API Keys page.
Vectorize Image POST /api/v1/vectorize
Request
| Method | POST |
| Content-Type | multipart/form-data |
| Base URL | https://api.veclify.com |
| Auth | Bearer Token |
Form Fields
| Field | Type | Required | Description |
|---|---|---|---|
| image | File | Yes | Image file (PNG / JPG / WebP, ≤10MB) |
| params | String (JSON) | No | JSON string of vectorization parameters |
Params Object
| Parameter | Type | Default | Description |
|---|---|---|---|
| mode | string | "auto" | Recognition mode: auto / photo / sketch |
| colorPrecision | integer | 6 | Color precision (1–8) |
| layerDifference | integer | 1 | Layer difference threshold (0–5) |
| cornerThreshold | integer | 60 | Corner detection threshold (0–180) |
| pathPrecision | integer | 4 | Path precision (1–10) |
| filterSpeckle | integer | 0 | Speckle filtering (0–20) |
| segmentLength | integer | 10 | Segment length (1–20) |
| spliceThreshold | integer | 45 | Splice threshold (1–90) |
| inputEnhance | boolean | false | Preprocess enhance before vectorizing |
| curveMode | string | "auto" | Curve mode: auto / polygon / spline / none |
Response Fields (200 OK)
| Field | Type | Description |
|---|---|---|
| id | string | Unique task/conversion ID (e.g. vec_lx..._ab3f2k) |
| svg | string | Full SVG markup content |
| width | integer | Original image width in pixels |
| height | integer | Original image height in pixels |
| node_count | integer | Number of SVG path nodes in the output |
| processing_time_ms | integer | Backend processing time in milliseconds |
| credits_remaining | integer | null | Remaining credits (Free plan users only; null for Pro/Lifetime) |
Example Response (200)
{
"id": "vec_m4x8k2_ab3f2k",
"svg": "<svg xmlns=\"http://www.w3.org/2000/svg" width=\"512" height=\"512" viewBox=\"0 0 512 512">\n <path d=\"M256 32L32 480h448L256 32z" fill=\"#4f46e5"/>\n</svg>",
"width": 512,
"height": 512,
"node_count": 3,
"processing_time_ms": 847,
"credits_remaining": 42
}Example Error Responses
401 — Invalid API Key
{ "error": "Invalid API key" }402 — Insufficient Credits
{ "error": "insufficient_credits", "credits_remaining": 0 }400 — Missing Image
{ "error": "Missing 'image' field in form data" }429 — Rate Limited
{ "error": "Rate limit exceeded. Try again in 12 seconds." }Error Codes Reference
| Status | Code | Description |
|---|---|---|
| 401 | — | Missing or invalid API key |
| 402 | insufficient_credits | Insufficient credits on account |
| 403 | — | Account is suspended or banned |
| 400 | — | Invalid request parameters or missing file |
| 429 | — | Rate limit exceeded — retry after the indicated seconds |
| 502 | — | Vectorization backend processing failed |
| 503 | — | Backend service unavailable |
| 500 | — | Internal server error |
Code Examples
cURL
curl -X POST https://api.veclify.com/api/v1/vectorize \
-H "Authorization: Bearer vf_YOUR_API_KEY" \
-F "[email protected]" \
-F 'params={"mode":"auto","colorPrecision":6}'
# Example response:
# {
# "id": "vec_m4x8k2_ab3f2k",
# "svg": "<svg xmlns=...>...</svg>",
# "width": 512,
# "height": 512,
# "node_count": 48,
# "processing_time_ms": 847,
# "credits_remaining": 42
# }Python
import requests
url = "https://api.veclify.com/api/v1/vectorize"
headers = {"Authorization": "Bearer vf_YOUR_API_KEY"}
with open("logo.png", "rb") as f:
files = {"image": ("logo.png", f, "image/png")}
data = {"params": '{"mode":"auto","colorPrecision":6}'}
resp = requests.post(url, headers=headers, files=files, data=data)
result = resp.json()
print(f"Task ID: {result['id']}")
print(f"Nodes: {result['node_count']}, Time: {result['processing_time_ms']}ms")
print(f"Credits remaining: {result.get('credits_remaining', 'N/A')}")
# Save SVG to file
with open("output.svg", "w") as out:
out.write(result["svg"])Node.js / TypeScript
import fs from "fs";
const form = new FormData();
form.append("image", new Blob([fs.readFileSync("logo.png")]), "logo.png");
form.append("params", JSON.stringify({ mode: "auto", colorPrecision: 6 }));
const res = await fetch("https://api.veclify.com/api/v1/vectorize", {
method: "POST",
headers: { Authorization: "Bearer vf_YOUR_API_KEY" },
body: form,
});
const result = await res.json();
console.log(`Task: ${result.id}, Nodes: ${result.node_count}`);
fs.writeFileSync("output.svg", result.svg);Rate Limits
| Plan | Rate Limit | Credits | Concurrency |
|---|---|---|---|
| Pro / Lifetime | Unlimited | N/A (unlimited) | No restriction |
| Free | Per-second burst protection | 1 credit per vectorization | 1 concurrent request |