---
title: Download a model
summary: Download the original file of a version, the same model as ifcXML or converted to IFC4, or a whole folder as a zip archive.
order: 50
languages: [javascript, java, php]
terms: [version, node]
see-also: [how-to/models/list-the-tree, how-to/models/upload-a-model, reference/file-types, reference/bul, api]
---

# Download a model

For an integration that needs the files back: an archive, a hand-over, a conversion by another tool. Four downloads exist, all on the `model:read` scope: the **original** file of a [[term:version|version]], byte for byte as it was uploaded; the same model serialised as **ifcXML**; the same model **converted to another IFC schema**; and a **zip** of a folder with the latest version of every model in it.

## Before you start

- A login with the `model:read` scope. Note that a viewer token issued with only `geometry:read` cannot download; that is the point of the split.
- The version UUID (or, for the zip, the folder's node UUID), see [[page:how-to/models/list-the-tree]].

## 1. The original file

```code-group {#original} classic
```javascript
// The SDK answers with a URL that is valid for a short time
const url = await client.ifc.downloadOriginalIfc(BIM_WORKS_FIRST_MODEL);
window.location.href = url;              // in a page: let the browser save it
const bytes = await (await fetch(url)).arrayBuffer();   // or read it yourself
```
```java
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;

try (InputStream in = client.ifc.downloadModel(UUID.fromString(BIM_WORKS_FIRST_MODEL))) {
	Files.copy(in, Paths.get("house.ifc"), StandardCopyOption.REPLACE_EXISTING);
}
```
```

```sdk-example
operation: Download
body: |
  {
    "type": "VersionModelIdentifier",
    "uuid": BIM_WORKS_FIRST_MODEL
  }
```

The methods: `downloadOriginalIfc` on [[js:@bimworks/jssdk/Ifc|Ifc]], `IfcApi.downloadModel` on [[java:nl.bimbase.bimworks.client.apis.IfcApi|IfcApi]] (an `InputStream` you close), `ModelApi::download` in [[page:reference/sdk/php]]. The .NET SDK has no download method; use the HTTP operations. Over HTTP there are two: [[openapi:Download]] with a model identifier in the body, and [[openapi:Version]], a `GET` on `/openapi/Versions/{uuid}` that fits a download link:

```try-it
operation: Download
method: POST
path: /openapi/model/Download
body: |
  {
    "type": "VersionModelIdentifier",
    "uuid": BIM_WORKS_FIRST_MODEL
  }
```

The reply is the file with its original name in `Content-Disposition` and a content type by extension (`application/ifc`, `application/e57`, `application/pdf`, …). Most models are stored Brotli-compressed, and those are sent with `Content-Encoding: br`; every browser and `curl --compressed` decode that, a hand-written HTTP client must too. A version created by an edit transaction has no original file yet and answers [[error:TRANSACTION_ERROR]].

## 2. As ifcXML

The stored model is serialised on the first request and cached, so the first download of a version takes longer. The dialect follows the model's schema: ISO 10303-28 for IFC2X3, ifcXML4 for IFC4 and IFC4X3.

```code-group {#ifcxml}
```javascript
const url = await client.ifc.downloadIfcXml(BIM_WORKS_FIRST_MODEL);
```
```java
try (InputStream in = client.ifc.downloadIfcXml(UUID.fromString(BIM_WORKS_FIRST_MODEL))) {
	Files.copy(in, Paths.get("house.ifcxml"), StandardCopyOption.REPLACE_EXISTING);
}
```
```

`downloadIfcXml` is on [[js:@bimworks/jssdk/Ifc|Ifc]] and [[java:nl.bimbase.bimworks.client.apis.IfcApi|IfcApi]]; over HTTP [[openapi:DownloadIfcXml]] takes the same body as `Download` and answers `application/xml`. The generated PHP client has no method for it yet.

Any IFC version can be downloaded this way, whatever it was uploaded as, and the other direction works as well: a version that was uploaded as ifcXML can be downloaded as STEP. The result of a query can be ifcXML too: [[openapi:Query]] with `Accept: application/xml`. In the app, the version dropdown offers *ifcXML* when the account has the [[feature:IFC_XML]] feature, and labels an XML original *Original (ifcXML)*. Schema validation of the XML against the XSD, and ifcJSON, are not available.

## 3. In another IFC schema {#converted}

An IFC2X3 model can be downloaded as IFC4. That is the one conversion that exists; every other pair of schemas is refused with [[error:SCHEMA_CONVERSION_NOT_SUPPORTED]] and a message that names the conversions that exist. A target schema that the model already has is no error: the model is then served as in step 1.

```code-group {#converted-download}
```javascript
const converted = await client.ifc.downloadConverted(BIM_WORKS_FIRST_MODEL, "IFC4");
console.log(converted.conversion.status, converted.conversion.losses, converted.conversion.additions);
window.location.href = converted.url;
```
```java
try (InputStream in = client.ifc.downloadModel(UUID.fromString(BIM_WORKS_FIRST_MODEL), "IFC4")) {
	Files.copy(in, Paths.get("house_IFC4.ifc"), StandardCopyOption.REPLACE_EXISTING);
}
```
```

`downloadConverted` is on [[js:@bimworks/jssdk/Ifc|Ifc]], `IfcApi.downloadModel` with a target schema on [[java:nl.bimbase.bimworks.client.apis.IfcApi|IfcApi]]. Over HTTP it is [[openapi:Download]] with `target_schema` next to the model identifier:

```try-it
operation: Download
method: POST
path: /openapi/model/Download
body: |
  {
    "type": "VersionModelIdentifier",
    "uuid": BIM_WORKS_FIRST_MODEL,
    "target_schema": "IFC4"
  }
```

What to know about the converted file:

- **Objects keep their id.** Every object that is in both files has the same express id and the same GlobalId in both, also when its entity changed (an `IfcElectricDistributionPoint` becomes an `IfcElectricDistributionBoard`). Objects that the conversion created are numbered above the objects of the model.
- **Losses and additions are stated.** The reply of the SDK holds `conversion` with the numbers; over HTTP the same numbers are in the response headers `X-BimWorks-Conversion-Status`, `-Losses`, `-Additions` and `-Errors`. The header of the file itself names the conversion and the number of losses, so that the information stays with the file.
- **Every single loss and addition is in the log.** `getSchemaConversionReport` in the SDKs, [[openapi:SchemaConversionReport]] over HTTP: pass the version and the `target_schema`. The format `markdown` gives the report as text, `detail` the complete log.
- **It takes time once.** The conversion of a large model takes minutes. The converted file is kept, so the second download of the same version is answered at once. The SDK methods wait up to 30 minutes.
- **A version of any origin.** The conversion reads the stored model, not the uploaded file, so a version that was made by a [[term:transaction|transaction]] is converted with its edits.
- **Checked on request.** With `validate: true` the converted file is held against the schema check before it is served, and so is the model, to compare. The file is valid when the conversion introduced no violation; the reply says so in `validation`, over HTTP in `X-BimWorks-Conversion-Validation`. This about doubles the time of a conversion.

The download leaves the model as it is. To make the converted model a version of its own, which can be queried, viewed and edited, use the statement `CONVERT SCHEMA TO IFC4` in a transaction ([[page:reference/bul#convert-schema]]), or **Convert to IFC4…** in the menu of the version in the web client.

## 4. A folder as a zip

The archive holds the last version of every non-deleted model below the folder, with the tree paths as entry paths; it is generated while it streams, so large folders start arriving at once. Deleted nodes can be included with `include_deleted`.

```code-group {#zip} classic
```java
try (InputStream in = client.fs.downloadAsZip(folderUuid, false)) {
	Files.copy(in, Paths.get("project-a.zip"), StandardCopyOption.REPLACE_EXISTING);
}
```
```

```sdk-example
operation: DownloadAsZip
body: |
  {
    "uuid": "<folder uuid>"
  }
```

`FileSystemApi.downloadAsZip` is on [[java:nl.bimbase.bimworks.client.apis.FileSystemApi|FileSystemApi]], `FsApi::downloadAsZip` in [[page:reference/sdk/php]]; over HTTP [[openapi:DownloadAsZip]]. A node that is not a folder fails with [[error:NOT_A_FOLDER_NODE]]. The JavaScript SDK has no zip method in this release.

With `format` `ZIP_ZST` the answer is a `.zip.zst` (`application/zstd`): the same ZIP with its entries stored, compressed as a whole with zstd. It is usually about a third smaller than the regular ZIP and several times faster to produce, so it suits large folders. `zstd -d project-a.zip.zst` or 7-Zip turns it into `project-a.zip`; Windows Explorer and macOS Finder do not open it. In the web client, *Download ZIP...* asks which of the two to download.

```sdk-example
operation: DownloadAsZip
body: |
  {
    "uuid": "<folder uuid>",
    "format": "ZIP_ZST"
  }
```

## Check

The downloaded original has the size the version record reports and opens in your IFC tool; uploading it again to the same folder is deduplicated and creates no new file ([[page:how-to/models/upload-a-model]]). The converted file starts with a header that names `IFC4` as its schema and the conversion in its description. The zip lists one entry per model with the folder structure of the tree.
