> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.cadrooms.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.cadrooms.com/_mcp/server.

# Create uploads

POST https://api.cadrooms.workers.dev/v1/projects/{projectId}/uploads
Content-Type: application/json

Prepares one or more files for upload and returns the locations to which their content should be uploaded. CAD ROOMS checks out each new file to you.

**Folder imports**

Send `importId` and each file's `sourcePath` to add the files to an import.

CAD ROOMS checks out each new file to you with the purpose `Import`. The request fails if another user holds a check-out on any new file. If Unique Filenames is enabled in the workspace, the request also fails if another file in the workspace has the same name.

A file that already exists in the project and whose content is already stored in CAD ROOMS receives the status `skipped` and does not require an upload. A file with an existing `pending` or `completed` status in the import retains its status.

Any file that could not be prepared receives the status `failed`.

Required permission: Collaborator or higher in the project.


Reference: https://docs.cadrooms.com/api-reference/files/create-uploads

## Authentication

- `Authorization` header (bearer token, required) — An API key associated with your user account and workspace. API requests inherit your existing workspace permissions.
- `Authorization` header (bearer token, required) — The session token of a user signed in to the CAD ROOMS app. Every endpoint accepts it in place of an API key.

## Request

### Path parameters

- `projectId` (string, required) — Unique identifier of the project.

### Body (application/json)

This endpoint expects an UploadCreate.

- `files` (list of UploadCreateFilesItems, required) — The files to upload.
- `expiresIn` (integer, optional, default: 3600) — Number of seconds the upload URLs stay valid.
- `importId` (string, optional) — The folder import these files belong to.

## Response

### 201

Returns one upload per file. A file that could not be prepared is listed in `errors`, and the other files still succeed.

- `data` (list of Upload, required) — The prepared uploads.
- `errors` (list of UploadError, optional) — Files that could not be prepared.

## Errors

### 400 Bad Request Error

The request contains invalid or missing parameters. See `details` for specific validation errors.

- `error` (ErrorError, required)

### 401 Unauthorized Error

The API key is missing, invalid, expired, or revoked.

- `error` (ErrorError, required)

### 404 Not Found Error

The requested resource does not exist or is not accessible to your account. Both cases return the same response.

- `error` (ErrorError, required)

### 429 Too Many Requests Error

The rate limit has been exceeded. Wait for the duration specified in the `Retry-After` header before retrying.

- `error` (ErrorError, required)

### 500 Internal Server Error

An unexpected server error occurred. Retry later. Include the `requestId` when contacting support.

- `error` (ErrorError, required)

## Types

### UploadCreateFilesItems

- `path` (string, required) — Path of the file in the project.
- `contentType` (string, required) — Content type of the file.
- `sha256` (string, required) — SHA-256 hash of the file content.
- `size` (integer, optional) — Size of the file in bytes. CAD ROOMS uses it to decide whether the file uploads in parts.
- `sourcePath` (string, optional) — Location of the file in the source. Required with `importId`.

### Upload

Represents one file being uploaded. It has `uploadUrl` for a single upload, or `multipart` for a large file. It has neither when CAD ROOMS already holds the content.

- `id` (string, required) — Unique identifier for the upload.
- `path` (string, required) — Path of the file in the project.
- `unchanged` (boolean, required) — Whether this content matches the file before your changes. When `true`, CAD ROOMS removes the file from your changes.
- `uploadUrl` (string, optional) — Temporary URL to send the file content to with `PUT`.
- `multipart` (UploadMultipart, optional) — Where to send the parts of a large file.
- `sourcePath` (string, optional) — Location of the file in the source.

### UploadError

A file that could not be prepared.

- `path` (string, required) — Path of the file in the project.
- `reason` (string, required) — Why the file could not be prepared.
- `sourcePath` (string, optional) — Location of the file in the source.

### ErrorError

- `code` (string, required) — Stable error identifier for programmatic error handling. Every endpoint can return the general codes listed on the Errors page. Where a business condition applies, an endpoint returns a more specific code, documented on that endpoint.
- `message` (string, required) — Human-readable error description. May change over time.
- `requestId` (string, required) — Unique request identifier used for troubleshooting. The same value is returned in the `Request-Id` header of every response. Include this when contacting support.
- `details` (list of ErrorErrorDetailsItems, optional) — Optional. Contains field-level validation errors for `400` responses.

### UploadMultipart

Where to send the parts of a large file.

- `uploadUrls` (list of string, required) — Temporary URLs, one per part, in part order.
- `chunkSize` (integer, required) — Size of each part in bytes.

### ErrorErrorDetailsItems

- `field` (string, required) — Name of the request field that failed validation.
- `message` (string, required) — Description of the validation issue.

## Examples

**Request**

```json
{
  "files": [
    {
      "path": "parts/bracket.prt",
      "contentType": "application/octet-stream",
      "sha256": "9f2c1b7e4a6d8c0f3e5b2a917d4c6e8f1a3b5c7d9e0f1a2b3c4d5e6f7a8b9c0d",
      "size": 482113
    }
  ]
}
```

