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 MB.
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
lineart— AI redraws the figure as clean single-stroke patent line art. Each drawn line becomes one path, which is what makes DXF usable in CAD. Best for patent figures.trace— traces the input pixels faithfully, preserving fills and shading. Best when the vector output must match the original image. Note: trace produces filled outlines, so DXF output may contain double lines — preferlineartfor CAD.
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.
PatentFig AI Docs