Skip to content

Last updated:

API Reference ​

Base URL: http://<your-server-ip-or-domain>:8080

Authentication ​

All business endpoints require this header:

HeaderValueRequired
X-API-KeyYour API key✅

Security note

Never hardcode the API key in frontend code. Use it in backend services or CI pipelines.

Async Task Flow ​

text
POST compress   → returns task_id
GET tasks/{id}  → pending / processing / completed / failed
GET download    → download the result file
statusMeaningAction
pendingQueuedKeep polling
processingIn progressKeep polling
completedDoneCall download
failedFailedCheck the error field

1. System Status ​

GET /api/v1/health ​

No authentication required.

Response 200

json
{ "status": "healthy", "version": "2.1.0", "uptime_seconds": 3600, "active_tasks": 0, "queue_length": 0 }

GET /api/v1/capabilities ​

Query the capabilities supported by this service.

Response 200

json
{
  "engines": {
    "draco":   { "available": true, "version": "…", "binary_path": "…" },
    "meshopt": { "available": true, "version": "…", "binary_path": "…" }
  },
  "formats": {
    "input":  ["glb", "gltf", "obj", "fbx", "stl", "dae", "ply"],
    "output": ["glb", "gltf", "obj", "stl", "ply"]
  },
  "license": { "authorized": true, "tier": 1, "status": "active" }
}

2. Model Compression ​

POST /api/v1/compress ​

Submit a compression task.

Headers

HeaderValue
Content-Typemultipart/form-data
X-API-KeyYour key

Body (form-data)

FieldTypeRequiredDescription
fileFile✅Model file (GLB/glTF/OBJ/FBX, etc.)
enginestring✅draco or meshopt
levelinteger❌Compression level 0–10 (0 = RAW, no compression), default 7. Higher = better compression
position_quantization_bitsinteger❌Position precision (Draco only), default 14, range 8–24
normal_quantization_bitsinteger❌Normal precision (Draco only), default 10
texcoord_quantization_bitsinteger❌UV precision (Draco only), default 12
color_quantization_bitsinteger❌Color precision (Draco only), default 8
generic_quantization_bitsinteger❌Generic attribute precision (Draco only), default 12
meshopt_compression_levelstring❌Meshopt level: high / medium / low, default high

Response 200

json
{
  "task_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "pending",
  "message": "Task submitted, queued"
}

3. Format Conversion ​

POST /api/v1/convert ​

Convert a model from one format to another.

Headers

HeaderValue
Content-Typemultipart/form-data
X-API-KeyYour key

Body (form-data)

FieldTypeRequiredDescription
fileFile✅Model file
target_formatstring✅glb / gltf / obj / fbx / stl / dae / ply

When the target is gltf, the output is a .zip bundle (containing the .gltf + .bin + textures).

Response 200

json
{
  "task_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
  "status": "pending"
}

4. Model Repair ​

POST /api/v1/repair ​

Automatically removes empty nodes, fixes normals, merges duplicate vertices, drops degenerate faces, etc.

Headers

HeaderValue
Content-Typemultipart/form-data
X-API-KeyYour key

Body (form-data)

FieldTypeRequiredDescription
fileFile✅Model file

Response 200

json
{
  "task_id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
  "status": "pending"
}

5. Model Diagnosis (Planned) ​

POST /api/v1/diagnose ​

The endpoint is reserved; this version returns 501 (not yet implemented). Model health checks are currently available only in the desktop app.


6. Texture Optimization ​

POST /api/v1/textures/optimize ​

Compress model textures or standalone images to JPEG/WebP/PNG.

Headers

HeaderValue
Content-Typemultipart/form-data
X-API-KeyYour key

Body (form-data)

FieldTypeRequiredDescription
fileFile✅Model file or standalone image
formatstring✅jpeg / webp / png
qualityinteger❌Quality 1–100, default 82 (JPEG/WebP); PNG compression level 1–9, default 6

Response 200

json
{
  "task_id": "d4e5f6a7-b8c9-0123-defa-234567890123",
  "status": "pending"
}

POST /api/v1/textures/ktx2 ​

The endpoint is reserved; this version returns 501 (KTX2 encoding not yet implemented). KTX2 encoding is currently available only in the desktop app.


7. Task Management ​

GET /api/v1/tasks/{task_id} ​

Query task status and progress by task_id.

Path parameters

ParameterTypeDescription
task_idstringUnique task identifier

Response 200 — in progress

json
{
  "task_id": "a1b2c3d4-...",
  "status": "processing",
  "progress": 65,
  "created_at": "2026-08-03T10:30:00Z",
  "started_at": "2026-08-03T10:30:01Z",
  "type": "compress",
  "input_filename": "model.glb",
  "input_size_bytes": 15728640
}

Response 200 — completed

json
{
  "task_id": "a1b2c3d4-...",
  "status": "completed",
  "progress": 100,
  "created_at": "2026-08-03T10:30:00Z",
  "completed_at": "2026-08-03T10:30:05Z",
  "type": "compress",
  "input_filename": "model.glb",
  "input_size_bytes": 15728640,
  "output": {
    "filename": "model_optimized.glb",
    "size_bytes": 3145728,
    "compression_ratio": 0.20,
    "savings_percent": 80.0
  }
}

