Vectorize
POST /v1/vectorize — raster image to SVG, DXF, or vector PDF
Converts a raster image into an editable vector file.
POST https://patentfig.ai/api/v1/vectorizeCost: 20 credits per call.
Image input
Two forms, shared by all image-accepting endpoints:
- JSON body with
imageUrl— a publicly reachable URL, or multipart/form-datawith afilefield.
Accepted formats: PNG, JPEG, WebP, TIFF. Max 10 MiB. An imageUrl and every redirect it follows must remain publicly reachable; the 10 MiB limit is enforced while downloading, including chunked responses.
Parameters
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
imageUrl / file | string / file | yes | — | The image to vectorize. |
format | "svg" | "dxf" | "pdf" | no | "svg" | Output format. PDF embeds the SVG for later extraction. |
engine | "lineart" | "trace" | no | "lineart" | See below. |
Choosing an engine
The engine field accepts "lineart" (default) or "trace" for backward compatibility. Both values run the same AI vision SVG redraw pipeline. Typical runtime is 1–3 minutes.
Request
curl -X POST https://patentfig.ai/api/v1/vectorize \
-H "Authorization: Bearer pfig_xxx" \
-H "Content-Type: application/json" \
-d '{
"imageUrl": "https://example.com/drawing.png",
"format": "dxf",
"engine": "lineart"
}'Response
{
"success": true,
"data": {
"url": "https://cdn.patentfig.ai/api/…/….dxf",
"format": "dxf",
"engine": "lineart",
"creditsConsumed": 20
}
}Errors
Common: INVALID_INPUT (400), FETCH_FAILED (422, imageUrl unreachable), INSUFFICIENT_CREDITS (402), GENERATION_FAILED (500). See Errors.
API Reference