HTTP API
API Reference
Temporarily process ASCII or binary STL files into PNG images. No authentication is currently required.
Machine-readable specification: OpenAPI JSON
POST/api/render
Render an STL from one view, or render all six views into a ZIP archive. Files are processed in memory and are not retained.
curl -fsS \
-F [email protected] \
"http://localhost:5000/api/render?view=front&width=1024&height=768" \
-o front.png
# Install once: python -m pip install requests
import requests
params = {
"view": "front",
"width": 1024,
"height": 768,
"color": "4fb3ff",
"background": "161a20",
}
with open("model.stl", "rb") as model:
response = requests.post(
"http://localhost:5000/api/render",
params=params,
files={"file": ("model.stl", model, "model/stl")},
timeout=120,
)
response.raise_for_status()
with open("front.png", "wb") as output:
output.write(response.content)
| Parameter | Default | Accepted values |
|---|---|---|
view | front | front, back, left, right, top, bottom, or all |
width | 1024 | 128 to 2048 pixels |
height | 768 | 128 to 2048 pixels |
color | 4fb3ff | Six hexadecimal digits, with or without # |
background | 161a20 | Six hexadecimal digits, with or without # |
One view returns 200 OK with image/png. Set view=all to receive application/zip containing front.png, back.png, left.png, right.png, top.png, and bottom.png.
curl -fsS \
-F [email protected] \
"http://localhost:5000/api/render?view=all" \
-o stl-views.zip
# Install once: python -m pip install requests
import requests
with open("model.stl", "rb") as model:
response = requests.post(
"http://localhost:5000/api/render",
params={"view": "all"},
files={"file": ("model.stl", model, "model/stl")},
timeout=120,
)
response.raise_for_status()
with open("stl-views.zip", "wb") as output:
output.write(response.content)
Behavior and errors
Uploads must have an .stl filename. There is no application-level file-size or triangle-count limit. At most two renders run concurrently; another render receives 503 Service Unavailable.
API failures return JSON with an appropriate HTTP status:
{"error":"The uploaded file is not a valid ASCII or binary STL."}
| Status | Meaning |
|---|---|
400 | Missing or invalid multipart data, parameter, or file field |
405 | HTTP method is not supported by the endpoint |
415 | Filename does not end in .stl |
422 | STL data cannot be parsed or rendered |
500 | Rendering failed on the server |
503 | Both render workers are busy |
Privacy
API uploads are processed temporarily to produce the requested output. The application does not save the STL or its model metadata. The browser viewer remains fully local and does not use this endpoint.