STL Converter API
使用转换服务创建异步任务、检查网格统计并下载生成文件。对外开放前请在自己的访问控制之后部署。
基础 URL 与访问
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://convertostl.com';接口
GET /api/healthchecks availability and reports queue, upload, and in-process conversion metrics.POST /api/jobsaccepts multipart fieldsoperation,outputFormat,options, and one or morefilefields.GET /api/jobs/:idreturns queued, processing, completed, or failed status plus mesh analysis.DELETE /api/jobs/:idcancels a queued job before processing starts.GET /api/jobs/:id/downloaddownloads the completed result.
创建转换任务
JavaScript clients can send the same multipart fields with FormData:
curl -X POST https://convertostl.com/api/jobs -F operation=convert -F outputFormat=stl -F [email protected]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 字段
| Field | Required | Values and notes |
|---|---|---|
operation | Yes | convert, analyze, repair, compress, reduce, split, or merge. |
file | Yes | One supported file up to 250 MB; merge accepts two or more STL/OBJ fields. |
outputFormat | For convert | stl, obj, glb, fbx, step, or 3mf. |
options | No | JSON object for image relief, SVG extrusion, STEP tessellation, or reduce/compress settings. |
轮询并下载
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 header.
curl -H "X-Job-Token: JOB_TOKEN" https://convertostl.com/api/jobs/JOB_ID
# Use the result.downloadUrl returned by the completed response:
curl -L -o result.stl "https://convertostl.com/api/jobs/JOB_ID/download?download_token=DOWNLOAD_TOKEN"错误代码
| HTTP | Code | When it occurs |
|---|---|---|
| 400 | MULTIPART_REQUIRED, FILE_REQUIRED, UPLOAD_LIMIT | Request format, file field, or 250 MB upload limit is invalid. |
| 403 | ORIGIN_NOT_ALLOWED | The browser origin is not in the configured exact-origin allowlist. |
| 415 | FORMAT_NOT_ALLOWED | The uploaded extension is outside the supported input formats. |
| 404 | JOB_NOT_FOUND, RESULT_MISSING | Job expired or its generated result is unavailable. |
| 409 | RESULT_NOT_READY, JOB_NOT_ACTIVE, JOB_ALREADY_PROCESSING | The result is not ready, or a job cannot be cancelled after processing starts. |
| 429 | RATE_LIMITED, JOB_QUEUE_FULL, UPLOAD_CONCURRENCY_LIMIT | The client or server queue capacity was reached. |
| 500 | INTERNAL_ERROR | Unexpected server failure; retry after checking service logs. |
支持的工作流与限制
Supported inputs include STL, OBJ, 3MF, GLB, FBX, STEP, IGES, DAE, PLY, BLEND, PNG, JPG, SVG, DXF, and ZIP. Reverse exports support OBJ, GLB, FBX, faceted STEP, and 3MF; ASCII STL can be normalized to Binary STL. Compress, reduce, split, and merge are real server operations: compression removes redundant geometry, reduction keeps a controlled triangle ratio, split returns connected components in a ZIP, and merge combines input surfaces into one STL without Boolean union. SCAD and STL to G-code remain guides because they require OpenSCAD or a printer-specific slicer. 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.