**Response**

```json
{
  "data": [
    {
      "id": "2d9a1c54-7e3b-4f60-9a18-5c2e7b1d0f36",
      "path": "parts/bracket.prt",
      "unchanged": false,
      "uploadUrl": "https://storage.cadrooms.com/signed/2d9a1c54"
    }
  ]
}
```

**SDK Code**

```python Files_createUploads_example
import requests

url = "https://api.cadrooms.workers.dev/v1/projects/6c83044f-ec8a-4a01-8a6b-e8b3eb988d2b/uploads"

payload = { "files": [
        {
            "path": "parts/bracket.prt",
            "contentType": "application/octet-stream",
            "sha256": "9f2c1b7e4a6d8c0f3e5b2a917d4c6e8f1a3b5c7d9e0f1a2b3c4d5e6f7a8b9c0d",
            "size": 482113
        }
    ] }
headers = {
    "Authorization": "Bearer <API key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Files_createUploads_example
const url = 'https://api.cadrooms.workers.dev/v1/projects/6c83044f-ec8a-4a01-8a6b-e8b3eb988d2b/uploads';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <API key>', 'Content-Type': 'application/json'},
  body: '{"files":[{"path":"parts/bracket.prt","contentType":"application/octet-stream","sha256":"9f2c1b7e4a6d8c0f3e5b2a917d4c6e8f1a3b5c7d9e0f1a2b3c4d5e6f7a8b9c0d","size":482113}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Files_createUploads_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.cadrooms.workers.dev/v1/projects/6c83044f-ec8a-4a01-8a6b-e8b3eb988d2b/uploads"

	payload := strings.NewReader("{\n  \"files\": [\n    {\n      \"path\": \"parts/bracket.prt\",\n      \"contentType\": \"application/octet-stream\",\n      \"sha256\": \"9f2c1b7e4a6d8c0f3e5b2a917d4c6e8f1a3b5c7d9e0f1a2b3c4d5e6f7a8b9c0d\",\n      \"size\": 482113\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <API key>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Files_createUploads_example
require 'uri'
require 'net/http'

url = URI("https://api.cadrooms.workers.dev/v1/projects/6c83044f-ec8a-4a01-8a6b-e8b3eb988d2b/uploads")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <API key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"files\": [\n    {\n      \"path\": \"parts/bracket.prt\",\n      \"contentType\": \"application/octet-stream\",\n      \"sha256\": \"9f2c1b7e4a6d8c0f3e5b2a917d4c6e8f1a3b5c7d9e0f1a2b3c4d5e6f7a8b9c0d\",\n      \"size\": 482113\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Files_createUploads_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.cadrooms.workers.dev/v1/projects/6c83044f-ec8a-4a01-8a6b-e8b3eb988d2b/uploads")
  .header("Authorization", "Bearer <API key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"files\": [\n    {\n      \"path\": \"parts/bracket.prt\",\n      \"contentType\": \"application/octet-stream\",\n      \"sha256\": \"9f2c1b7e4a6d8c0f3e5b2a917d4c6e8f1a3b5c7d9e0f1a2b3c4d5e6f7a8b9c0d\",\n      \"size\": 482113\n    }\n  ]\n}")
  .asString();
```

```php Files_createUploads_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.cadrooms.workers.dev/v1/projects/6c83044f-ec8a-4a01-8a6b-e8b3eb988d2b/uploads', [
  'body' => '{
  "files": [
    {
      "path": "parts/bracket.prt",
      "contentType": "application/octet-stream",
      "sha256": "9f2c1b7e4a6d8c0f3e5b2a917d4c6e8f1a3b5c7d9e0f1a2b3c4d5e6f7a8b9c0d",
      "size": 482113
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <API key>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Files_createUploads_example
using RestSharp;

var client = new RestClient("https://api.cadrooms.workers.dev/v1/projects/6c83044f-ec8a-4a01-8a6b-e8b3eb988d2b/uploads");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <API key>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"files\": [\n    {\n      \"path\": \"parts/bracket.prt\",\n      \"contentType\": \"application/octet-stream\",\n      \"sha256\": \"9f2c1b7e4a6d8c0f3e5b2a917d4c6e8f1a3b5c7d9e0f1a2b3c4d5e6f7a8b9c0d\",\n      \"size\": 482113\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Files_createUploads_example
import Foundation

let headers = [
  "Authorization": "Bearer <API key>",
  "Content-Type": "application/json"
]
let parameters = ["files": [
    [
      "path": "parts/bracket.prt",
      "contentType": "application/octet-stream",
      "sha256": "9f2c1b7e4a6d8c0f3e5b2a917d4c6e8f1a3b5c7d9e0f1a2b3c4d5e6f7a8b9c0d",
      "size": 482113
    ]
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.cadrooms.workers.dev/v1/projects/6c83044f-ec8a-4a01-8a6b-e8b3eb988d2b/uploads")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```