Skip to content
NestSolver Docs
Browse the docs

Reference

Check a linear cut list

POST /v1/linear/validate

Check without solving: free.

Headers and parameters

Field Type Meaning
Idempotency-Key (header) string Send the same key and body to get the first answer again, for a day; nothing new starts.

Request body

A LinearRequest as JSON. Required fields are marked; the rest may be left out.

Field Type Meaning
v integer The form's version: 1.
unit required string The unit lengths are typed in. One of mm , cm , m , in
kerf required string The saw's kerf.
stock_mode string Lengths of stock, or a roll cut to length. "roll" needs the Bench plan; asked for on another plan, the request is refused with a 403. Anything but "roll" reads as "stock". One of stock , roll
miter_enabled boolean Whether parts' miter angles count. On every plan.
material_width string The stock's width, for miters.
target required string What the plan aims for. "cost" needs the Bench plan; asked for on another plan, the request is refused with a 403. One of bars , waste , drop , cost
strict required boolean Fail when a part is left out.
stocks required array of LinearStock The stock lengths to cut from. At most 100 rows.
parts required array of LinearPart The parts to cut. At most 1000 rows, and 20,000 pieces in all.

Responses

Status When Body
200 Whether the cut list is valid, and its problems. Validation
400 An Idempotency-Key that isn't 1 to 255 characters. Errors
401 No live API key. Errors
403 The plan doesn't include this; `upgrade` names the plan that does. Errors
409 A request with this Idempotency-Key is still running. Errors
413 A body over 4 MB. Errors
422 The request breaks a rule, each problem naming its field, or its Idempotency-Key was used for another request, or it holds more rows or longer text than the API takes. Errors
429 More than 300 free calls this minute (60 on Free), or more than 600 calls from this address. Errors
500 Something went wrong on our side; try again. Errors

Example

A sample request: the body's required fields, and one row of each kind when the body requires none.

curl -X POST https://api.nestsolver.com/v1/linear/validate \
  -H "Authorization: Bearer $NESTSOLVER_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "unit": "mm",
  "kerf": "3",
  "target": "bars",
  "strict": false,
  "stocks": [
    {
      "length": "6000",
      "qty": "10",
      "minimum_drop": "300",
      "zones": [
        {
          "start": "0",
          "end": "600",
          "keep": false
        }
      ]
    }
  ],
  "parts": [
    {
      "length": "1250",
      "quantity": "4",
      "label": "Side panel"
    }
  ]
}'

A 200 answer, required fields only; lists show one item:

{
  "valid": false,
  "errors": [
    {
      "field": "…",
      "message": "…",
      "upgrade": "free"
    }
  ]
}