UploadModel

Upload a single model using multipart/form-data

POST
/openapi/model/UploadModel

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#

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

Authorization
Bearer <auth token>
Formmultipart/form-data
file
node_uuid
filename
filesize
content_type
input_file_type
format_settings
hash
force_reprocessing
tags
validation_settings
wait_ms
force
Authorization: Bearer <auth token>
Accept: application/json
curl -X POST "$BIMWORKS_URL/openapi/model/UploadModel" \
  -H "Authorization: Bearer $BIMWORKS_TOKEN" \
  -F "file=@<file>" \
  -F "node_uuid=<node_uuid>" \
  -F "filename=<filename>" \
  -F "filesize=<filesize>" \
  -F "content_type=<content_type>" \
  -F "input_file_type=<input_file_type>" \
  -F "format_settings=<format_settings>" \
  -F "hash=<hash>" \
  -F "force_reprocessing=<force_reprocessing>" \
  -F "tags=<tags>" \
  -F "validation_settings=<validation_settings>" \
  -F "wait_ms=<wait_ms>" \
  -F "force=<force>"
Send to see the response

Examples#

curlshell
curl -X POST "$BIMWORKS_URL/openapi/model/UploadModel" \
  -H "Authorization: Bearer $BIMWORKS_TOKEN" \
  -F "file=@<file>" \
  -F "node_uuid=<node_uuid>" \
  -F "filename=<filename>" \
  -F "filesize=<filesize>" \
  -F "content_type=<content_type>" \
  -F "input_file_type=<input_file_type>" \
  -F "format_settings=<format_settings>" \
  -F "hash=<hash>" \
  -F "force_reprocessing=<force_reprocessing>" \
  -F "tags=<tags>" \
  -F "validation_settings=<validation_settings>" \
  -F "wait_ms=<wait_ms>" \
  -F "force=<force>"

The examples are complete programs in the OpenAPI SDKs, all in the same four steps. The method in each SDK's reference: Java · .NET · TypeScript · PHP · Python.

Request body#

multipart/form-data

FieldTypeDescription
filefileoptionalA single uploaded model
node_uuiduuidoptionalThe UUID of the Node to which to add the models
filenamestringoptionalName of the file Default model.ifc.
filesizeintegeroptionalFilesize in bytes Default -1.
content_typestringoptionalThe 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
input_file_typestringoptionalThe type of the model (an InputFileType name). When present and not UNKNOWN it wins over the filename extension
format_settingsstringoptionalA JSON-encoded PointCloudFormatSettings object (multipart form fields are strings) with per-upload point cloud format options
hashstringoptionalInstead 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
force_reprocessingbooleanoptionalProcess the file again, also when the server has processed the same file before Default false.
tagsstringoptionalTags of the new Version, comma-separated VersionTag names
validation_settingsstringoptionalA JSON-encoded ValidationSettings object
wait_msintegeroptionalAnswer 202 with the checkin's status when the checkin takes longer than this
forcestringoptionalAn UploadForce: NONE, NEW_VERSION or NEW_MODEL

Responses#

StatusSchemaDescription
200ModelVersionUpload was successful
202CheckinStatusThe checkin is still running (after wait_ms, or after an hour without it); follow it with GetCheckin
400ErrorResponseInvalid 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 (type for example INVALID_INPUT_FILE, NO_CONVERTIBLE_CONTENT or one of the StepParserErrorCode codes; uploading the same file again fails the same way)
401ErrorResponseAuthentication failed: the bearer token is missing, malformed, expired or otherwise invalid, or the provided login credentials are incorrect
403ErrorResponseAuthenticated, 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
404ErrorResponseThe referenced entity (Node, Version, model file, upload, ...) does not exist
413ErrorResponseThe request body is larger than the server accepts (1 GB on a standard installation)
429ErrorResponseToo many requests from this client in a short time, on an installation that limits the request rate. Wait the number of seconds in Retry-After before trying again
500ErrorResponseAn unexpected server-side error (database, routing, IO, unknown)
503ErrorResponseBIM.works is temporarily unavailable: it is restarting, stopped, or down for scheduled maintenance (type SERVICE_UNAVAILABLE or MAINTENANCE). Wait the number of seconds in Retry-After before trying again
504ErrorResponseBIM.works did not respond in time (type REQUEST_TIMED_OUT). The request may still be completed: check its result before trying again
Generated from api.yml·openapi.json