Skip to content

API Reference

Start the server:

bash
covecto serve --port 3000

All endpoints are under /v1/.


GET /v1/health

Health check.

Response 200

json
{
  "status": "ok",
  "version": "0.1.0"
}

GET /v1/metrics

Server metrics since startup.

Response 200

json
{
  "request_count": 42,
  "avg_processing_ms": 23.5
}

POST /v1/vectorize

Vectorize an image.

Request multipart/form-data

FieldTypeRequiredDescription
filebinaryImage file (PNG, JPEG, WebP, BMP, GIF, TIFF)
enginestringauto, spline, pixel-exact (default: auto)
formatstringsvg, pdf, eps (default: svg)
presetstringvtracer preset: bw, poster, photo
profilestringProfile: icon, logo, photo, lineart
optimizebooleanRun SVG optimization (default: true)
optimize_presetstringdefault, safe, none
multipassbooleanMultiple optimization passes
color_precisionintColor quantization precision (1–32)
filter_speckleintSpeckle noise threshold
corner_thresholdintCorner detection (0–180)
splice_thresholdintPath splice (0–100)
color_modestringcolor or binary
hierarchicalstringstacked or cutout
path_simplifystringspline, polygon, none
layer_differenceintLayer difference threshold
length_thresholdfloatMinimum path length
max_iterationsintMax quantization iterations
path_precisionintCoordinate decimal places

Response 200 (format=svg)

json
{
  "svg": "<svg>...</svg>",
  "engine_used": "spline",
  "metadata": {
    "input_size": [128, 128],
    "svg_byte_size": 4520,
    "path_count": 24,
    "processing_time_ms": 12.3,
    "engine_used": "spline"
  }
}

Response 200 (format=pdf or eps)

Returns raw binary with Content-Type: application/pdf or application/postscript.

Error 400

json
{
  "error": "No file provided"
}

POST /v1/optimize

Optimize an existing SVG.

Request multipart/form-data

FieldTypeRequiredDescription
filebinarySVG file to optimize
presetstringdefault, safe, none (default: default)
multipassbooleanMultiple passes (default: false)
multipass_iterationsintPass count (default: 10)

Response 200

json
{
  "svg": "<svg>...</svg>",
  "original_size": 15240,
  "optimized_size": 8120,
  "reduction_pct": 46.7
}

OpenAPI Spec

The full OpenAPI 3.1 specification is available in the repository.