API reference · v1
Kerf API docs
Kerf is an HTTP API for true-shape nesting. Send parts (DXF, SVG, a CSV cut list, polygon coordinates or rectangle sizes) plus your sheet settings, and get back the position and rotation of every part, a nested DXF and SVG, and fabrication stats such as cut length and pierce count. All units are millimeters (mm), angles are in degrees, and the y axis points up. It also draws flat patterns for pipe jackets, boxes, segmented elbows and reducers: see POST /v1/flat-patterns.
Base URL: https://kerf.cerana.tech
Quickstart
- Sign in to the dashboard. New accounts start with 100 credits.
- Under “API keys”, create a key and copy the
kf_live_…value (it is shown only once). - Submit your first nest:
export KERF_KEY=kf_live_YOUR_KEY
curl https://kerf.cerana.tech/v1/nest \
-H "Authorization: Bearer $KERF_KEY" \
-H "Content-Type: application/json" \
-d '{
"parts": [
{ "id": "plate", "quantity": 8, "polygon": [[0,0],[120,0],[120,80],[0,80]] }
],
"config": { "sheetWidth": 600, "sheetHeight": 400, "spacing": 2 }
}'
The actual response to this request is shown under Response.
Authentication
Every /v1 endpoint requires an API key:
Authorization: Bearer kf_live_<32 alphanumeric characters>
Create and revoke keys in the dashboard. The server stores only a hash, so a lost key can’t be recovered: revoke it and create a new one. Each key is limited to 30 requests per minute; beyond that you get 429 rate_limited.
POST/v1/nest
Creates and runs a nest. The call is synchronous: the response is returned once nesting finishes (up to about 8 seconds on the free tier). If you don’t want to hold the connection open, use an async job with POST /v1/jobs, which takes exactly the same request body. You can send the request as JSON or as multipart.
Option 1: JSON
{
"parts": [
{ "id": "bracket", "quantity": 12, "dxf": "<base64 of the DXF file>" },
{ "id": "flange", "quantity": 4, "svg": "<svg xmlns=… width=\"160mm\" …>…</svg>" },
{ "id": "plate", "quantity": 4,
"polygon": [[0,0],[120,0],[120,80],[0,80]],
"holes": [[[20,20],[40,20],[40,40],[20,40]]] },
{ "id": "shelf", "quantity": 2, "rect": [564, 520] }
],
"config": {
"sheetWidth": 1829, "sheetHeight": 914, "spacing": 2, "margin": 5,
"rotationMode": "orthogonal", "autoWidth": false, "quality": "balanced",
"tabs": { "enabled": false }, "seed": 1
}
}
| Field | Type | Description |
|---|---|---|
parts[].id | string | Part ID, 1–80 characters (letters, including CJK, digits, spaces and . _ - ( ) [ ] # +). Must be unique within a request. Returned as partId in the response. If a DXF or SVG contains several separate shapes, it expands into id, id#2, id#3…, each with the same quantity. |
parts[].quantity | integer | Quantity, 1–100. |
parts[].dxf | base64 | DXF file contents. Arcs are kept as ARC entities in the output DXF. |
parts[].svg | string | Raw SVG text, or its base64. See SVG. |
parts[].units | string | SVG: mm, cm, in, pt or px, the size of one SVG user unit; if omitted, the SVG itself determines the scale. DXF: the units to assume when the drawing declares none ($INSUNITS missing or 0): mm, cm or in. Units declared in the drawing always win. |
parts[].polygon | [[x,y], …] | Outer contour vertices ({x,y} also accepted). Either winding order works, and you don’t need to repeat the first point. |
parts[].holes | [[[x,y], …], …] | Hole contours. Optional, and only valid with polygon. |
parts[].rect | [width, height] | Rectangle shorthand (mm), handy for panel cut lists. |
parts[].rotate | boolean | Optional, default true. false locks this part at 0°; other parts still follow the request-wide rotationMode. A locked part that only fits when rotated is reported as unplaced. |
config | object | Optional. See config parameters. Unknown fields return 400. |
Each part must have exactly one of dxf, svg, polygon or rect.
Option 2: multipart/form-data (upload files directly)
| Field | Description |
|---|---|
file | A DXF, SVG or CSV file. Repeat it to send several. The format is detected from the file contents; the extension is only a hint. For DXF and SVG, the filename becomes the part ID. |
quantity[<filename>] | Quantity for that file, default 1. Example: quantity[bracket_l.dxf]=6. For CSV, quantities are in the file itself. |
rotate[<filename>] | Send false to lock this part at 0° (see the table above). |
units[<filename>] / units | Units, for one file or for all files. For SVG, the user unit; for DXF, used only when the drawing declares no units (see parts[].units above). |
parts | A JSON array string of extra parts (same shape as parts[] in the JSON option). Can be mixed with uploaded files. |
config | The config object as a JSON string. |
webhookUrl | POST /v1/jobs only. See async jobs. |
curl https://kerf.cerana.tech/v1/nest \
-H "Authorization: Bearer $KERF_KEY" \
-F file=@bracket_l.dxf -F "quantity[bracket_l.dxf]=6" \
-F file=@disc.dxf -F "quantity[disc.dxf]=4" \
-F 'config={"sheetWidth":1829,"sheetHeight":914,"spacing":2}'
Add ?inline=svg, ?inline=dxf or ?inline=svg,dxf to get the SVG string and base64 DXF in the response itself, saving a download request.
Input formats
Every format ends up as the same kind of part, so you can mix them in one request. Sample files are hosted on the site for you to download and try: bracket_l.dxf, disc.dxf, gusset.dxf, plate_rounded.dxf, strip.dxf, flange.svg, cutlist.csv.
| Format | How to send | Curves in the output DXF |
|---|---|---|
| DXF | multipart file, or JSON dxf (base64) | Arcs kept as ARC entities |
| SVG | multipart file, or JSON svg (text or base64) | Curves converted to line segments (LINE) |
| Polygon JSON | JSON polygon + holes | Line segments |
| Rectangle | JSON rect: [width, height] | Line segments |
| CSV cut list | multipart file | Line segments (one rectangle per row) |
| DWG, PDF, AI | Not supported yet; returns 415 | — |
DXF
Reads common entities including LINE, ARC, CIRCLE, ELLIPSE, LWPOLYLINE, POLYLINE and SPLINE, and finds closed outer contours and holes automatically. Curves are temporarily discretized for the nesting computation (precision is set by config.curveTolerance), and the output DXF writes the original arcs back as ARC entities. An excerpt of the actual response to the multipart example above (6 × bracket_l.dxf, 4 × disc.dxf):
"stats": { "placed": 10, "total": 10, "sheetsUsed": 1, … },
"fabrication": {
"cutLength": 4033.63, "pierces": 26, …
"perPart": [
{ "partId": "bracket_l.dxf", "quantity": 6, "placed": 6, "width": 120, "height": 80,
"area": 4953.05, "cutLength": 462.83, "pierces": 3 },
{ "partId": "disc.dxf", "quantity": 4, "placed": 4, "width": 79.77, "height": 79.88,
"area": 4682.26, "cutLength": 314.16, "pierces": 2 }
]
}
To send a DXF as JSON, base64-encode it first, for example "dxf": "$(base64 < bracket_l.dxf)", or see Code examples.
Units, and drawings that won’t load
- When the DXF header’s
$INSUNITSsays inches, centimetres, metres and so on, coordinates are converted to mm andwarningssays so (an inch drawing is scaled by 25.4). - A drawing that declares no units (
$INSUNITSmissing or 0, common in R12 exports) is read as mm, andwarningsgives the size of its largest contour. If it was drawn in inches, addunits: "in"to the part (units[filename]=inin multipart) and send it again. - Loose LINE, ARC and SPLINE entities are chained into closed contours by their endpoints, and contours inside others become holes. Open chains that can’t be closed and unsupported entities such as text are skipped and listed in
warnings; a file with no closed contour at all returns400 invalid_input. - To check sizes before nesting, upload the file for a preview in the dashboard, or use the MCP
preview_partstool (both 0 credits).
SVG
- Reads
path,polygon,polyline,rect,circleandellipse, includingtransform. - Size comes from the root element’s
width/height(with units) andviewBox. Values without units are treated as px at 96 dpi (96 px = 25.4 mm). Useunitsto set one user unit directly to mm, cm, in, pt or px; width/height are then ignored. - Curves (Béziers, arcs, circles, ellipses) are flattened to polylines with a 0.1 mm chord tolerance, so arcs from an SVG come out as LINE segments in the output DXF, not ARC. Use DXF for parts that need ARC entities.
- An SVG with several separate shapes expands into that many parts:
id,id#2…
curl https://kerf.cerana.tech/v1/nest \
-H "Authorization: Bearer $KERF_KEY" -H "Content-Type: application/json" \
-d "$(jq -n --rawfile svg flange.svg '{
parts: [{ id: "flange", quantity: 4, svg: $svg }],
config: { sheetWidth: 600, sheetHeight: 400 } }')"
The sample flange.svg is a 160 × 100 mm flange plate (width="160mm") with a large center hole, 4 bolt holes and 1 slot. Response excerpt:
"perPart": [
{ "partId": "flange", "quantity": 4, "placed": 4, "width": 160, "height": 100,
"area": 13502.08, "cutLength": 862.91, "pierces": 7 }
]
For multipart uploads use -F file=@flange.svg -F "quantity[flange.svg]=4", adding -F "units[flange.svg]=mm" if needed. A two.svg containing two separate shapes, a rectangle and a circle, returns two parts: two.svg and two.svg#2.
Polygons and rectangles
curl https://kerf.cerana.tech/v1/nest \
-H "Authorization: Bearer $KERF_KEY" -H "Content-Type: application/json" \
-d '{
"parts": [
{ "id": "shelf", "quantity": 4, "rect": [564, 520] },
{ "id": "bracket", "quantity": 6,
"polygon": [[0,0],[120,0],[120,80],[0,80]],
"holes": [[[20,20],[40,20],[40,40],[20,40]]] }
],
"config": { "sheetWidth": 2440, "sheetHeight": 1220, "quality": "fast" }
}'
"perPart": [
{ "partId": "shelf", "quantity": 4, "placed": 4, "width": 564, "height": 520,
"area": 293280, "cutLength": 2168, "pierces": 1 },
{ "partId": "bracket", "quantity": 6, "placed": 6, "width": 120, "height": 80,
"area": 9200, "cutLength": 480, "pierces": 2 }
]
area is the net area with holes subtracted (120 × 80 − 20 × 20 = 9200), and pierces is the number of contours (outer contour plus holes).
CSV cut lists
One rectangular part per row: name,width,height,quantity[,rotate]. The header row is optional, and the delimiter can be a comma, semicolon or tab. Rows with false in the rotate column are locked and never rotated.
name,width,height,quantity,rotate side_panel,560,720,2,true top_panel,600,560,1,true shelf,564,520,2,true back_panel,600,720,1,false door,297,716,2,true kick_plate,600,100,2,true
curl https://kerf.cerana.tech/v1/nest \
-H "Authorization: Bearer $KERF_KEY" \
-F file=@cutlist.csv \
-F 'config={"sheetWidth":2440,"sheetHeight":1220,"spacing":4,"quality":"fast"}'
"stats": { "placed": 10, "total": 10, "sheetsUsed": 2, … },
"warnings": []
Unsupported formats
DWG, PDF and Adobe Illustrator (AI) files return 415 unsupported_format; convert them to DXF or SVG first. You get the same response whether you upload the file or use a dwg/pdf/ai field on a JSON part:
HTTP/1.1 415 Unsupported Media Type
{ "error": "unsupported_format",
"message": "part.dwg: DWG is not supported yet. Convert it to DXF or SVG, or join the waitlist for more input formats.",
"waitlist": "https://kerf.cerana.tech/waitlist/?feature=more-formats" }
DWG/PDF/AI input is coming soon. Join the waitlist to be notified when it launches.
config parameters
| Field | Default | Description |
|---|---|---|
sheetWidth | 1829 | Sheet length along X (mm). Ignored when autoWidth is on. |
sheetHeight | 914 | Sheet width along Y (mm). |
sheets | — | Multiple stock sizes [{ width, height, quantity? }], up to 5. When set, replaces sheetWidth/sheetHeight. See Multiple sheet sizes. |
autoWidth | false | Coil/strip mode: unlimited length on a single sheet. stats.usedWidth is the length to pull. |
spacing | 2 | Minimum gap between parts (mm). Usually the kerf width plus a safety margin. |
margin | 5 | Minimum distance from parts to the sheet edge (mm). |
rotationMode | "orthogonal" | "orthogonal" rotates only by 0/90/180/270; "free" rotates in steps of rotationStepDeg. |
rotationStepDeg | 15 | Free-rotation step. Minimum 15° on the free tier. |
curveTolerance | 0.25 | Maximum chord error (mm) when discretizing DXF curves. Affects only the nesting computation; the output keeps true arcs. SVG is always flattened at 0.1 mm. |
quality | "balanced" | "fast", "balanced" or "best". Sets the compute time; best costs 2× credits. See Quality presets. |
timeLimitMs | Per quality | Compute time in ms, set directly. Overrides quality (the response’s quality becomes "custom"). Clamped to 500–8000; above 4000 costs 2× credits. |
staleGenerations | 200 | Stop early after this many generations without improvement (10–600). |
population | 15 | Genetic algorithm population size (4–30). |
mutationRate | 0.1 | Mutation rate, 0–1. |
seed | 1 | Random seed. The same input and seed give the same result; change the seed to try other layouts. |
tabs.enabled | false | Enable micro-joints (tabs). |
tabs.width | 0.3 | Tab width: the length left uncut (mm). |
tabs.maxSpacing | 250 | Maximum distance between adjacent tabs along a contour (mm). |
tabs.minPerContour | 2 | Minimum number of tabs per outer contour. |
tabs.cornerClearance | 3 | Minimum distance from a tab to a corner (mm). |
tabs.minHoleSize | 40 | Holes smaller than this get no tabs (mm). |
Quality presets
config.quality sets how much compute time the nesting engine gets. More time usually means a tighter nest, but a slower response.
| quality | Compute time | Credits |
|---|---|---|
"fast" | 2 s | × 1 |
"balanced" (default) | 4 s | × 1 |
"best" | 8 s | × 2 |
Custom timeLimitMs | 500–8000 ms | × 2 above 4000 ms |
Compute time is a ceiling: jobs with few parts often converge before time runs out (stopReason: "stale"). The actual response for 12 plates of 120 × 80 mm with "quality": "best":
{ "id": "nst_4Zild9LCjZQV0IoJ5Ths", "cached": false, "creditsCharged": 4, "quality": "best", … }
The base cost for 12 parts is ceil(12 / 10) = 2, doubled for best, for 4 credits total. Sending the same parts with "timeLimitMs": 3000 instead returns "quality": "custom" and "creditsCharged": 2.
Multiple sheet sizes
If you have stock in several sizes, list them in priority order in config.sheets, up to 5. Kerf nests parts onto the first size (up to quantity sheets; omit it for unlimited), puts whatever doesn’t fit onto the second size, and so on. All sheets share a single compute-time budget.
curl https://kerf.cerana.tech/v1/nest \
-H "Authorization: Bearer $KERF_KEY" \
-F file=@bracket_l.dxf -F "quantity[bracket_l.dxf]=10" \
-F file=@gusset.dxf -F "quantity[gusset.dxf]=10" \
-F 'config={"sheets":[{"width":400,"height":300,"quantity":1},{"width":1000,"height":500}],"spacing":3,"quality":"fast"}'
The one 400 × 300 remnant is used first, and the remaining 5 parts go onto a 1000 × 500 sheet:
"stats": { "placed": 20, "total": 20, "sheetsUsed": 2, … },
"sheets": [
{ "index": 0, "stock": 0, "width": 400, "height": 300, "usedLength": 382.54, "placed": 15 },
{ "index": 1, "stock": 1, "width": 1000, "height": 500, "usedLength": 100, "placed": 5 }
],
"stocks": [
{ "index": 0, "width": 400, "height": 300, "quantity": 1, "sheetsUsed": 1 },
{ "index": 1, "width": 1000, "height": 500, "quantity": null, "sheetsUsed": 1 }
]
sheets[]: one entry per sheet actually used.stockpoints to the entry inconfig.sheets, andusedLengthis the length from x = 0 to the rightmost part plusmargin.placements[].sheetrefers toindexhere.stocks[]: how many sheets of each stock size were used (sheetsUsed).- Without
sheets, the response still includes both arrays, with a single stock size.
Response
The actual response to the Quickstart request (only the first 2 placements shown):
HTTP/1.1 200 OK
{
"id": "nst_OF7Qo4Y4zfuO3xuIrACt",
"cached": false,
"creditsCharged": 1,
"creditsRemaining": 99,
"quality": "balanced",
"stats": { "placed": 8, "total": 8, "sheetsUsed": 1, "utilization": 0.32,
"stripUtilization": 0.7773, "usedWidth": 247, "generations": 201, "stopReason": "stale" },
"placements": [
{ "partId": "plate", "instance": 0, "sheet": 0, "rotation": 0, "x": 5, "y": 5 },
{ "partId": "plate", "instance": 1, "sheet": 0, "rotation": 0, "x": 5, "y": 87 },
…
],
"sheets": [ { "index": 0, "stock": 0, "width": 600, "height": 400, "usedLength": 252, "placed": 8 } ],
"stocks": [ { "index": 0, "width": 600, "height": 400, "quantity": null, "sheetsUsed": 1 } ],
"fabrication": {
"cutLength": 3200, "pierces": 8, "partArea": 76800, "sheetArea": 240000,
"materialUsedArea": 100800, "utilization": 0.32,
"materialSaved": { "method": "bbox-columns", "baselineSheets": 1, "baselineArea": 100800,
"savedArea": 0, "savedPercent": 0 },
"perPart": [ { "partId": "plate", "quantity": 8, "placed": 8, "width": 120, "height": 80,
"area": 9600, "cutLength": 400, "pierces": 1 } ]
},
"warnings": [],
"sheetWidth": 600, "sheetHeight": 400,
"results": {
"dxf": "https://kerf.cerana.tech/v1/nests/nst_OF7Qo4Y4zfuO3xuIrACt/dxf",
"svg": "https://kerf.cerana.tech/v1/nests/nst_OF7Qo4Y4zfuO3xuIrACt/svg",
"json": "https://kerf.cerana.tech/v1/nests/nst_OF7Qo4Y4zfuO3xuIrACt/json"
},
"durationMs": 3629
}
placements: rotate the part’s original coordinates counterclockwise about the origin byrotationdegrees, then translate by(x, y).sheetis the sheet number (zero-based, matchingsheets[].index).usedWidth: the length actually used on the last sheet, which is the main optimization target.utilizationis net part area ÷ sheet area;stripUtilizationis net part area ÷ the area of the sheet section actually used.quality:fast,balanced,best, orcustomwhen you settimeLimitMs.stopReason:stale(converged),time_limit,budget(compute budget exhausted) orempty.fabrication: cut length, pierce count, areas and material savings. See Fabrication stats.warnings: parts that didn’t fit, DXF unit conversions or missing units, entities and open chains skipped while reading DXF/SVG, and so on.cached: truemeans the same input was computed before and the stored result was returned, at no charge. Send the request above again and the response is"cached": true, "creditsCharged": 0.
Fabrication stats
Every nest result includes fabrication at no extra cost, ready for estimating cutting time and cost. Lengths are in mm, areas in mm².
| Field | Meaning |
|---|---|
cutLength | Total cutting path length of all placed parts, including outer contours and holes. DXF arcs use their true arc length. With micro-joints (tabs) on, only segments that are actually cut count; the tabs left uncut are excluded. |
pierces | Pierce count: one per closed contour (each outer contour and each hole). With micro-joints on, each cut segment counts once. |
partArea | Total net area of placed parts (holes subtracted). |
sheetArea | Total full area of all sheets used. In coil mode (autoWidth), it is the length used × sheet width. |
materialUsedArea | Material actually used: for each sheet, the length from x = 0 to the rightmost part plus margin (i.e. sheets[].usedLength), times the sheet width, summed. |
utilization | partArea ÷ sheetArea. |
materialSaved | Material saved compared with a simple reference layout: method (currently always "bbox-columns"), baselineSheets, baselineArea (material used by the reference layout), savedArea = baselineArea − materialUsedArea and savedPercent = savedArea ÷ baselineArea. |
perPart[] | One entry per part: quantity (requested), placed (actually placed), width/height (bounding box), area (net area of one part), plus per-part cutLength and pierces (null if none were placed). |
The materialSaved reference layout
bbox-columns is a deliberately simple reference layout. It exists to give “how much did we save” a fixed, reproducible baseline, and is not the output of any other software or vendor:
- Each part is replaced by its unrotated bounding rectangle (rotated 90° only if it otherwise wouldn’t fit on the sheet).
- Each part type starts a new column, with bounding boxes stacked bottom to top along the sheet width using the same spacing as the real nest. When a column is full, the next one starts; when a sheet is full, the next sheet starts (with the same sheet order and quantity limits).
- Material used is measured the same way as for the real nest: for each sheet, from x = 0 to the rightmost part plus margin, times the sheet width.
When the parts are rectangles that already stack neatly into a column, the reference layout may already be optimal, and savedPercent is 0 (as in the Quickstart example above). The more irregular the shapes and the more part types, the bigger the gap tends to be. Actual result for the DXF example (6 L-brackets and 4 discs on a 1829 × 914 sheet):
"materialUsedArea": 118820,
"materialSaved": { "method": "bbox-columns", "baselineSheets": 1, "baselineArea": 193553.68,
"savedArea": 74733.68, "savedPercent": 0.3861 }
Async jobs and webhooks
Synchronous POST /v1/nest holds the connection open until nesting finishes. For batch work, or when your client has a timeout, use an async job instead: you get a job ID immediately, and when the job finishes Kerf notifies you (webhook), or you poll for it.
POST/v1/jobs
Takes exactly the same request body as POST /v1/nest (JSON or multipart), plus an optional webhookUrl (a top-level JSON field or a multipart field; must be https://). Credits are charged on submission and refunded automatically if the job fails.
curl https://kerf.cerana.tech/v1/jobs \
-H "Authorization: Bearer $KERF_KEY" \
-F file=@bracket_l.dxf -F "quantity[bracket_l.dxf]=12" \
-F file=@gusset.dxf -F "quantity[gusset.dxf]=8" \
-F 'config={"sheetWidth":1000,"sheetHeight":500,"spacing":3}' \
-F webhookUrl=https://example.com/hooks/kerf
HTTP/1.1 202 Accepted
{ "id": "nst_jhzSQ5NW4Yr6VnbwTFpp", "status": "queued", "creditsCharged": 2, "creditsRemaining": 84 }
If the same input was computed before, you still get a 202, but with "status": "done", "cached": true and "creditsCharged": 0. If you passed a webhookUrl, it is still notified.
GET/v1/jobs/:id
status goes queued → running → done or failed. Once finished, the response includes the same result fields as POST /v1/nest (stats, placements, sheets, stocks, fabrication, warnings, results). The job above, once done:
{
"id": "nst_jhzSQ5NW4Yr6VnbwTFpp",
"status": "done",
"mode": "async",
"source": "api",
"cached": false,
"instances": 20,
"creditsCharged": 2,
"quality": "balanced",
"summary": "bracket_l.dxf ×12, gusset.dxf ×8",
"createdAt": "2026-12-01T20:51:50.564Z",
"startedAt": "2026-12-01T20:51:50.585Z",
"finishedAt": "2026-12-01T20:51:54.671Z",
"durationMs": 4086,
"webhook": { "url": "https://example.com/hooks/kerf", "status": "delivered", "attempts": 1 },
"stats": { "placed": 20, "total": 20, "sheetsUsed": 1, "utilization": 0.1806, … },
"placements": [ … ],
"sheets": [ … ], "stocks": [ … ],
"fabrication": { "cutLength": 8414.34, "pierces": 52, … },
"warnings": [],
"sheetWidth": 1000, "sheetHeight": 500,
"results": { "dxf": "https://kerf.cerana.tech/v1/nests/nst_jhzSQ5NW4Yr6VnbwTFpp/dxf", … }
}
webhook.status:pending(still sending or waiting to retry),deliveredorfailed(retries exhausted). Without awebhookUrl,webhookisnull.- Failed jobs also include
error(the reason) andcreditsRefunded(credits returned). - Download result files from the URLs in
results, as described in Fetching results.
Webhook notifications
When a job finishes or fails, Kerf sends a POST to your webhookUrl with a JSON body:
POST /hooks/kerf HTTP/1.1
Content-Type: application/json
User-Agent: Kerf-Webhooks/1.0
Kerf-Event: nest.completed
Kerf-Signature: t=<Unix seconds>,v1=<64 hex characters>
{
"type": "nest.completed",
"createdAt": "2026-12-01T20:51:54.675Z",
"data": {
"id": "nst_jhzSQ5NW4Yr6VnbwTFpp",
"status": "done",
"cached": false,
"creditsCharged": 2,
"quality": "balanced",
"stats": { "placed": 20, "total": 20, "sheetsUsed": 1, "utilization": 0.1806, … },
"fabrication": { "cutLength": 8414.34, "pierces": 52, … },
"warnings": [],
"results": {
"dxf": "https://kerf.cerana.tech/v1/nests/nst_jhzSQ5NW4Yr6VnbwTFpp/dxf",
"svg": "https://kerf.cerana.tech/v1/nests/nst_jhzSQ5NW4Yr6VnbwTFpp/svg",
"json": "https://kerf.cerana.tech/v1/nests/nst_jhzSQ5NW4Yr6VnbwTFpp/json"
}
}
}
Webhooks don’t include placements; fetch coordinates from results.json or GET /v1/jobs/:id. On failure, Kerf-Event is nest.failed:
{ "type": "nest.failed", "createdAt": "…",
"data": { "id": "nst_…", "status": "failed", "error": "…", "creditsRefunded": 2 } }
- Any 2xx response from your server counts as delivered. Other status codes, timeouts (10 seconds) and connection failures are retried, up to 5 attempts in total, at intervals of: immediately, 10 seconds, 1 minute, 5 minutes and 30 minutes. Redirects (3xx) are not followed and count as failures.
- The same event may be delivered more than once (for example, if your server processed it but the response timed out), so deduplicate on
data.id. - The Webhooks page in the dashboard can send a test event (
Kerf-Event: ping) to any https URL and lists recent deliveries.
Verifying signatures
Each account has one webhook signing secret (whsec_…), which you can view or rotate on the Webhooks page in the dashboard. Kerf-Signature has the form t=<Unix seconds>,v1=<hex>, where:
v1 = hex( HMAC-SHA256( secret, t + "." + raw request body ) )
Always verify against the raw body bytes as received (don’t parse and re-stringify), use a constant-time comparison, and reject requests whose timestamp is more than 5 minutes from the current time to prevent replay attacks.
// Node 18+, no extra packages
import { createServer } from "node:http";
import { createHmac, timingSafeEqual } from "node:crypto";
const SECRET = process.env.KERF_WEBHOOK_SECRET; // whsec_…
export function verifyKerfSignature(rawBody, header, secret, toleranceSec = 300) {
const fields = {};
for (const kv of String(header || "").split(",")) {
const i = kv.indexOf("=");
if (i > 0) fields[kv.slice(0, i).trim()] = kv.slice(i + 1).trim();
}
const t = Number(fields.t);
if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > toleranceSec) return false;
const expected = createHmac("sha256", secret).update(`${fields.t}.`).update(rawBody).digest();
const got = Buffer.from(fields.v1 || "", "hex");
return got.length === expected.length ? timingSafeEqual(got, expected) : false;
}
createServer((req, res) => {
const chunks = [];
req.on("data", (c) => chunks.push(c));
req.on("end", () => {
const raw = Buffer.concat(chunks);
if (!verifyKerfSignature(raw, req.headers["kerf-signature"], SECRET)) {
res.writeHead(400).end("bad signature");
return;
}
const event = JSON.parse(raw.toString("utf8"));
if (event.type === "nest.completed") {
console.log(event.data.id, event.data.fabrication.cutLength, event.data.results.dxf);
}
res.writeHead(200).end("ok");
});
}).listen(8080);
# Python 3.8+, standard library only; Flask is used below to receive the webhook
import hashlib, hmac, os, time
from flask import Flask, request, abort
SECRET = os.environ["KERF_WEBHOOK_SECRET"] # whsec_…
def verify_kerf_signature(raw_body: bytes, header: str, secret: str, tolerance: int = 300) -> bool:
fields = dict(p.strip().split("=", 1) for p in (header or "").split(",") if "=" in p)
t = fields.get("t", "")
if not t.isdigit() or abs(time.time() - int(t)) > tolerance:
return False
expected = hmac.new(secret.encode(), t.encode() + b"." + raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, fields.get("v1", ""))
app = Flask(__name__)
@app.post("/hooks/kerf")
def kerf_hook():
raw = request.get_data() # raw bytes
if not verify_kerf_signature(raw, request.headers.get("Kerf-Signature", ""), SECRET):
abort(400)
event = request.get_json()
if event["type"] == "nest.completed":
print(event["data"]["id"], event["data"]["fabrication"]["cutLength"])
return "ok"
GET/v1/nests/:id
| Endpoint | Returns |
|---|---|
GET /v1/nests/:id | The nest result as JSON (same as the POST response, without the credit fields). |
GET /v1/nests/:id/dxf | The nested DXF: sheets laid out side by side along +X, sheet outlines on the SHEET layer and cut lines on the CUT layer. Arcs from DXF sources are ARC entities; SVG, polygon, rectangle and CSV sources produce LINE segments. |
GET /v1/nests/:id/svg | An SVG preview of all sheets, one <svg data-sheet data-stock> per sheet, stacked top to bottom. |
GET /v1/nests/:id/json | The raw result JSON. |
Only the account that created the nest can read it. Works with IDs from both synchronous and async jobs. Result files never change, so they are safe to cache, and are kept for 30 days. Downloading a nest right after it finishes can occasionally return 404 not_ready; wait a second and retry.
GET/v1/me
{ "email": "you@example.com", "credits": 100 }
POST/v1/flat-patterns
Generates the flat pattern (development) of a fitting: pipe jacket, rectangular box, segmented elbow or reducer. 1 credit per request, whatever the quantity. The response has every piece with its size, area, cut length, pierces and bend lines, DXF / SVG / JSON download URLs, and parts you can send unchanged to POST /v1/nest. Add nest to nest them in the same request. No code needed: free online calculators (the preview is free; the DXF download is the same 1 credit).
| Field | Type | Description |
|---|---|---|
kind | string | pipe-jacket, box, segmented-elbow, reducer. |
params | object | Dimensions for that kind (mm, degrees), see the tables below. Unknown fields are a 400. |
quantity | integer | How many fittings, 1–100, default 1; multiplies every piece. |
output | object | { "dxf": true, "svg": true, "inline": false }. With inline: true the response carries svg text and a base64 dxf. |
nest | object | Optional, the same object as the /v1/nest config. The pieces are nested right away and the response gets a nest field (same shape as a /v1/nest response), charged at the normal nest rate. |
Conventions
- Diameter (round fittings): insulated OD =
pipeOD + 2 × insulationThickness, or givejacketDiameter(the cladding's inside diameter).diameterBasispicks the diameter the development uses:inside= insulated OD,mean(default) = insulated OD + t,outside= insulated OD + 2t, with t =materialThickness(default 0.5). The diameter used comes back aseffective.effectiveDiameter. - Overlap
overlap(default 30): added on one side of the longitudinal seam, continuing the surface, with the last cut parallel to the seam. - Seam allowance
seamAllowance(default 0): added along the generatrix at both circumferential edges. - DXF:
$INSUNITS= 4 (mm); layersCUT(outlines and holes, to cut),BEND(fold lines, DASHED linetype, not cut) andMARK(reference lines and a "name xqty" TEXT label per piece, not cut). Each piece is drawn once, side by side, 10 mm apart. Outlines are LWPOLYLINE, the concentric reducer is LINE + true ARC entities, holes are CIRCLE. - parts: each piece's outline polygon (curves sampled at
curveTolerance, default 0.1 mm), holes and quantity, ready to use as/v1/nestparts. A nest made from them has straight-segment outlines; use the flat-pattern DXF itself when you need true arcs. - effective: every parameter (defaults included) and the derived values, e.g. the elbow's
jointAngleandthroatLength, the concentric reducer'scone. markLines: truedraws reference lines on MARK: where the overlap starts, the centre line of the elbow gores, and the end of the tangent on end pieces.
Pipe jacket pipe-jacket
| Param | Description |
|---|---|
pipeOD, insulationThickness, jacketDiameter, materialThickness, diameterBasis | Diameter, see conventions. |
length | Length of the run, required. |
overlap, seamAllowance, markLines | See conventions. |
One rectangle: width = π × D + overlap, height = length + 2 × seam allowance. Without the overlap the area is exactly π × D × length.
Rectangular box box
| Param | Description |
|---|---|
width, height, length | W, H and length, required. Faces are laid out at the given W and H, with no bend deduction. |
endCaps | Add two end caps (W × H), default false. |
capFlange | Flange on every cap side with f × f corner notches, default 0. |
pipeHoleDiameter, pipeHoleOffset {x, y} | Pipe hole in each cap (CIRCLE) and its offset from the centre; it must lie fully inside W × H. |
overlap, seamAllowance, markLines | See conventions. |
One sleeve: width = 2 × (W + H) + overlap, bend lines at W, W + H, 2W + H, and at 2(W + H) when the overlap is above 0: 4 bend lines with an overlap, 3 without (effective.bendCount). The 4 cap bend lines stop 1 mm short of the corners so that DXF readers never chain them into a closed loop that looks like a cut contour.
Segmented elbow segmented-elbow
| Param | Description |
|---|---|
| Diameter fields | As for the pipe jacket. |
bendRadius | Centreline bend radius R; must exceed the development radius r = D ÷ 2. |
angle | Total bend angle in degrees, 0–180. |
segments | Pieces n ≥ 2: two end pieces (half gores) + n − 2 middle gores; each joint turns β = angle ÷ (n − 1), at most 90°. |
tangentLength | Straight extension on the end pieces, default 0. |
curveTolerance | Chord error for sampling the curves, default 0.1 mm. |
Middle gore generatrix L(φ) = 2 tan(β/2) × (R + r cos φ), unrolled at x = r × φ; end piece = tan(β/2) × (R + r cos φ) + tangent. The longitudinal seam is at the throat (inside of the bend), so the pattern is widest in the middle. All pieces together cover 2πr × 2 tan(β/2) R × (n − 1): the pieces approximate the bend with cylinders, which is tan(β/2) ÷ (β/2) times the torus area 2πr × R × angle (radians), about 1.3% more for 90° in 5 pieces. The curves are LWPOLYLINE, not arcs.
Reducer reducer
| Param | Description |
|---|---|
type | concentric (default) or eccentric (one side flush). |
largeDiameter, smallDiameter | Bare pipe OD at the large and small end. |
insulationThickness | Insulation for both ends; largeInsulationThickness and smallInsulationThickness override it per end. |
largeJacketDiameter, smallJacketDiameter | Cladding inside diameters, instead of OD + insulation. |
height | Axial length, required. |
divisions | Triangulation divisions for the eccentric reducer, default 48. |
materialThickness, diameterBasis, overlap, seamAllowance, curveTolerance, markLines | See conventions. |
Concentric: s = √(h² + ((D1 − D2) ÷ 2)²), Ro = s × D1 ÷ (D1 − D2), Ri = Ro − s, sweep θ = 360 × D1 ÷ (2 Ro). The sector's arcs are true ARC entities in the DXF and its area is π (r1 + r2) s. The overlap sits outside one radial edge, parallel to it. effective.cone has slantHeight, outerRadius, innerRadius, sweepDeg, apexHeight and the apex position in the pattern, apexInPattern.
Eccentric: a slice of an oblique cone. Each generator's true length is measured from the apex and the surface is laid flat triangle by triangle; the developed edges are the chords of a divisions-gon, about 0.07% shorter than π × D at 48 divisions (effective.oblique lists both edge lengths). The seam is on the flush side, the shortest, vertical generator.
Equal development diameters are a 400 (use pipe-jacket), and so is a sweep plus overlap above 360°.
Response
The real response to the curl example below (a 90°, 5-piece elbow × 2, nested on a 2440 × 1220 sheet), trimmed:
{
"id": "fpt_XrfKz5uZew0zZzuJ40Q5", "kind": "segmented-elbow", "quantity": 2,
"effective": { "kind": "segmented-elbow", "pipeOD": 168.3, "insulationThickness": 50, "materialThickness": 0.5,
"diameterBasis": "mean", "insulatedDiameter": 268.3, "effectiveDiameter": 268.8,
"bendRadius": 229, "angle": 90, "segments": 5, "tangentLength": 0, "overlap": 30, "seamAllowance": 0,
"jointAngle": 22.5, "middleGores": 3, "endPieces": 2, "circumference": 844.46,
"throatLength": 37.634, "heelLength": 144.57, … },
"pieces": [
{ "name": "elbow-gore", "quantity": 6, "width": 874.46, "height": 144.56, "area": 78076.449,
"cutLength": 1842.094, "pierces": 1, "bendLines": [], "markLines": [], "polygon": [[0, 53.463], [17.489, 53.237], …], "holes": [] },
{ "name": "elbow-end", "quantity": 4, "width": 874.46, "height": 72.28, "area": 39038.224, "cutLength": 1795.507, … }
],
"totals": { "pieces": 10, "area": 624611.59, "cutLength": 18234.592, "pierces": 10 },
"parts": [ { "id": "elbow-gore", "quantity": 6, "polygon": [[0, 53.463], …] }, { "id": "elbow-end", "quantity": 4, … } ],
"warnings": [],
"creditsCharged": 2, "creditsRemaining": 97,
"results": { "dxf": "https://kerf.cerana.tech/v1/flat-patterns/fpt_XrfKz5uZew0zZzuJ40Q5/dxf", "svg": "…/svg", "json": "…/json" },
"nest": { "id": "nst_zaxOQiRtANouuHIAc72Q", "creditsCharged": 1, "stats": { "placed": 10, "sheetsUsed": 1, "utilization": 0.2098, … }, … }
}
creditsCharged = 1 + the nest's credits (1 + 1 here). results are owner-only: download them with the same key within 30 days, GET /v1/flat-patterns/:id/dxf, /svg, /json.
Chaining into nesting
- With
nest: the nest config and the instance limits (100 instances, 30 distinct parts) are checked before anything is charged; a bad config is a 400 or 402 at no cost. - If the nest fails (not enough credits, engine error, …) the flat pattern's credit is refunded too, and the error carries
flatPatternCreditRefunded: 1. - Without
nest: send the response'spartstoPOST /v1/nesttogether with your other parts to nest them all at once.
Examples
curl https://kerf.cerana.tech/v1/flat-patterns \
-H "Authorization: Bearer $KERF_KEY" -H "Content-Type: application/json" \
-d '{
"kind": "segmented-elbow",
"params": { "pipeOD": 168.3, "insulationThickness": 50, "bendRadius": 229, "angle": 90, "segments": 5 },
"quantity": 2,
"nest": { "sheetWidth": 2440, "sheetHeight": 1220, "quality": "fast" }
}' -o elbow.json
curl -s -H "Authorization: Bearer $KERF_KEY" "$(jq -r .results.dxf elbow.json)" -o elbow.dxf
// Node 18+ / Deno / Bun (keep the key on the server)
const res = await fetch("https://kerf.cerana.tech/v1/flat-patterns", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.KERF_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
kind: "reducer",
params: { type: "concentric", largeDiameter: 168.3, smallDiameter: 114.3, insulationThickness: 50, height: 200 },
}),
});
const fp = await res.json();
if (!res.ok) throw new Error(`${fp.error}: ${fp.message}`);
console.log(fp.effective.cone); // { slantHeight, outerRadius, innerRadius, sweepDeg, apexHeight, … }
// Nest them yourself: send parts unchanged to /v1/nest
const nest = await fetch("https://kerf.cerana.tech/v1/nest", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.KERF_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ parts: fp.parts, config: { sheetWidth: 2440, sheetHeight: 1220 } }),
}).then((r) => r.json());
# pip install requests
import os, requests
KEY = os.environ["KERF_KEY"]
H = {"Authorization": f"Bearer {KEY}"}
r = requests.post("https://kerf.cerana.tech/v1/flat-patterns", headers=H, timeout=60, json={
"kind": "box",
"params": {"width": 400, "height": 400, "length": 600, "endCaps": True, "capFlange": 25, "pipeHoleDiameter": 270},
})
fp = r.json()
r.raise_for_status()
for p in fp["pieces"]:
print(p["name"], p["quantity"], p["width"], "x", p["height"], "bends:", len(p["bendLines"]))
open("box.dxf", "wb").write(requests.get(fp["results"]["dxf"], headers=H, timeout=60).content)
Errors are plain 400s, for example:
{ "error": "invalid_input",
"message": "params: bendRadius 120 must be larger than the effective radius r = 134.4 mm (effective diameter 268.8 / 2): the throat of every gore is 2·tan(β/2)·(R − r) long, which is zero or negative when R ≤ r" }
AI agents can use the MCP tool generate_flat_pattern (see MCP server); the parts it returns go straight into nest_parts.
OpenAPI spec
Every /v1 request and response is described in https://kerf.cerana.tech/openapi.json (OpenAPI 3.1). Use it to generate a client or import it into API tools such as Postman. Any website can fetch it (CORS allows every origin).
curl -s https://kerf.cerana.tech/openapi.json | jq '.paths | keys'
MCP server (AI agents)
Kerf is also a remote MCP server, so AI agents can nest parts directly. The endpoint is https://kerf.cerana.tech/mcp (Streamable HTTP, JSON responses only: no SSE, no sessions). It supports MCP protocol version 2026-07-28 and the initialize-based versions 2025-11-25, 2025-06-18 and 2025-03-26.
Authentication is the same as /v1: Authorization: Bearer kf_live_…. Credits, the 30 requests per minute rate limit and the free-plan limits are the same too. Listing tools works without a key; calling a tool needs one.
Tools
| Tool | What it does | Credits |
|---|---|---|
nest_parts | Nests parts. Same input as the POST /v1/nest JSON body (parts as rect, polygon, base64 dxf or svg text; config with quality and sheet sizes). Returns stats, fabrication stats, placed count per part (placementsByPart), warnings and the DXF / SVG / JSON URLs. Add includePlacements: true for every placement, or returnFiles: ["svg"] / ["dxf"] to get the files inline (off by default: they can be large). | Same as /v1/nest |
preview_parts | Reads parts without nesting: bounding box, net area, cut length, pierces and warnings for each one (for example a DXF with no declared units). Use it to check sizes before nesting. | 0 |
get_nest | Fetches an earlier nest by ID; only the account that created it can read it. | 0 |
generate_flat_pattern | Flat patterns for pipe jackets, boxes, segmented elbows and reducers. Same input as POST /v1/flat-patterns (kind, params, quantity, output, nest); returns the per-piece numbers, result URLs and parts ready for nest_parts. | 1 (plus nest credits with nest) |
get_account | Credits left, free-plan limits and how credits are charged. | 0 |
Claude Code
claude mcp add --transport http kerf https://kerf.cerana.tech/mcp \ --header "Authorization: Bearer kf_live_..."
Add --scope project to write it to the project’s .mcp.json, or write that file yourself (${KERF_KEY} is read from the environment):
{
"mcpServers": {
"kerf": {
"type": "http",
"url": "https://kerf.cerana.tech/mcp",
"headers": { "Authorization": "Bearer ${KERF_KEY}" }
}
}
}
We connected Claude Code 2.1 to a local Kerf MCP server: it listed the tools (the four that existed before the flat-pattern tool) and called get_account.
Cursor
In ~/.cursor/mcp.json (all projects) or .cursor/mcp.json in a project:
{
"mcpServers": {
"kerf": {
"url": "https://kerf.cerana.tech/mcp",
"headers": { "Authorization": "Bearer ${env:KERF_KEY}" }
}
}
}
This follows Cursor’s MCP documentation; we haven’t tested it in Cursor yet.
Claude Desktop
In Claude Desktop’s config file (Settings → Developer → Edit Config), connect through the community bridge mcp-remote, which forwards the key to the remote server. It needs Node.js. Quit Claude Desktop completely and reopen it after editing.
{
"mcpServers": {
"kerf": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://kerf.cerana.tech/mcp",
"--header", "Authorization:${KERF_AUTH}"],
"env": { "KERF_AUTH": "Bearer kf_live_..." }
}
}
}
This setup comes from the mcp-remote documentation; we haven’t tested it in Claude Desktop yet.
Calling it over plain HTTP
curl https://kerf.cerana.tech/mcp \
-H "Authorization: Bearer $KERF_KEY" \
-H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"nest_parts",
"arguments":{"parts":[{"id":"plate","quantity":8,"rect":[120,80]}],
"config":{"sheetWidth":600,"sheetHeight":400}}}}'
Response excerpt (the same eight 120 × 80 plates as the quick start, so the numbers match):
"result": {
"content": [{ "type": "text", "text": "{ …same JSON as structuredContent… }" }],
"structuredContent": {
"id": "nst_PBG3u05crD2ikT9ACyI3", "quality": "balanced",
"stats": { "placed": 8, "total": 8, "sheetsUsed": 1, "utilization": 0.32, … },
"fabrication": { "cutLength": 3200, "pierces": 8, … },
"warnings": [],
"placementsByPart": [ { "partId": "plate", "placed": 8, "sheets": [0] } ],
"results": { "dxf": "https://kerf.cerana.tech/v1/nests/nst_PBG3u05crD2ikT9ACyI3/dxf", … },
…
}
}
- Without a key, or with a malformed or revoked one,
tools/callreturns a JSON-RPC error withcode401and amessagethat says where to create a key. - Other errors (
invalid_input,insufficient_credits,limit_exceeded,rate_limited, …) come back as a tool result withisError: trueand the same error JSON as the REST API. - Result URLs are the same as
/v1/nests/:id/*and need the same key to download.
Code examples
# 1. Submit a nest (DXF upload)
curl -s https://kerf.cerana.tech/v1/nest \
-H "Authorization: Bearer $KERF_KEY" \
-F file=@bracket_l.dxf -F "quantity[bracket_l.dxf]=12" \
-F 'config={"sheetWidth":1829,"sheetHeight":914,"spacing":3}' \
-o result.json
# 2. Check cut length and pierce count
jq '.fabrication | {cutLength, pierces}' result.json
# 3. Download the nested DXF
curl -s -H "Authorization: Bearer $KERF_KEY" \
"$(jq -r .results.dxf result.json)" -o nested.dxf
// Node 18+ / Deno / Bun / browser (keep your key on the server)
import { readFile, writeFile } from "node:fs/promises";
const form = new FormData();
form.append("file", new Blob([await readFile("bracket_l.dxf")]), "bracket_l.dxf");
form.append("quantity[bracket_l.dxf]", "12");
form.append("config", JSON.stringify({ sheetWidth: 1829, sheetHeight: 914, spacing: 3 }));
const res = await fetch("https://kerf.cerana.tech/v1/nest?inline=dxf", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.KERF_KEY}` },
body: form,
});
const job = await res.json();
if (!res.ok) throw new Error(`${job.error}: ${job.message}`);
const { cutLength, pierces } = job.fabrication;
console.log(`${job.stats.placed}/${job.stats.total} parts, ${job.stats.sheetsUsed} sheets, ` +
`cut ${cutLength} mm, ${pierces} pierces, ${job.creditsCharged} credits charged`);
await writeFile("nested.dxf", Buffer.from(job.dxf, "base64"));
// Sending a DXF as JSON: base64-encode it first
const body = {
parts: [{ id: "bracket", quantity: 12, dxf: (await readFile("bracket_l.dxf")).toString("base64") }],
config: { sheetWidth: 1829, sheetHeight: 914, quality: "fast" },
};
# pip install requests
import json, os, requests
KEY = os.environ["KERF_KEY"]
with open("bracket_l.dxf", "rb") as f:
r = requests.post(
"https://kerf.cerana.tech/v1/nest",
headers={"Authorization": f"Bearer {KEY}"},
files=[("file", ("bracket_l.dxf", f, "application/dxf"))],
data={
"quantity[bracket_l.dxf]": "12",
"config": json.dumps({"sheetWidth": 1829, "sheetHeight": 914, "spacing": 3}),
},
timeout=60,
)
job = r.json()
r.raise_for_status()
fab = job["fabrication"]
print(job["stats"], "cut", fab["cutLength"], "mm, pierces", fab["pierces"], "credits left:", job["creditsRemaining"])
dxf = requests.get(job["results"]["dxf"], headers={"Authorization": f"Bearer {KEY}"}, timeout=60)
open("nested.dxf", "wb").write(dxf.content)
Errors
Errors are always JSON: { "error": "<code>", "message": "description" }, sometimes with extra fields.
| HTTP | error | When |
|---|---|---|
| 400 | invalid_input | Malformed JSON, invalid fields, no closed contour found in a DXF/SVG, duplicate part IDs, a non-https webhookUrl, and so on. message names the offending field. |
| 401 | unauthorized | API key missing, malformed or revoked. |
| 402 | insufficient_credits | Not enough credits. The response includes creditsRequired and waitlist. |
| 402 | limit_exceeded | Over a free-tier limit (100 parts, 30 distinct parts, or compute). The response includes a waitlist link. |
| 404 | not_found / not_ready | The nest or job doesn’t exist, isn’t yours, or its result files are still being written. |
| 413 | too_large | Request larger than 5 MB. |
| 415 | unsupported_format | A DWG, PDF or AI file was uploaded. The response includes waitlist (?feature=more-formats). See Unsupported formats. |
| 429 | rate_limited | More than 30 requests per minute on one key. |
| 500 | engine_error / internal | The nesting engine failed. Any credits charged are refunded automatically (creditsRefunded). |
| 503 | unavailable | The async job queue is temporarily unavailable. Credits have been refunded; resubmit later. |
HTTP/1.1 402 Payment Required
{ "error": "limit_exceeded",
"message": "free tier allows at most 100 part instances per nest (got 120)",
"waitlist": "https://kerf.cerana.tech/waitlist/?feature=large-nest" }
Limits (free tier)
| Total parts per nest | ≤ 100 (sum of quantities; files with several shapes count after expansion) |
|---|---|
| Distinct parts | ≤ 30 (after expansion) |
| Request size | ≤ 5 MB |
| Compute time | quality 2/4/8 s, or timeLimitMs 500–8000, default 4000 |
| Stock sizes | Up to 5 in config.sheets |
| Free-rotation step | ≥ 15° |
| Rate limit | 30 requests per minute per key |
| Flat patterns | quantity 1–100; request ≤ 256 KB |
| Result retention | 30 days |
Need bigger nests? Join the large-nest waitlist.
Billing
- You get 100 credits when you sign up. On your first use each month, a balance below 100 is topped back up to 100.
- Each nest costs
max(1, ceil(total parts / 10))credits: 1–10 parts is 1 credit, 11–20 parts is 2 credits, 100 parts is 10 credits. quality: "best"(ortimeLimitMsabove 4000) costs 2×: for example, 12 parts on best costs 4 credits.- Synchronous and async jobs cost the same; async jobs are charged on submission.
- Resending the same input (same parts, quantities, config and seed) returns the cached result for 0 credits.
- Failed nests are refunded automatically; invalid requests (4xx) are never charged.
- A flat pattern (
POST /v1/flat-patterns) is 1 credit whatever the quantity; withnestthe nest is charged as usual on top, and everything is refunded if either step fails. - Paid credit packs are coming soon: join the waitlist.