---
title: UploadModel
summary: Upload a single model using multipart/form-data
order: 1226
section: Model
method: POST
operation: UploadModel
auth: true
scopes: [model:upload]
schemas: [ModelVersion, CheckinStatus, ErrorResponse]
link-terms: true
path: /model/UploadModel
---

# UploadModel

<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/UploadModel</pre></div>

Uploads a file into the folder `node_uuid` (the caller's own root when absent). When LookupModelHashes says the server has the file already, send its `hash` instead of the `file` part: no bytes travel. A hash the server cannot use after all answers NO_STREAM (404); send the file then. The checkin (parsing, geometry, indexing) follows the upload, which is always waited for. Without `wait_ms` the call answers when the checkin ends, with the new Version, which for a big model can take longer than a gateway waits. With `wait_ms` it answers the Version when the checkin ends within that many milliseconds, and otherwise 202 with the checkin's status and `job_uuid`: follow it with GetCheckin. A checkin still running after an hour answers 202 too. A ZIP of models is checked in where it was received and has no job, so it always waits. The same file name in the same folder adds a Version to that model.

## 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-uploadmodel" data-operation="UploadModel" data-method="POST" data-path="/model/UploadModel" data-content-type="multipart/form-data" data-auth="bearer" data-tag="Model" data-scopes="model:upload"><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><div class="try-it-caption"><span>Form</span><span class="try-it-note">multipart/form-data</span></div><div class="try-it-kv try-it-form"><div class="try-it-key">file</div><div class="try-it-val"><input type="file" class="try-it-input" data-try-form="file" aria-label="file"></div><div class="try-it-key">node_uuid</div><div class="try-it-val"><input type="text" class="try-it-input" data-try-form="node_uuid" placeholder="uuid" aria-label="node_uuid"></div><div class="try-it-key">filename</div><div class="try-it-val"><input type="text" class="try-it-input" data-try-form="filename" placeholder="string" aria-label="filename"></div><div class="try-it-key">filesize</div><div class="try-it-val"><input type="text" class="try-it-input" data-try-form="filesize" placeholder="integer" aria-label="filesize"></div><div class="try-it-key">content_type</div><div class="try-it-val"><input type="text" class="try-it-input" data-try-form="content_type" placeholder="string" aria-label="content_type"></div><div class="try-it-key">input_file_type</div><div class="try-it-val"><input type="text" class="try-it-input" data-try-form="input_file_type" placeholder="string" aria-label="input_file_type"></div><div class="try-it-key">format_settings</div><div class="try-it-val"><input type="text" class="try-it-input" data-try-form="format_settings" placeholder="string" aria-label="format_settings"></div><div class="try-it-key">hash</div><div class="try-it-val"><input type="text" class="try-it-input" data-try-form="hash" placeholder="string" aria-label="hash"></div><div class="try-it-key">force_reprocessing</div><div class="try-it-val"><input type="text" class="try-it-input" data-try-form="force_reprocessing" placeholder="boolean" aria-label="force_reprocessing"></div><div class="try-it-key">tags</div><div class="try-it-val"><input type="text" class="try-it-input" data-try-form="tags" placeholder="string" aria-label="tags"></div><div class="try-it-key">validation_settings</div><div class="try-it-val"><input type="text" class="try-it-input" data-try-form="validation_settings" placeholder="string" aria-label="validation_settings"></div><div class="try-it-key">wait_ms</div><div class="try-it-val"><input type="text" class="try-it-input" data-try-form="wait_ms" placeholder="integer" aria-label="wait_ms"></div><div class="try-it-key">force</div><div class="try-it-val"><input type="text" class="try-it-input" data-try-form="force" placeholder="string" aria-label="force"></div></div></div><div class="try-it-pane" data-try-pane="headers"><pre class="code"><code data-try-headers>Authorization: Bearer &lt;auth token&gt;
Accept: application/json</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/UploadModel&quot; \
  -H &quot;Authorization: Bearer $BIMWORKS_TOKEN&quot; \
  -F &quot;file=@&lt;file&gt;&quot; \
  -F &quot;node_uuid=&lt;node_uuid&gt;&quot; \
  -F &quot;filename=&lt;filename&gt;&quot; \
  -F &quot;filesize=&lt;filesize&gt;&quot; \
  -F &quot;content_type=&lt;content_type&gt;&quot; \
  -F &quot;input_file_type=&lt;input_file_type&gt;&quot; \
  -F &quot;format_settings=&lt;format_settings&gt;&quot; \
  -F &quot;hash=&lt;hash&gt;&quot; \
  -F &quot;force_reprocessing=&lt;force_reprocessing&gt;&quot; \
  -F &quot;tags=&lt;tags&gt;&quot; \
  -F &quot;validation_settings=&lt;validation_settings&gt;&quot; \
  -F &quot;wait_ms=&lt;wait_ms&gt;&quot; \
  -F &quot;force=&lt;force&gt;&quot;</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.io.File;\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.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        File _file = new File(\"model.ifc\");\n        String filename = \"model.ifc\";\n\n        // 3. The call\n        var result = new ModelApi(client).uploadModel(_file, null, filename, null, null, null, null, null, null, null, null, null, null);\n\n        // 4. The result\n        System.out.println(client.getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(result));\n    }\n}","template":null,"escape":"none"},"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 file = new FileParameter(File.OpenRead(\"model.ifc\"), \"model.ifc\");\nvar filename = \"model.ifc\";\n\n// 3. The call\nvar response = await client.GetRequiredService<IModelApi>().UploadModelAsync(file: file, filename: filename);\n\n// 4. The result\nvar result = response.Ok() ?? throw new HttpRequestException(response.RawContent, null, response.StatusCode);\nConsole.WriteLine(JsonSerializer.Serialize(result, json));","template":null,"escape":"none"},"typescript":{"program":"import { openAsBlob } from \"node:fs\";\nimport { AuthApi, Configuration, ModelApi, ModelVersionToJSON } 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 = { file: new File([await openAsBlob(\"model.ifc\")], \"model.ifc\"), filename: \"model.ifc\" };\n\n// 3. The call\nconst result = await new ModelApi(client).uploadModel(request);\n\n// 4. The result\nconsole.log(JSON.stringify(ModelVersionToJSON(result), null, 2));","template":null,"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\\LoginWithApiTokenRequest;\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 = ['file' => new SplFileObject('model.ifc'), 'filename' => 'model.ifc'];\n\n// 3. The call\n$result = (new ModelApi(config: $client))->uploadModel(...$request);\n\n// 4. The result\necho json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), PHP_EOL;","template":null,"escape":"none"},"python":{"program":"import json\n\nimport 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\nfile = \"model.ifc\"\nfilename = \"model.ifc\"\n\n# 3. The call\nresult = bimworks.ModelApi(client).upload_model(file=file, filename=filename)\n\n# 4. The result\nprint(json.dumps(client.sanitize_for_serialization(result), indent=2))","template":null,"escape":"none"}}</script></div>

