Documentation

API documentation for OptimizeGLB

(For business users)

1. Compress API
Updated

Compress your GLB/GLTF files using our API

POST /api/compress
Headers
Authorization: Bearer `YOUR_API_KEY_HERE`
Content-Type: application/json
Request Body
Required fields:
name: string
fileUrl: string
fileName: string (optional)
textureFormat: webp | jpeg | png | avif (default: webp)
textureSize: 512 | 1024 | 2048 | 4096 (default: 2048)
advancedOptions: object (optional)
Advanced Options
All options are boolean unless specified:
dedup: Remove duplicate vertices
prune: Remove unused vertices
draco: Apply Draco compression
simplify: Enable geometry simplification
simplifyRatio: number (0-1, only if simplify is true)
instance: Instance duplicate meshes
flatten: Flatten node hierarchy
join: Join compatible meshes
weld: Weld vertices
Response
A binary stream of the compressed GLTF file or an error message
Example code
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'Bearer <YOUR_API_KEY_HERE>'
  },
  body: JSON.stringify({
    fileUrl: "<YOUR_FILE_URL_HERE>",
    fileName: "<YOUR_FILE_NAME_HERE>",
    textureFormat: "webp",
    textureSize: "2048",
    advancedOptions: {
      dedup: true,
      prune: true,
      draco: false,
      simplify: true,
      simplifyRatio: 0.5,
      instance: true,
      flatten: true,
      join: true,
      weld: true
    }
  })
};

fetch('https://optimizeglb.com/api/compress', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
If you face any issue feel free to reach out to me at support@optimizeglb.com

2. Model API
New

Retrieve details of a compressed model

GET /api/model/{id}
Headers
Authorization: Bearer `YOUR_API_KEY_HERE`
Content-Type: application/json
Response
Returns the details of a compressed model including:
  • id: Unique identifier of the model
  • url: Download URL for the compressed model
  • filename: Original filename
  • originalSize: Size of the original file in bytes
  • compressedSize: Size of the compressed file in bytes
  • conversionDate: Timestamp of when the conversion occurred
Example Response
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "url": "https://example.com/compressed_model.glb",
  "filename": "original_model.glb",
  "originalSize": 15000000,
  "compressedSize": 5000000,
  "conversionDate": "2024-01-01T12:00:00Z"
}
Example code
const options = {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer <YOUR_API_KEY_HERE>'
  }
};

fetch('https://optimizeglb.com/api/model/123e4567-e89b-12d3-a456-426614174000', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
If you face any issue feel free to reach out to me at support@optimizeglb.com