docs
SupportConsole

Quote a customer's upload

A customer sends you a model. Your server slices it on the real engine and answers with a price, a print time and the grams of filament.

A customer uploads bracket.stl and asks what it costs. To answer, you need what the slicer would tell you if you opened the file yourself: how long it prints and how much filament it takes. Superslice runs that slicer for you and turns the numbers into a price with your own rates.

How it fits together

Your server holds the API key, the settings and the rates. The customer only ever talks to you. Each upload becomes one slice: you send the file and the settings, we slice it, and the result comes back with print_time_s, filament_g and a price.

Before you start

  • An API key with slices:write, slices:read and catalogue:read. New keys have all three.
  • The key in an environment variable on your server, never in the browser:
bash
export SUPERSLICE_API_KEY=sk_live_...

Pick your settings once

Choose the printer you quote for, then the process, filament and plate type that go with it. The catalogue lists them for each engine release. Start with the releases:

bash
curl https://api.superslice.co/v1/engines \
  -H "Authorization: Bearer $SUPERSLICE_API_KEY"

Then the printers on one release, and the processes for your printer:

bash
curl "https://api.superslice.co/v1/engines/bambu-studio@02.09.01.70+02.09.00.74/printers" \
  -H "Authorization: Bearer $SUPERSLICE_API_KEY"

curl "https://api.superslice.co/v1/engines/bambu-studio@02.09.01.70+02.09.00.74/processes?printer=Bambu%20Lab%20A1%200.4%20nozzle" \
  -H "Authorization: Bearer $SUPERSLICE_API_KEY"

Do the same for filaments and plate-types. Save the names in your config exactly as they come back. Tuned your own settings in a desktop slicer? Upload them as partner presets and use their ids instead.

Save your prices

Tell Superslice what you charge. These rules apply to every slice that succeeds from now on.

bash
curl -X PUT https://api.superslice.co/v1/pricing \
  -H "Authorization: Bearer $SUPERSLICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true,
    "currency": "USD",
    "minimum": "5.00",
    "lines": [
      { "name": "Filament", "basis": "gram", "amount": "0.04" },
      { "name": "Printer time", "basis": "hour", "amount": "1.50" },
      { "name": "Labour", "basis": "order", "amount": "3.00" },
      { "name": "Margin", "basis": "percent", "amount": "20" }
    ]
  }'

Pricing covers per-filament rates and how the total is rounded.

Send the upload

Post the customer's file with your saved settings. Use the order or cart id as the Idempotency-Key: if your request times out and you send it again, you get the same slice back, not a second one.

bash
curl https://api.superslice.co/v1/slices \
  -H "Authorization: Bearer $SUPERSLICE_API_KEY" \
  -H "Idempotency-Key: order-1042" \
  -F file=@bracket.stl \
  -F 'request={"slicer":"bambu-studio","printer":"Bambu Lab A1 0.4 nozzle","process":"0.20mm Standard @BBL A1","filament":"Bambu PLA Basic @BBL A1","plate_type":"Textured PEI Plate","callback_url":"https://shop.example.com/hooks/superslice","metadata":{"order_id":"1042"}}'

You get 202 and the slice, usually queued. If someone sent the same file with the same settings before, it's already succeeded and the quote is in this answer. That repeat is a cache hit and doesn't count toward your plan.

Get the result

When the slice finishes, we post slice.completed or slice.failed to your callback_url. Check the Superslice-Signature header first; Callbacks shows how. metadata comes back unchanged, so you know which order it belongs to.

No server to receive callbacks yet? Poll instead, every couple of seconds, until status is succeeded or failed:

bash
curl https://api.superslice.co/v1/slices/job_01936f... \
  -H "Authorization: Bearer $SUPERSLICE_API_KEY"

Show the quote

The slice carries everything the customer needs:

json
{
  "status": "succeeded",
  "result": { "print_time_s": 1208, "filament_g": 7.92 },
  "price": {
    "currency": "USD",
    "total_minor": 500,
    "lines": [
      { "name": "Filament", "basis": "gram", "amount": "0.04", "amount_minor": 32 },
      { "name": "Printer time", "basis": "hour", "amount": "1.50", "amount_minor": 50 },
      { "name": "Labour", "basis": "order", "amount": "3.00", "amount_minor": 300 },
      { "name": "Margin", "basis": "percent", "amount": "20", "amount_minor": 76 }
    ],
    "minimum_adjustment_minor": 42
  }
}

Amounts are in the currency's minor unit, cents for USD. Let the currency decide the decimals rather than dividing by 100, because some currencies have none:

js
const { currency, total_minor } = slice.price;
const format = new Intl.NumberFormat('en-US', { style: 'currency', currency });
const digits = format.resolvedOptions().maximumFractionDigits;
const total = format.format(total_minor / 10 ** digits); // "$5.00"
const minutes = Math.round(slice.result.print_time_s / 60); // 20

If it fails

A refused request has an error code and creates no slice. A slice that fails ends with status: failed and an error.code. These are the ones a customer upload runs into most:

CodeWhat happenedWhat to tell the customer
model_too_largeThe file is over 95 MBAsk for a smaller export
model_unreadableIt isn't a valid STL or 3MFAsk them to export the file again
model_out_of_bedIt doesn't fit your printerOffer a bigger printer, or ask them to scale it
unsupported_featureIt needs more than one filamentAsk for a single-colour model
slice_limit_reachedYour plan's slices are used upNothing; this one is yours. See Limits.
rate_limitedOver 20 requests a second on one keyWait for Retry-After, then send again

Every code is on the Errors page.