## Examples {#examples}

<div class="examples" data-examples="try-uploadmodel"><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/UploadModel&quot; \
  -H &quot;Authorization: Bearer $BIMWORKS_TOKEN&quot; \
  -F &quot;file=@&lt;file&gt;&quot; \
  -F &quot;node_uuid=&lt;node_uuid&gt;&quot; \
  -F &quot;filename=&lt;filename&gt;&quot; \
  -F &quot;filesize=&lt;filesize&gt;&quot; \
  -F &quot;content_type=&lt;content_type&gt;&quot; \
  -F &quot;input_file_type=&lt;input_file_type&gt;&quot; \
  -F &quot;format_settings=&lt;format_settings&gt;&quot; \
  -F &quot;hash=&lt;hash&gt;&quot; \
  -F &quot;force_reprocessing=&lt;force_reprocessing&gt;&quot; \
  -F &quot;tags=&lt;tags&gt;&quot; \
  -F &quot;validation_settings=&lt;validation_settings&gt;&quot; \
  -F &quot;wait_ms=&lt;wait_ms&gt;&quot; \
  -F &quot;force=&lt;force&gt;&quot;</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#uploadmodel|Java]] · [[page:reference/sdk/dotnet/modelapi#uploadmodel|.NET]] · [[page:reference/sdk/typescript/modelapi#uploadmodel|TypeScript]] · [[page:reference/sdk/php/modelapi#uploadmodel|PHP]] · [[page:reference/sdk/python/modelapi#uploadmodel|Python]].

