---
title: Download
summary: Download the model of the given Version UUID, as uploaded or as IFC or ifcXML.
order: 1221
section: Model
method: POST
operation: Download
auth: true
scopes: [model:read]
schemas: [DownloadRequest, ErrorResponse]
link-terms: true
path: /model/Download
---

# Download

<div class="api-path"><div class="api-path-method"><span class="pill pill-method">POST</span></div><pre><span class="host" data-api-host></span>/openapi/model/Download</pre></div>

In case you want to download only a subset of an IFC model, use ifc/query. `format` chooses what comes back; it wins over the Accept header, which is not read by this operation. `original` (the default) is the file as it was uploaded, byte for byte; `ifc` and `ifcxml` serialize the stored model, so they work for any Version whose model parsed as IFC, whatever its upload encoding. With `error_uuid` instead of a model identifier the file of a failed upload comes back as it was uploaded.

With target_schema the model is converted to that IFC schema and the converted file is returned. The only
supported conversion is IFC2X3 to IFC4; every other conversion is refused with a message that names the supported
ones. A target schema that the model already has is no error, the model is then returned as without target_schema.
The objects of the converted file have the express ids and the GlobalIds of the source. What the conversion lost
and what it added is counted in the response headers and listed by model/SchemaConversionReport. A conversion can
take minutes for a large model; the converted file is kept, so a second request is answered at once.

## Try it {#try-it}

Edit the request and send it; it runs against this instance with your token, and the examples follow the form.

