Nestpact API
A stable, versioned REST API for driving Nestpact from your own tooling: upload sheets and parts, start a nest, poll for the result, and download the layout as a DXF. Every call runs through the same engine as the app, so the API and the UI never drift.
Base URL
https://nestpact.app/api/v1Authentication
Create a key in the app under Settings → API keys (your account needs API access enabled). Send it on every request as a bearer token or an X-API-Key header. The secret is shown once at creation, so store it safely.
Authorization: Bearer sk_live_your_key_here
# or
X-API-Key: sk_live_your_key_hereEnd-to-end example
Start a nest, poll until it completes, then download the DXF. Pick your language:
# 1. Verify your key and see your plan + remaining quota
curl https://nestpact.app/api/v1/account \
-H "Authorization: Bearer sk_live_your_key_here"
# 2. Start a nest from two rectangles on a 1000x500 sheet
curl -X POST https://nestpact.app/api/v1/nest \
-H "Authorization: Bearer sk_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"material_coords": [[0,0],[1000,0],[1000,500],[0,500]],
"manual_parts": [
{"name": "bracket", "width": 120, "height": 80, "quantity": 6}
],
"optimization": "standard"
}'
# -> { "job_id": "…", "status": "queued" }
# 3. Poll until status == "completed"
curl https://nestpact.app/api/v1/nest/JOB_ID \
-H "Authorization: Bearer sk_live_your_key_here"
# 4. Download the nested DXF
curl https://nestpact.app/api/v1/nest/JOB_ID/dxf \
-H "Authorization: Bearer sk_live_your_key_here" \
-o nested.dxfResponse
A completed GET /nest/{id} returns the job summary. Read status to know when it is done, utilization for the packing density, and fetch /nest/{id}/dxf for the layout itself.
{
"job_id": "8f3c1a90-1e2b-4c77-9b0e-2a1f6d4c8e10",
"status": "completed",
"utilization": 82.4,
"placed_count": 6,
"unplaced_count": 0,
"elapsed_time": 3.1,
"success_rate": 100.0,
"placements": [
{ "name": "bracket", "pos_x": 120.0, "pos_y": 80.0,
"rotation": 90.0, "placed": true }
]
}
# Then fetch the layout itself:
# GET /api/v1/nest/8f3c1a90.../dxfEndpoints
| Method | Path | Description |
|---|---|---|
| GET | /account | Verify the key; returns plan, tier and remaining quota. |
| POST | /materials | Upload a sheet/material DXF. Returns a material_id. |
| POST | /parts | Upload one or more part files. Returns part ids. |
| POST | /nest | Start a nesting job. Returns a job_id. |
| GET | /nest/{id} | Poll a job: queued / processing / completed / failed. |
| GET | /nest/{id}/dxf | Download the nested layout as a DXF (once completed). |
The /nest body is the same shape the app posts: a material (material_id or material_coords), parts (part_ids or manual_parts), and parameters like gap_mm, rotation_step and optimization. Subscription tier, preset access and quota apply exactly as they do in the app.
Nest parameters
Every field accepted in the POST /nest body. Supply a material and parts; everything else is optional and falls back to the default.
| Field | Type | Default | Description |
|---|---|---|---|
material_id | string | — | Sheet from POST /materials. Use this OR material_coords. |
material_coords | number[][] | — | Sheet outline as [[x, y], …] in mm. Use this OR material_id. |
part_ids | string[] | — | Parts from POST /parts. Use this OR manual_parts. |
manual_parts | object[] | — | Rectangles: { name, width, height, quantity }. No upload needed. |
optimization | string | standard | fast · light · standard · deep · genetic · nfp (tier-gated). |
rotation_step | string | 30 | none · grain · 90 · 45 · 30 · 15 · free (degrees). |
sorting_strategy | string | area | area · width · height. |
gap_mm | number | 2.0 | Clearance left between parts. |
edge_offset_mm | number | 5.0 | Margin kept clear from the sheet edge. |
kerf_mm | number | 0.0 | Cut width compensation (laser/plasma/waterjet). |
tool_diameter_mm | number | 0.0 | Router bit diameter; added to the gap. |
hole_filling | boolean | true | Nest small parts inside larger parts' through-holes. |
fill_remaining | boolean | false | Duplicate small parts to fill leftover sheet space. |
nest_origin | string | bl | Packing corner: bl · tl · tr · br. |
fill_direction | string | y | Growth direction: y · x. |
units | string | mm | mm · in. Display/reporting only; math is always mm. |
ignored_layers | string[] | [] | Layer names to drop before nesting and from export. |
stop_conditions_enabled | boolean | false | Run the iterative optimiser until a stop target is met. |
stop_time_s | number | 300 | With stop conditions: time budget (hard-capped server-side). |
The GET /nest/{id}/dxf download also accepts parts_only and optimize_cut_path as query parameters.
Rate limits
Calls are rate-limited per key across three independent sliding windows (per minute, per hour, per day). Each response carries X-RateLimit-* headers so you can self-throttle; exceeding a window returns 429 with a Retry-After. Your subscription's monthly nesting quota applies separately and limits how many jobs you can start.
Errors
| Status | Meaning |
|---|---|
401 | Missing, invalid or revoked key. |
403 | API access not enabled for the account. |
429 | Rate limit hit. Back off per Retry-After. |
503 | The public API is currently turned off. |