# Convert USDZ to GLB

The Sirv API can convert USDZ, OBJ, FBX, STL and Blender files into GLB files.

Using an AI coding agent?

Install the [`sirv-api`](https://www.skills.sh/sirv/image-optimization-skill/sirv-api) skill, and your agent can call the Sirv API for you. Ask in plain words, such as “Upload the photos in /shoots/spring and tag them by product.” [See all 8 skills](/help/rest-api/sirv-skills-for-ai-agents/)

Those GLB files can then be served as they are in [Sirv Media Viewer](/help/sirv-media-viewer/media-types/3d-model/) or converted to [360 spinning images](/help/sirv-media-viewer/advanced-implementation/convert-3d-model-to-360-spin/) or static images.

## How to convert USDZ to GLB

**1.** Connect to the Sirv API and [get a bearer token](/help/rest-api/reference/authentication/) 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. An [API search](/help/rest-api/search-files-with-the-api/) can find the paths of all your USDZ files.

The following Curl example will convert a USDZ file at path /example-folder/example-file.usdz:

```bash
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:

```js
/example-folder/example-file.glb
```

**3.** A successful request will return a unique job ID, using JSON formatting:

```js
{
  "id": "DFLhz0pkNkv7vxTh7RcBqoQiBWWCAoSA"
}
```

An unsuccessful request will return an error, such as a 429 error that you’ve reached your account limit:

```js
{
  "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 /rest-api/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:

```bash
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:

```js
{
  "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: 5 requests / hour
-   Free: 0

## Conversion accuracy

You should view your new GLB file after conversion, to confirm that it looks accurate. You can then [add meta](/help/rest-api/add-meta-with-the-api/) to it, such as a title or description, via the API.

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](https://sirv.com/help/support/#support) the URL of the converted file.
