STL Converter
API / DOCUMENTATION

STL Converter API

Use the conversion service to create asynchronous jobs, inspect mesh statistics, and download the generated file. Deploy it behind your own access controls when exposing it to a wider audience.

Base URL and access

Use the same origin that serves this page as the API base URL. Each job returns a capability token in the JSON response; send it in the X-Job-Token header for status and cancellation. Bind jobs to an authenticated account and enforce plan quotas before sharing the service publicly.

const API_BASE = 'https://your-domain.example';

Endpoints

  • GET /api/health checks whether the service is available.
  • POST /api/jobs accepts multipart fields operation, outputFormat, options, and file.
  • GET /api/jobs/:id returns queued, processing, completed, or failed status plus mesh analysis.
  • DELETE /api/jobs/:id cancels a queued job before processing starts.
  • GET /api/jobs/:id/download downloads the completed result.

Create a conversion job

curl -X POST http://localhost:4173/api/jobs -F operation=convert -F outputFormat=stl -F [email protected]

JavaScript clients can send the same multipart fields with FormData:

const form = new FormData();
form.append('operation', 'convert');
form.append('outputFormat', 'stl');
form.append('file', file);
const response = await fetch(`${API_BASE}/api/jobs`, { method: 'POST', body: form });
const job = await response.json();

Multipart fields

FieldRequiredValues and notes
operationYesconvert, analyze, or repair.
fileYesOne supported file, up to 250 MB.
outputFormatFor convertstl, obj, glb, fbx, or step.
optionsNoJSON object for image relief, SVG extrusion, or STEP tessellation settings.

Poll and download

curl -H "X-Job-Token: JOB_TOKEN" http://localhost:4173/api/jobs/JOB_ID
# Use the result.downloadUrl returned by the completed response:
curl -L -o result.stl "http://localhost:4173/api/jobs/JOB_ID/download?download_token=DOWNLOAD_TOKEN"

Poll the status URL with the X-Job-Token header until it returns completed or failed. A completed response includes a relative result.downloadUrl containing a separate download-only token that expires after 10 minutes. API clients can also download with the original capability in the X-Job-Token header.

Error codes

HTTPCodeWhen it occurs
400MULTIPART_REQUIRED, FILE_REQUIRED, UPLOAD_LIMITRequest format, file field, or 250 MB upload limit is invalid.
403ORIGIN_NOT_ALLOWEDThe browser origin is not in the configured exact-origin allowlist.
415FORMAT_NOT_ALLOWEDThe uploaded extension is outside the supported input formats.
404JOB_NOT_FOUND, RESULT_MISSINGJob expired or its generated result is unavailable.
409RESULT_NOT_READY, JOB_NOT_ACTIVE, JOB_ALREADY_PROCESSINGThe result is not ready, or a job cannot be cancelled after processing starts.
429RATE_LIMITED, JOB_QUEUE_FULL, UPLOAD_CONCURRENCY_LIMITPer-client creation limit, upload concurrency, or server queue capacity was reached.
500INTERNAL_ERRORUnexpected server failure; retry after checking service logs.

Supported workflows and limits

Supported inputs include STL, OBJ, 3MF, GLB, FBX, STEP, PNG, JPG, SVG, DXF, and ZIP. Reverse exports support OBJ, GLB, FBX, and faceted STEP. Uploads are limited to 250 MB; ZIP jobs also have file-count and decompressed-size limits.

ZIP archives accept up to 100 nested files and a 128 MB decompressed/output safety budget by default. Mesh processing also enforces vertex and face limits. The default rate limit is 20 job creations per client per minute, with one active conversion and two pending jobs on the reference deployment.

Jobs and temporary files are retained only for the one-hour cleanup window. Download URLs expire after 10 minutes. Add authentication, aggregate edge rate limiting, request timeouts, a persistent result store, and container-level memory limits before exposing the API to an untrusted public network.

Back to STL Converter →