<div class="try-it" id="try-download" data-operation="Download" data-method="POST" data-path="/model/Download" data-content-type="application/json" data-auth="bearer" data-schema="DownloadRequest" data-tag="Model" data-scopes="model:read" data-binary="true"><div class="try-it-bar"><div class="tabs" role="tablist"><button type="button" role="tab" class="tab active" data-try-tab="request">Request</button><button type="button" role="tab" class="tab" data-try-tab="headers">Headers</button><button type="button" role="tab" class="tab" data-try-tab="snippet" data-try-snippet-tab>curl</button></div><span class="try-it-cred" data-try-cred></span><div class="try-it-actions"><button type="button" class="btn" data-try-reset>Reset</button><button type="button" class="btn btn-primary" data-try-send>Send</button></div></div><div class="try-it-body"><div class="try-it-request"><div class="try-it-pane active" data-try-pane="request"><div class="try-it-kv"><div class="try-it-key">Authorization</div><div class="try-it-val"><code data-try-auth>Bearer &lt;auth token&gt;</code><button type="button" class="link-button try-it-paste" data-try-paste>Paste another token</button></div><div class="try-it-key">Content-Type</div><div class="try-it-val"><code>application/json</code></div></div><div class="try-it-caption"><span>Body</span><span class="try-it-valid" data-try-valid></span></div><div class="try-it-editor lesson-code"><div class="lesson-gutter" data-try-gutter>1
2
3
4</div><textarea class="lesson-input try-it-textarea" data-try-body spellcheck="false" aria-label="Request body" rows="4">{
  &quot;type&quot;: &quot;VersionModelIdentifier&quot;,
  &quot;uuid&quot;: &quot;BIM_WORKS_FIRST_MODEL&quot;
}</textarea></div></div><div class="try-it-pane" data-try-pane="headers"><pre class="code"><code data-try-headers>Authorization: Bearer &lt;auth token&gt;
Content-Type: application/json
Accept: */*</code></pre></div><div class="try-it-pane" data-try-pane="snippet"><pre class="code"><code class="language-shell" data-try-snippet>curl -X POST &quot;$BIMWORKS_URL/openapi/model/Download&quot; \
  -H &quot;Authorization: Bearer $BIMWORKS_TOKEN&quot; \
  -H &quot;Content-Type: application/json&quot; \
  -d '{
  &quot;type&quot;: &quot;VersionModelIdentifier&quot;,
  &quot;uuid&quot;: &quot;BIM_WORKS_FIRST_MODEL&quot;
}' \
  -OJ</code></pre></div></div><div class="try-it-response"><div class="try-it-status"><span class="pill-status" data-try-status hidden></span><span class="try-it-meta" data-try-meta>Send to see the response</span><span class="try-it-spacer"></span><div class="tabs try-it-rtabs" data-try-rtabs hidden><button type="button" class="tab active" data-try-rtab="body">Body</button><button type="button" class="tab" data-try-rtab="headers">Headers</button></div><a class="try-it-download" data-try-download hidden download>Download</a></div><pre class="code try-it-out" data-try-out></pre></div></div><script type="application/json" data-try-sdk>{"java":{"program":"import java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.StandardCopyOption;\nimport nl.bimbase.bimworks.sdk.api.AuthApi;\nimport nl.bimbase.bimworks.sdk.api.ModelApi;\nimport nl.bimbase.bimworks.sdk.client.ApiClient;\nimport nl.bimbase.bimworks.sdk.model.Auth;\nimport nl.bimbase.bimworks.sdk.model.DownloadRequest;\nimport nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;\n\npublic class Example {\n    public static void main(String[] args) throws Exception {\n        // 1. Connect to BIM.works and log in with your API token\n        ApiClient client = new ApiClient();\n        client.updateBaseUri(\"BIM_WORKS_ADDRESS/openapi\");\n        Auth auth = new AuthApi(client)\n                .loginWithApiToken(new LoginWithApiTokenRequest().token(\"BIM_WORKS_API_TOKEN\"))\n                .getAuth();\n        client.setRequestInterceptor(builder -> builder.setHeader(\"Authorization\", \"Bearer \" + auth.getBase64()));\n\n        // 2. The request\n        DownloadRequest request = client.getObjectMapper().readValue(\"\"\"\n                {\n                  \"type\": \"VersionModelIdentifier\",\n                  \"uuid\": \"BIM_WORKS_FIRST_MODEL\"\n                }\n                \"\"\", DownloadRequest.class);\n\n        // 3. The call\n        var result = new ModelApi(client).download(request);\n\n        // 4. The result\n        Files.move(result.toPath(), Path.of(\"download.ifc\"), StandardCopyOption.REPLACE_EXISTING);\n    }\n}","template":"import java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.StandardCopyOption;\nimport nl.bimbase.bimworks.sdk.api.AuthApi;\nimport nl.bimbase.bimworks.sdk.api.ModelApi;\nimport nl.bimbase.bimworks.sdk.client.ApiClient;\nimport nl.bimbase.bimworks.sdk.model.Auth;\nimport nl.bimbase.bimworks.sdk.model.DownloadRequest;\nimport nl.bimbase.bimworks.sdk.model.LoginWithApiTokenRequest;\n\npublic class Example {\n    public static void main(String[] args) throws Exception {\n        // 1. Connect to BIM.works and log in with your API token\n        ApiClient client = new ApiClient();\n        client.updateBaseUri(\"BIM_WORKS_ADDRESS/openapi\");\n        Auth auth = new AuthApi(client)\n                .loginWithApiToken(new LoginWithApiTokenRequest().token(\"BIM_WORKS_API_TOKEN\"))\n                .getAuth();\n        client.setRequestInterceptor(builder -> builder.setHeader(\"Authorization\", \"Bearer \" + auth.getBase64()));\n\n        // 2. The request\n        DownloadRequest request = client.getObjectMapper().readValue(\"\"\"\n                @@BODY@@\n                \"\"\", DownloadRequest.class);\n\n        // 3. The call\n        var result = new ModelApi(client).download(request);\n\n        // 4. The result\n        Files.move(result.toPath(), Path.of(\"download.ifc\"), StandardCopyOption.REPLACE_EXISTING);\n    }\n}","escape":"backslash"},"csharp":{"program":"using System.Text.Json;\nusing BIMworks.Sdk.Api;\nusing BIMworks.Sdk.Client;\nusing BIMworks.Sdk.Extensions;\nusing BIMworks.Sdk.Model;\nusing Microsoft.Extensions.DependencyInjection;\n\n// 1. Connect to BIM.works and log in with your API token\nIServiceProvider Connect(string bearer)\n{\n    var services = new ServiceCollection();\n    services.AddApi(options =>\n    {\n        options.AddTokens(new BearerToken(bearer));\n        options.AddApiHttpClients(http =>\n        {\n            http.BaseAddress = new Uri(\"BIM_WORKS_ADDRESS\" + \"/openapi\");\n            http.Timeout = Timeout.InfiniteTimeSpan;\n        });\n    });\n    return services.BuildServiceProvider();\n}\nvar login = await Connect(\"\").GetRequiredService<IAuthApi>().LoginWithApiTokenAsync(new LoginWithApiTokenRequest(\"BIM_WORKS_API_TOKEN\"));\nvar auth = login.Ok()?.Auth ?? throw new HttpRequestException(login.RawContent, null, login.StatusCode);\nvar client = Connect(auth.Base64);\nvar json = client.GetRequiredService<JsonSerializerOptionsProvider>().Options;\n\n// 2. The request\nvar request = JsonSerializer.Deserialize<DownloadRequest>(\"\"\"\n    {\n      \"type\": \"VersionModelIdentifier\",\n      \"uuid\": \"BIM_WORKS_FIRST_MODEL\"\n    }\n    \"\"\", json);\n\n// 3. The call\nvar response = await client.GetRequiredService<IModelApi>().DownloadAsync(request);\n\n// 4. The result\nvar result = response.Ok() ?? throw new HttpRequestException(response.RawContent, null, response.StatusCode);\nusing var output = File.Create(\"download.ifc\");\nawait result.CopyToAsync(output);","template":"using System.Text.Json;\nusing BIMworks.Sdk.Api;\nusing BIMworks.Sdk.Client;\nusing BIMworks.Sdk.Extensions;\nusing BIMworks.Sdk.Model;\nusing Microsoft.Extensions.DependencyInjection;\n\n// 1. Connect to BIM.works and log in with your API token\nIServiceProvider Connect(string bearer)\n{\n    var services = new ServiceCollection();\n    services.AddApi(options =>\n    {\n        options.AddTokens(new BearerToken(bearer));\n        options.AddApiHttpClients(http =>\n        {\n            http.BaseAddress = new Uri(\"BIM_WORKS_ADDRESS\" + \"/openapi\");\n            http.Timeout = Timeout.InfiniteTimeSpan;\n        });\n    });\n    return services.BuildServiceProvider();\n}\nvar login = await Connect(\"\").GetRequiredService<IAuthApi>().LoginWithApiTokenAsync(new LoginWithApiTokenRequest(\"BIM_WORKS_API_TOKEN\"));\nvar auth = login.Ok()?.Auth ?? throw new HttpRequestException(login.RawContent, null, login.StatusCode);\nvar client = Connect(auth.Base64);\nvar json = client.GetRequiredService<JsonSerializerOptionsProvider>().Options;\n\n// 2. The request\nvar request = JsonSerializer.Deserialize<DownloadRequest>(\"\"\"\n    @@BODY@@\n    \"\"\", json);\n\n// 3. The call\nvar response = await client.GetRequiredService<IModelApi>().DownloadAsync(request);\n\n// 4. The result\nvar result = response.Ok() ?? throw new HttpRequestException(response.RawContent, null, response.StatusCode);\nusing var output = File.Create(\"download.ifc\");\nawait result.CopyToAsync(output);","escape":"none"},"typescript":{"program":"import { writeFileSync } from \"node:fs\";\nimport { AuthApi, Configuration, DownloadRequestFromJSON, ModelApi } from \"@bimworks/sdk\";\n\n// 1. Connect to BIM.works and log in with your API token\nconst basePath = \"BIM_WORKS_ADDRESS/openapi\";\nconst auth = await new AuthApi(new Configuration({ basePath }))\n  .loginWithApiToken({ loginWithApiTokenRequest: { token: \"BIM_WORKS_API_TOKEN\" } });\nconst client = new Configuration({ basePath, accessToken: typeof auth === \"string\" ? auth : auth.base64 });\n\n// 2. The request\nconst request = DownloadRequestFromJSON({\n  \"type\": \"VersionModelIdentifier\",\n  \"uuid\": \"BIM_WORKS_FIRST_MODEL\"\n});\n\n// 3. The call\nconst result = await new ModelApi(client).download({ downloadRequest: request });\n\n// 4. The result\nwriteFileSync(\"download.ifc\", Buffer.from(await result.arrayBuffer()));","template":"import { writeFileSync } from \"node:fs\";\nimport { AuthApi, Configuration, DownloadRequestFromJSON, ModelApi } from \"@bimworks/sdk\";\n\n// 1. Connect to BIM.works and log in with your API token\nconst basePath = \"BIM_WORKS_ADDRESS/openapi\";\nconst auth = await new AuthApi(new Configuration({ basePath }))\n  .loginWithApiToken({ loginWithApiTokenRequest: { token: \"BIM_WORKS_API_TOKEN\" } });\nconst client = new Configuration({ basePath, accessToken: typeof auth === \"string\" ? auth : auth.base64 });\n\n// 2. The request\nconst request = DownloadRequestFromJSON(@@BODY@@);\n\n// 3. The call\nconst result = await new ModelApi(client).download({ downloadRequest: request });\n\n// 4. The result\nwriteFileSync(\"download.ifc\", Buffer.from(await result.arrayBuffer()));","escape":"none"},"php":{"program":"<?php\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse BIMworks\\Api\\AuthApi;\nuse BIMworks\\Api\\ModelApi;\nuse BIMworks\\Configuration;\nuse BIMworks\\Model\\DownloadRequest;\nuse BIMworks\\Model\\LoginWithApiTokenRequest;\nuse BIMworks\\ObjectSerializer;\n\n// 1. Connect to BIM.works and log in with your API token\n$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');\n$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));\n$client->setAccessToken($auth->getBase64());\n\n// 2. The request\n$request = ObjectSerializer::deserialize(<<<'JSON'\n{\n  \"type\": \"VersionModelIdentifier\",\n  \"uuid\": \"BIM_WORKS_FIRST_MODEL\"\n}\nJSON, DownloadRequest::class);\n\n// 3. The call\n$result = (new ModelApi(config: $client))->download($request);\n\n// 4. The result\ncopy($result->getPathname(), 'download.ifc');","template":"<?php\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse BIMworks\\Api\\AuthApi;\nuse BIMworks\\Api\\ModelApi;\nuse BIMworks\\Configuration;\nuse BIMworks\\Model\\DownloadRequest;\nuse BIMworks\\Model\\LoginWithApiTokenRequest;\nuse BIMworks\\ObjectSerializer;\n\n// 1. Connect to BIM.works and log in with your API token\n$client = (new Configuration())->setHost('BIM_WORKS_ADDRESS/openapi');\n$auth = (new AuthApi(config: $client))->loginWithApiToken(new LoginWithApiTokenRequest(['token' => 'BIM_WORKS_API_TOKEN']));\n$client->setAccessToken($auth->getBase64());\n\n// 2. The request\n$request = ObjectSerializer::deserialize(<<<'JSON'\n@@BODY@@\nJSON, DownloadRequest::class);\n\n// 3. The call\n$result = (new ModelApi(config: $client))->download($request);\n\n// 4. The result\ncopy($result->getPathname(), 'download.ifc');","escape":"none"},"python":{"program":"import bimworks\n\n# 1. Connect to BIM.works and log in with your API token\nclient = bimworks.ApiClient(bimworks.Configuration(host=\"BIM_WORKS_ADDRESS/openapi\"))\nauth = bimworks.AuthApi(client).login_with_api_token(\n    bimworks.LoginWithApiTokenRequest(token=\"BIM_WORKS_API_TOKEN\"))\nclient.configuration.access_token = auth.actual_instance.var_base64\n\n# 2. The request\nrequest = bimworks.DownloadRequest.from_json(r\"\"\"\n{\n  \"type\": \"VersionModelIdentifier\",\n  \"uuid\": \"BIM_WORKS_FIRST_MODEL\"\n}\n\"\"\")\n\n# 3. The call\nresult = bimworks.ModelApi(client).download(request)\n\n# 4. The result\nwith open(\"download.ifc\", \"wb\") as file:\n    file.write(result)","template":"import bimworks\n\n# 1. Connect to BIM.works and log in with your API token\nclient = bimworks.ApiClient(bimworks.Configuration(host=\"BIM_WORKS_ADDRESS/openapi\"))\nauth = bimworks.AuthApi(client).login_with_api_token(\n    bimworks.LoginWithApiTokenRequest(token=\"BIM_WORKS_API_TOKEN\"))\nclient.configuration.access_token = auth.actual_instance.var_base64\n\n# 2. The request\nrequest = bimworks.DownloadRequest.from_json(r\"\"\"\n@@BODY@@\n\"\"\")\n\n# 3. The call\nresult = bimworks.ModelApi(client).download(request)\n\n# 4. The result\nwith open(\"download.ifc\", \"wb\") as file:\n    file.write(result)","escape":"none"}}</script></div>

## Examples {#examples}

<div class="examples" data-examples="try-download"><div class="examples-bar"><span class="examples-lang" data-ex-lang>curl</span><span class="examples-note" data-ex-note>shell</span><button type="button" class="link-button" data-ex-change>Change language</button><button type="button" class="code-copy" data-ex-copy title="Copy">Copy</button></div><pre class="code"><code class="language-shell" data-ex-code>curl -X POST &quot;$BIMWORKS_URL/openapi/model/Download&quot; \
  -H &quot;Authorization: Bearer $BIMWORKS_TOKEN&quot; \
  -H &quot;Content-Type: application/json&quot; \
  -d '{
  &quot;type&quot;: &quot;VersionModelIdentifier&quot;,
  &quot;uuid&quot;: &quot;BIM_WORKS_FIRST_MODEL&quot;
}' \
  -OJ</code></pre></div>

The examples are complete programs in the [[page:reference/sdk#openapi|OpenAPI SDKs]], all in the same four steps. The method in each SDK's reference: [[page:reference/sdk/java/modelapi#download|Java]] · [[page:reference/sdk/dotnet/modelapi#download|.NET]] · [[page:reference/sdk/typescript/modelapi#download|TypeScript]] · [[page:reference/sdk/php/modelapi#download|PHP]] · [[page:reference/sdk/python/modelapi#download|Python]].

## Request body {#request-body}

[[page:api/schemas#DownloadRequest|DownloadRequest]] · `application/json`

<table class="dense">
<thead><tr><th>Field</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr id="field-format"><td><code>format</code></td><td><code>&quot;original&quot; | &quot;ifc&quot; | &quot;ifcxml&quot;</code><span class="opt">optional</span></td><td><code>original</code>: the file as it was uploaded, byte for byte (a Version made by a transaction has no upload: it is served as <code>ifc</code>); <code>ifc</code>: the model serialized as IFC STEP (<code>application/ifc</code>), whatever the encoding it was uploaded in; <code>ifcxml</code>: the model serialized as ifcXML (<code>application/xml</code>), ISO 10303-28 for IFC2X3 and ifcXML4 for IFC4/IFC4X3. <code>target_schema</code> applies to <code>original</code> and <code>ifc</code> Default <code>original</code>.</td></tr>
<tr id="field-error-uuid"><td><code>error_uuid</code></td><td><code>uuid</code><span class="opt">optional</span></td><td>Instead of a model identifier, the error of an upload that failed (from ListNodeErrors), whose uploaded file comes back. Needs read rights on its Node</td></tr>
<tr id="field-type"><td><code>type</code></td><td><code>&quot;UrlModelIdentifier&quot; | &quot;NodeModelIdentifier&quot; | &quot;VersionModelIdentifier&quot;</code><span class="opt">optional</span></td><td>The kind of model identifier, required unless error_uuid is given</td></tr>
<tr id="field-name"><td><code>name</code></td><td><code>string</code><span class="opt">optional</span></td><td>Name of the model, see ModelIdentifier</td></tr>
<tr id="field-uuid"><td><code>uuid</code></td><td><code>uuid</code><span class="opt">optional</span></td><td>The UUID of the Version (VersionModelIdentifier) or of the Node (NodeModelIdentifier)</td></tr>
<tr id="field-url"><td><code>url</code></td><td><code>string</code><span class="opt">optional</span></td><td>The URL of the model (UrlModelIdentifier)</td></tr>
<tr id="field-target-schema"><td><code>target_schema</code></td><td><code>string</code><span class="opt">optional</span></td><td>The IFC schema to convert the model to, for example IFC4. Absent means the model as it was uploaded</td></tr>
<tr id="field-validate"><td><code>validate</code></td><td><code>boolean</code><span class="opt">optional</span></td><td>Only with target_schema. Whether to run the schema check on the converted file before it is returned, and on the model to compare with. This about doubles the time of a conversion (default: false)</td></tr>
</tbody>
</table>

## Responses {#responses}

<table class="dense">
<thead><tr><th>Status</th><th>Schema</th><th>Description</th></tr></thead>
<tbody>
<tr><td><code class="status-2xx">200</code></td><td><code>file</code> <span class="opt">application/ifc</span></td><td>The model file. Without target_schema byte-for-byte as it was uploaded, with target_schema the converted file. An IFC STEP file, for format ifc and for an uploaded IFC with format original</td></tr>
<tr><td><code class="status-2xx"></code></td><td><code>file</code> <span class="opt">application/xml</span></td><td>An ifcXML file, for format ifcxml and for an uploaded ifcXML with format original</td></tr>
<tr><td><code class="status-2xx"></code></td><td><code>file</code> <span class="opt">application/e57</span></td><td></td></tr>
<tr><td><code class="status-2xx"></code></td><td><code>file</code> <span class="opt">application/pdf</span></td><td></td></tr>
<tr><td><code class="status-2xx"></code></td><td><code>file</code> <span class="opt">application/zip</span></td><td></td></tr>
<tr><td><code class="status-4xx">400</code></td><td>[[page:api/schemas#ErrorResponse|ErrorResponse]]</td><td>Invalid input: a missing or invalid argument, an invalid query/identifier/path, a state conflict caused by the request (for example a Node name that already exists), or an uploaded file that was rejected because it cannot be read (<code>type</code> for example <code>INVALID_INPUT_FILE</code>, <code>NO_CONVERTIBLE_CONTENT</code> or one of the <code>StepParserErrorCode</code> codes; uploading the same file again fails the same way)</td></tr>
<tr><td><code class="status-4xx">401</code></td><td>[[page:api/schemas#ErrorResponse|ErrorResponse]]</td><td>Authentication failed: the bearer token is missing, malformed, expired or otherwise invalid, or the provided login credentials are incorrect</td></tr>
<tr><td><code class="status-4xx">403</code></td><td>[[page:api/schemas#ErrorResponse|ErrorResponse]]</td><td>Authenticated, but not allowed: no read/write rights on the target Node, the token's task or IP scope does not allow this call, or a required user feature is missing</td></tr>
<tr><td><code class="status-4xx">404</code></td><td>[[page:api/schemas#ErrorResponse|ErrorResponse]]</td><td>The referenced entity (Node, Version, model file, upload, ...) does not exist</td></tr>
<tr><td><code class="status-4xx">429</code></td><td>[[page:api/schemas#ErrorResponse|ErrorResponse]]</td><td>Too many requests from this client in a short time, on an installation that limits the request rate. Wait the number of seconds in <code>Retry-After</code> before trying again</td></tr>
<tr><td><code class="status-5xx">500</code></td><td>[[page:api/schemas#ErrorResponse|ErrorResponse]]</td><td>An unexpected server-side error (database, routing, IO, unknown)</td></tr>
<tr><td><code class="status-5xx">503</code></td><td>[[page:api/schemas#ErrorResponse|ErrorResponse]]</td><td>BIM.works is temporarily unavailable: it is restarting, stopped, or down for scheduled maintenance (<code>type</code> <code>SERVICE_UNAVAILABLE</code> or <code>MAINTENANCE</code>). Wait the number of seconds in <code>Retry-After</code> before trying again</td></tr>
<tr><td><code class="status-5xx">504</code></td><td>[[page:api/schemas#ErrorResponse|ErrorResponse]]</td><td>BIM.works did not respond in time (<code>type</code> <code>REQUEST_TIMED_OUT</code>). The request may still be completed: check its result before trying again</td></tr>
</tbody>
</table>
