Public API v1

Programmatic access to cutting calculations — the same algorithm the on-site calculator uses, callable from your own backend or script. Available on the PRO plan; keys are issued in your account.

Authentication

Every request must include an Authorization header with your key. The key is shown once, at creation time — save it immediately, since it can't be viewed again, only revoked and reissued.

Authorization: Bearer lc_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

The key only works while a PRO subscription is active — if it expires, requests with the key start getting 402 pro_required until you renew, with no need to reissue the key.

Endpoint

POST /api/v1/calc

Request body

Same format as the internal calculator: a list of stock, a list of cut pieces, and calculation settings.

{
  "stocks": [
    { "length": 6000, "quantity": null, "name": "Pipe 6m", "priority": 0 }
  ],
  "cuts": [
    { "length": 1740, "quantity": 3, "name": "Part A" },
    { "length": 950, "quantity": 5, "name": "Part B" }
  ],
  "settings": {
    "bladeThickness": 3,
    "trimEnds": 5,
    "optimizationMode": "balanced",
    "usefulLeftover": {
      "enabled": true,
      "minUsefulLength": 300,
      "maxWasteLength": 50,
      "strict": true
    }
  }
}

quantity: null on a stock item means unlimited supply. optimizationMode is fast, balanced, or max (all three modes are unrestricted for key holders). usefulLeftover is optional.

Response

{
  "result": {
    "usages": [ /* cutting schemes for each stock item */ ],
    "unusedStocks": [],
    "unfulfilledCuts": [],
    "stats": { "totalUsedLength": 5850, "totalWasteLength": 150, "utilizationPercent": 97.5, "stocksUsedCount": 1 }
  },
  "meta": { "isPro": true, "watermark": false, "optimizationModeUsed": "balanced" }
}

Example request

curl -X POST https://linearcut.ru/api/v1/calc \
  -H "Authorization: Bearer lc_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"stocks":[{"length":6000,"quantity":null,"name":"Pipe","priority":0}],"cuts":[{"length":1740,"quantity":3,"name":"Part"}],"settings":{"bladeThickness":3,"trimEnds":0,"optimizationMode":"fast"}}'

Limits and errors

  • 60 requests per minute per key.
  • 401 unauthorized — the key is missing, invalid, or revoked.
  • 402 pro_required — the key exists, but the PRO subscription isn't active.
  • 400 validation_error — invalid input format.
  • 429 rate_limited — rate limit exceeded.

Security

Treat the key like a password: use it only in server-side code. Don't call the API directly from browser JavaScript on a public page — any visitor would be able to see the key in network requests and use it on your behalf.

We use cookies for sign-in and to run the service. By continuing to use the site, you agree to their use in accordance with our Privacy Policy.