GUIDES
Clean an SVG
An SVG can be cleaned or redrawn. A Clean keeps the drawing and its files cost no credit; a Redraw draws it again from its picture and is unlocked like any image.
Ask for a Clean
Upload the file as any image (POST /v1/uploads), then ask for a conversion with "tool": "clean". With no cleanOptions, every outline stays within the engine's default distance.
curl https://api.vecsnap.com/v1/conversions \
-H "Authorization: Bearer $VECSNAP_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "inputKey": "'$KEY'", "tool": "clean", "cleanOptions": { "maxMove": 1 } }'Choose what it may change
maxMove: How far any outline may move. Nothing is drawn again.background: Finds a page-sized box, so you can drop it.circles: Round shapes become true circles.rectangles: Boxes become true rectangles.fewerPoints: Redraws each outline with fewer points.joinColors: Touching shapes of one color become one.specks: Removes tiny dots.hiddenShapes: Removes shapes that never show.maxColors: Keeps at most this many colors.everyOutline: Also redraws the longest ones. Slow on big files.
A setting of the other tool, an unlock asked of a Clean, or a Clean of a picture is a 400 invalid_tool.
See what it did
GET /v1/conversions/{id}/cleaned: the anchor points before and after, the upload's size, the distance kept and each step that acted.GET /v1/conversions/{id}/original/facts: what the upload was, its anchor points, size and colors, for a Clean or a Redraw.GET /v1/conversions/{id}/download?format=web: its files, free, with no unlock.
When a Clean refuses
A file it cannot keep exactly fails with svg_not_cleanable, its reasons in failure.reasons: text, a picture inside, a clip path, some gradients. Nothing is charged. Ask again with "tool": "redraw" to draw all of it from the file's picture. A file reaching outside itself is svg_links_outside, for either tool.