Gangnest

API

Gangnest HTTP API

Same nest engine as the builder. Point your order system at these endpoints when a customer (or your ops tool) has N logo files and a quantity for each.

POST/api/gang

Multipart upload for real files, or JSON if you already know print sizes in millimetres.

curl -X POST http://127.0.0.1:43188/api/gang \
  -F 'files=@logo-a.png' \
  -F 'files=@logo-b.png' \
  -F 'items=[
    {"file":"logo-a.png","qty":20,"widthMm":80},
    {"file":"logo-b.png","qty":8,"widthMm":120,"heightMm":40}
  ]' \
  -F sheetWidthMm=560 \
  -F maxSheetLengthMm=1000 \
  -F gapMm=2 \
  -F allowRotation=true \
  -F includePreviews=true

JSON-only (no image bytes) when you just need the nest plan:

curl -X POST http://127.0.0.1:43188/api/gang \
  -H 'content-type: application/json' \
  -d '{
    "designs": [
      {"id":"badge","name":"badge","widthMm":90,"heightMm":90,"qty":18},
      {"id":"word","name":"word","widthMm":140,"heightMm":45,"qty":12}
    ],
    "sheetWidthMm": 560,
    "maxSheetLengthMm": 1000,
    "gapMm": 2,
    "allowRotation": true
  }'

POST/api/gang/preview

Same multipart fields as above. Returns image/png for sheet 0 (or ?sheet=N). Response headers include X-Film-Used-Mm and X-Sheet-Count.

Response shape

{
  "ok": true,
  "summary": {
    "sheetCount": 1,
    "totalFilmMm": 620,
    "totalPlacements": 30,
    "unplacedCount": 0,
    "warningCount": 0
  },
  "sheets": [
    {
      "index": 0,
      "widthMm": 560,
      "usedLengthMm": 620,
      "placements": [
        {
          "designId": "logo-a.png",
          "name": "logo-a.png",
          "copyIndex": 0,
          "xMm": 0,
          "yMm": 0,
          "widthMm": 80,
          "heightMm": 80,
          "rotated": false
        }
      ],
      "utilization": 0.74
    }
  ],
  "warnings": [],
  "unplaced": []
}

Defaults

← Back to builder