Response 200 — failed

json
{
  "task_id": "a1b2c3d4-...",
  "status": "failed",
  "error": "draco_transcoder execution failed: exit code 1",
  "created_at": "2026-08-03T10:30:00Z",
  "failed_at": "2026-08-03T10:30:02Z"
}

Response field reference

FieldTypeDescription
task_idstringUnique task identifier
statusstringpending / processing / completed / failed
progressintegerProgress 0–100
typestringcompress / convert / repair / diagnose / texture_optimize / texture_ktx2
input_filenamestringOriginal file name
input_size_bytesintegerOriginal size (bytes)
output.filenamestringOutput file name (when completed)
output.size_bytesintegerOutput size in bytes (when completed)
output.compression_ratiofloatCompression ratio (compress/texture tasks)
output.savings_percentfloatSize reduction percentage (compress/texture tasks)
errorstringError reason (when failed)
created_atstringCreation time, ISO 8601
started_atstringStart time
completed_at / failed_atstringFinish time

GET /api/v1/tasks/{task_id}/download ​

Download the processed result file.

Path parameters

ParameterTypeDescription
task_idstringID of a completed task

Response 200

Returns the file as a binary stream (Content-Type: application/octet-stream).


8. Batch Processing ​

POST /api/v1/batch/compress ​

Submit multiple files for compression in one request; each file becomes an independent sub-task.

Headers

HeaderValue
Content-Typemultipart/form-data
X-API-KeyYour key

Body (form-data)

FieldTypeRequiredDescription
filesFile[]✅Multiple model files
enginestring✅draco or meshopt
levelinteger❌Compression level 1–10, default 7

Response 200

json
{
  "batch_id": "batch-abc123",
  "total": 3,
  "tasks": [
    { "task_id": "t1-...", "filename": "model1.glb", "status": "pending" },
    { "task_id": "t2-...", "filename": "model2.fbx", "status": "pending" },
    { "task_id": "t3-...", "filename": "scene.gltf", "status": "pending" }
  ]
}

GET /api/v1/batch/{batch_id} ​

Query the overall progress of a batch.

Path parameters

ParameterTypeDescription
batch_idstringUnique batch identifier

Response 200

json
{
  "batch_id": "batch-abc123",
  "status": "processing",
  "total": 3, "completed": 1, "failed": 0,
  "tasks": [
    { "task_id": "t1-...", "filename": "model1.glb", "status": "completed" },
    { "task_id": "t2-...", "filename": "model2.fbx", "status": "processing" },
    { "task_id": "t3-...", "filename": "scene.gltf", "status": "pending" }
  ]
}

Sub-tasks can be operated individually via task query and result download.


9. Licensing ​

POST /api/v1/license/verify ​

Verify whether a License Key is valid.

Body (JSON)

json
{ "license_key": "xxxx-xxxx-xxxx-xxxx" }

Response 200

json
{
  "success": true,
  "message": "license valid",
  "expires_at": 1796064000
}

expires_at is a Unix timestamp (seconds). This endpoint is intended for administration.


GET /api/v1/license/info ​

Query the current license status.

Response 200

json
{
  "authorized": true,
  "server_fingerprint": "a1b2c3d4e5f6…",
  "status": "active",
  "license_expires_at": 1796064000,
  "tier": 1,
  "days_until_expiry": 365,
  "machine_id": "server-machine-id"
}

tier: 0 = not licensed (trial limits), 1/2 = licensed tiers; license_expires_at is a Unix timestamp (seconds).


10. Monitoring ​

GET /api/v1/metrics ​

Prometheus-format metrics for Grafana integration.

MetricMeaning
zipoly_requests_totalTotal requests
zipoly_active_tasksCurrent concurrent task count
zipoly_queue_lengthTasks waiting in the queue
zipoly_task_processing_duration_secondsTask processing duration distribution
zipoly_tasks_completed_totalTotal completed tasks
zipoly_tasks_failed_totalTotal failed tasks
zipoly_errors_totalTotal errors

Error Codes ​

HTTPMeaningTypical scenario
400Bad requestUnsupported format, missing required field
402License limit exceededFile exceeds the plan's size/batch limit, or the license has expired
401UnauthorizedMissing/wrong X-API-Key
404Not foundInvalid task_id / batch_id
500Internal errorEngine execution failure, insufficient disk

Error response format

json
{ "error": "error description" }
ScenarioExample
Unsupported format{ "error": "unsupported format: .max" }
Missing required field{ "error": "missing required field: engine" }
Unauthorized{ "error": "unauthorized: missing or invalid X-API-Key header" }
Limit exceeded{ "error": "file size 512MB exceeds limit of 500MB for current license tier" }
Internal error{ "error": "internal error: draco_transcoder execution failed" }

Other Endpoints ​

Besides the business endpoints above, the server also exposes endpoints used by the web admin console (/config, /events SSE, /auth/me, /admin/*, etc.). They are rarely called directly and are not covered here.

Built for Web3D developers