## Request body {#request-body}

`multipart/form-data`

<table class="dense">
<thead><tr><th>Field</th><th>Type</th><th>Description</th></tr></thead>
<tbody>
<tr id="field-file"><td><code>file</code></td><td><code>file</code><span class="opt">optional</span></td><td>A single uploaded model</td></tr>
<tr id="field-node-uuid"><td><code>node_uuid</code></td><td><code>uuid</code><span class="opt">optional</span></td><td>The UUID of the Node to which to add the models</td></tr>
<tr id="field-filename"><td><code>filename</code></td><td><code>string</code><span class="opt">optional</span></td><td>Name of the file Default <code>model.ifc</code>.</td></tr>
<tr id="field-filesize"><td><code>filesize</code></td><td><code>integer</code><span class="opt">optional</span></td><td>Filesize in bytes Default <code>-1</code>.</td></tr>
<tr id="field-content-type"><td><code>content_type</code></td><td><code>string</code><span class="opt">optional</span></td><td>The content type. When available this information is taken from the Content-Type of the file part. Allowed values are application/ifc, application/xml (for .ifcxml files), application/pdf, application/e57</td></tr>
<tr id="field-input-file-type"><td><code>input_file_type</code></td><td><code>string</code><span class="opt">optional</span></td><td>The type of the model (an InputFileType name). When present and not UNKNOWN it wins over the filename extension</td></tr>
<tr id="field-format-settings"><td><code>format_settings</code></td><td><code>string</code><span class="opt">optional</span></td><td>A JSON-encoded PointCloudFormatSettings object (multipart form fields are strings) with per-upload point cloud format options</td></tr>
<tr id="field-hash"><td><code>hash</code></td><td><code>string</code><span class="opt">optional</span></td><td>Instead of the file, its full_xxh64 (see ModelHash) when LookupModelHashes said the server knows it; ignored next to a file, which the server hashes itself. Needs filename</td></tr>
<tr id="field-force-reprocessing"><td><code>force_reprocessing</code></td><td><code>boolean</code><span class="opt">optional</span></td><td>Process the file again, also when the server has processed the same file before Default <code>false</code>.</td></tr>
<tr id="field-tags"><td><code>tags</code></td><td><code>string</code><span class="opt">optional</span></td><td>Tags of the new Version, comma-separated VersionTag names</td></tr>
<tr id="field-validation-settings"><td><code>validation_settings</code></td><td><code>string</code><span class="opt">optional</span></td><td>A JSON-encoded ValidationSettings object</td></tr>
<tr id="field-wait-ms"><td><code>wait_ms</code></td><td><code>integer</code><span class="opt">optional</span></td><td>Answer 202 with the checkin's status when the checkin takes longer than this</td></tr>
<tr id="field-force"><td><code>force</code></td><td><code>string</code><span class="opt">optional</span></td><td>An UploadForce: NONE, NEW_VERSION or NEW_MODEL</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>[[page:api/schemas#ModelVersion|ModelVersion]]</td><td>Upload was successful</td></tr>
<tr><td><code class="status-2xx">202</code></td><td>[[page:api/schemas#CheckinStatus|CheckinStatus]]</td><td>The checkin is still running (after wait_ms, or after an hour without it); follow it with GetCheckin</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">413</code></td><td>[[page:api/schemas#ErrorResponse|ErrorResponse]]</td><td>The request body is larger than the server accepts (1 GB on a standard installation)</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>
