Online Store Widget

API reference

The HTTP endpoints behind the widget: estimate and cart intent, with authentication and response shapes.

The widget and SDK cover the common path, but everything is also available as a plain HTTP API on the embed host (https://embed.scalarcut.com). Use it for headless or server-side integrations.

Authentication

API calls authenticate with a widget token issued to your account. Pass it as a Bearer token:

Authorization: Bearer $WIDGET_TOKEN

The token carries your enterprise id, the widget key id, and the catalog it is scoped to. Tokens are short-lived and rotated by the widget; your server obtains a fresh one for server-side calls.

Estimate

POST /v1/tiling/estimate

Runs the layout engine and returns the full bill of materials for a wall or floor. The body is the same layout document the studio builds:

curl -X POST "https://embed.scalarcut.com/v1/tiling/estimate" \
  -H "Authorization: Bearer $WIDGET_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "catalog": "YOUR_CATALOG_SLUG",
    "tile": { "sku": "CER-600-300" },
    "surfaces": [ { "width": 2.4, "height": 2.5, "openings": [] } ]
  }'

When a catalog is locked, the endpoint takes the tile's dimensions from the SKU, so a request can never drift from the catalog's real geometry.

Cart intent

POST /v1/tiling/cart-intent

Resolves a layout into cart lines without a browser:

curl -X POST "https://embed.scalarcut.com/v1/tiling/cart-intent" \
  -H "Authorization: Bearer $WIDGET_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "catalog": "YOUR_CATALOG_SLUG",
    "sku": "CER-600-300",
    "layoutFingerprint": "…",
    "quantities": { "boxes": 5 }
  }'

Response:

{
  "lines": [
    { "sku": "CER-600-300", "qty": 5, "unit": "box" }
  ],
  "layoutFingerprint": "…",
  "layoutToken": "…"
}

With consumables enabled for the store, the request may also carry adhesiveKg, groutKg, and primerL, and the response gains the corresponding adhesive, grout, and primer lines.

SDK

GET /v1/sdk.js

Serves the embed SDK your pages load. It is version-stable and safe to cache:

<script src="https://embed.scalarcut.com/v1/sdk.js"></script>

Errors

The API returns standard HTTP status codes with a JSON message:

  • 401 — missing or invalid token.
  • 403 — origin not allowed, or the action is disabled for the plan.
  • 404 — unknown catalog or SKU.
  • 422 — validation failed; the body carries errors keyed by field.