Convert USDZ to GLB via API
The Sirv API can convert USDZ, OBJ, FBX and Blender files into GLB files. Those GLB files can then be served as they are in Sirv Media Viewer or converted to 360 spinning images or static images.
How to convert USDZ to GLB
1. Connect to the Sirv API and get a bearer token using the standard method.
2. Use the bearer token to submit an API request to the endpoint https://api.sirv.com/v2/files/3d/model2GLB. In your request, enter the path to your USDZ file using the filename field.
The following Curl example will convert a USDZ file at path /example-folder/example-file.usdz:
curl --request POST --url https://api.sirv.com/v2/files/3d/model2GLB --header 'Authorization: Bearer JIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGllbnRJZCI6IkoyU2xSWE04NE1VMlBCV1cwdW5UYkl' --header 'Content-Type: application/json' --data '{ "filename": "/example-folder/example-file.usdz" }'
The GLB file will be created at the same path but with a .glb extension, like this:
/example-folder/example-file.glb
3. A successful request will return a unique job ID, using JSON formatting:
{ "id": "DFLhz0pkNkv7vxTh7RcBqoQiBWWCAoSA" }
An unsuccessful request will return an error, such as a 429 error that you've reached your account limit:
{ "statusCode": 429, "error": "Too Many Requests", "message": "rest:post:files:3d:model2GLB rate limit exceeded: too many requests (0). Please stop sending requests until 2024-11-11T22:58:13.000Z (UTC), then try again. Additional failed requests will increase the wait time. Please visit https://sirv.com/help/articles/sirv-rest-api/#429-rate-limit-too-many-requests"
Contact the Sirv team if you need help with an error.
4. The GLB file is now being prepared. It typically takes 5-30 seconds to convert the USDZ file but if there is a queue of others waiting to be converted, it will take longer. You can check if your job has completed by submitting a GET request to endpoint v2/files/3d/model2GLB with the job ID in the URL.
This example uses Curl:
curl --request GET --url 'https://api.sirv.com/v2/files/3d/model2GLB?id=DFLhz0pkNkv7vxTh7RcBqoQiBWWCAoSA' --header 'Authorization: Bearer JIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGllbnRJZCI6IkoyU2xSWE04NE1VMlBCV1cwdW5UYkl'
The response will show the percentage completed from 0-100. If it is 0, then it is either waiting or being prepared. 100 indicates that it has completed.
Example response:
{ "progress": 100 }
Hourly API limit
Your account can submit a certain number of GLB creation requests per hour, depending on your Sirv plan:
- Enterprise: 100 requests / hour
- Business 100+: 30 requests / hour
- Business: 10 requests / hour
- Trial: 2 requests / hour
- Free: 0
Conversion accuracy
You should view your new GLB file after conversion, to confirm that it looks accurate. Normally, the GLB will look identical to the original USDZ (or other) file but if the original file had an unexpected configuration, it might not look exactly correct. In this case, you can try resaving your original file or you could modify the GLB.
The Sirv team can help you investigate a file that didn't convert. Please send our team the URL of the converted file.
Get help
For help with the Sirv REST API, contact our customer success team and we'll reply within 24 hours.