# Convert & Compress

## Convert or Compress a 3D asset

<mark style="color:green;">`POST`</mark> `https://api.echo3D.com/convertCompress`

This endpoint allows you to convert or compress a 3D model.

#### Request Body

| Name                                         | Type   | Description                                                                                                                                                                              |
| -------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| key<mark style="color:red;">\*</mark>        | string | Your API key.                                                                                                                                                                            |
| email<mark style="color:red;">\*</mark>      | string | Your email address                                                                                                                                                                       |
| userKey<mark style="color:red;">\*</mark>    | string | Your authentication key                                                                                                                                                                  |
| conversion<mark style="color:red;">\*</mark> | string | The target file format. Options: `obj`, `fbx`, `gltf`, `glb`, `usdz,` `stl`                                                                                                              |
| compression\*                                | string | The target compression. Options: `draco`, `ultimate`, `reduce` (PolyReduce), `resize`                                                                                                    |
| ratio                                        | string | For `reduce`  (ex: `reduce=10` to reduce model polygons by 10%) and `resize` (ex: `resize=50` to rescale the model to 50% of original                                                    |
| entryId<mark style="color:red;">\*</mark>    | string | Collection asset to be converted or compressed. If not provided, request is assumed to be discrete file and will return PUT url for uploading (See discrete file request section below)  |
| downloadFile                                 | string | By default, conversions are saved to the asset and compressions are returned as files. Set this to `true` for a conversion result to also be returned by the request as a file download. |
| secKey                                       | string | Your Secret key. Required if enabled through the [Security page](/web-console/manage-pages/collections-and-sharing/security.md#secret-key).                                              |
| gltftransform                                | string | The `gltf-transform` command to run (list of commands can be found [here](https://gltf-transform.donmccurdy.com/cli.html)).                                                              |
| filename\*                                   | string | Required for discrete file requests, the name of the file including extension, eg `cat.glb`                                                                                              |
| fileId                                       | string | For discrete file requests                                                                                                                                                               |

{% tabs %}
{% tab title="200 Obtain a Presigned Url" %}

```
{
    url: "https://"
    fileId: 1231-123145-12313-123123
}
```

{% endtab %}

{% tab title="200 Obtain jobId " %}
`some-uuid-here-1234`
{% endtab %}

{% tab title="200 Obtain Download Url" %}
`https://`
{% endtab %}
{% endtabs %}

## Discrete File Request Flow

For compression and conversion on files that are not a part of your collection.

1. Send a POST request as outlined above, omitting `entryId` but including a `filename`. A successful request will return `200 OK` and a JSON object containing a PUT `url` and a `fileId` :
   1. ```
      {
          url: "https://"
          fileId: 1231-123145-12313-123123
      }
      ```
2. Use the PUT `url` to upload your file
3. When your upload is complete, add a `fileId` parameter with the value from the response in step (1)  to your request and send it again. A successful response will return a string  `jobId`&#x20;
4. Replace the `fileId` parameter with the key `jobId`, and its value containing the `jobId` returned in the response from your previous request. Send it once more. When the operation is complete, the server will return a url to download your file. It may take several minutes for a url to become available for larger files.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.echo3d.com/api/convert.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
