> 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.

# Share a file

POST https://api.cadrooms.workers.dev/v1/shares
Content-Type: application/json

Shares the file version associated with a revision with users or email addresses. CAD ROOMS adds each user who is not already a workspace member as a guest and notifies the user.

A pending share is created for each email address not associated with a CAD ROOMS account. CAD ROOMS sends an invitation email unless the address already has a pending invitation to the workspace. The share is confirmed when the recipient signs up.

Any user or email address for which sharing fails is listed in `errors`. The remaining shares are created successfully.

Required permission: Collaborator or higher in the project.


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

## 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

### Body (application/json)

This endpoint expects a ShareCreate.

- `revisionId` (string, required) — The revision whose file version to share.
- `userIds` (list of string, optional) — IDs of the users to share the file with.
- `emails` (list of string, optional) — Email addresses to share the file with.

## Response

### 201

Returns the new shares in `data`. A user or email address that could not be shared with is listed in `errors`.

- `data` (list of Share, required) — The new shares.
- `errors` (list of ShareError, optional) — The users and email addresses that could not be shared with.

## 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

### Share

Represents a share of one file version with a user or an email address.

- `id` (string, required, nullable) — Unique identifier of the share, or `null` if the share is pending.
- `status` (enum, required) — Whether the share is active. - `confirmed`: The user has access to the file. - `pending`: The email address has no CAD ROOMS account yet.
  - Allowed values: `confirmed`, `pending`
- `user` (User, required, nullable) — The user, or `null` if the share is pending.
- `email` (string, required) — Email address of the user or the pending share.
- `avatarUrl` (string, required, nullable) — URL of the user's avatar, or `null` if there is none.
- `sharedById` (string, required, nullable) — ID of the user who shared the file, or `null` if unknown.
- `isGuest` (boolean, required) — Whether the share is with a workspace guest.
- `projectId` (string, required) — ID of the project that holds the file.
- `projectName` (string, required) — Name of the project that holds the file.
- `projectSlug` (string, required) — URL-friendly identifier of the project, used in its app URL.
- `path` (string, required) — Path of the file in the project.
- `revisionId` (string, required) — ID of the shared revision.
- `revisionMajor` (string, required) — Letter part of the shared revision.
- `revisionMinor` (integer, required) — Number part of the shared revision.
- `createdAt` (datetime, required) — Time at which the file was shared.

### ShareError

A user or email address that could not be shared with. It has `userId` or `email`, matching what you sent.

- `reason` (string, required) — Why the file could not be shared.
- `userId` (string, optional) — ID of the user.
- `email` (string, optional) — Email address.

### 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.

### User

Represents a CAD ROOMS user.

- `id` (string, required) — Unique identifier for the user.
- `displayName` (string, required) — User's display name in the CAD ROOMS app.

### ErrorErrorDetailsItems

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

## Examples

**Request**

```json
{
  "revisionId": "e88d65cd-879d-4df3-adfc-ef0ca99238bf",
  "userIds": [
    "f008611c-2eef-4880-af86-94dbc7ecf9f7"
  ],
  "emails": [
    "john.doe@example.com"
  ]
}
```

**Response**

```json
{
  "data": [
    {
      "id": "1f6b2d90-8c47-4e15-b3a2-7d9e0c5f4a18",
      "status": "confirmed",
      "user": {
        "id": "f008611c-2eef-4880-af86-94dbc7ecf9f7",
        "displayName": "Jane Doe"
      },
      "email": "jane.doe@example.com",
      "avatarUrl": null,
      "sharedById": "40a078d1-1f99-459a-a09a-f21da9c5dce4",
      "isGuest": true,
      "projectId": "356d9a6c-31e9-4d9c-ad55-de709172d893",
      "projectName": "Gearbox v2",
      "projectSlug": "gearbox-v2",
      "path": "parts/bracket.prt",
      "revisionId": "e88d65cd-879d-4df3-adfc-ef0ca99238bf",
      "revisionMajor": "A",
      "revisionMinor": 3,
      "createdAt": "2026-10-09T09:00:00Z"
    }
  ],
  "errors": [
    {
      "reason": "File is already shared with this email",
      "email": "john.doe@example.com"
    }
  ]
}
```

**SDK Code**

```python Files_createShares_example
import requests

url = "https://api.cadrooms.workers.dev/v1/shares"

payload = {
    "revisionId": "e88d65cd-879d-4df3-adfc-ef0ca99238bf",
    "userIds": ["f008611c-2eef-4880-af86-94dbc7ecf9f7"],
    "emails": ["john.doe@example.com"]
}
headers = {
    "Authorization": "Bearer <API key>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Files_createShares_example
const url = 'https://api.cadrooms.workers.dev/v1/shares';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <API key>', 'Content-Type': 'application/json'},
  body: '{"revisionId":"e88d65cd-879d-4df3-adfc-ef0ca99238bf","userIds":["f008611c-2eef-4880-af86-94dbc7ecf9f7"],"emails":["john.doe@example.com"]}'
};

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

```go Files_createShares_example
package main

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

func main() {

	url := "https://api.cadrooms.workers.dev/v1/shares"

	payload := strings.NewReader("{\n  \"revisionId\": \"e88d65cd-879d-4df3-adfc-ef0ca99238bf\",\n  \"userIds\": [\n    \"f008611c-2eef-4880-af86-94dbc7ecf9f7\"\n  ],\n  \"emails\": [\n    \"john.doe@example.com\"\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_createShares_example
require 'uri'
require 'net/http'

url = URI("https://api.cadrooms.workers.dev/v1/shares")

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  \"revisionId\": \"e88d65cd-879d-4df3-adfc-ef0ca99238bf\",\n  \"userIds\": [\n    \"f008611c-2eef-4880-af86-94dbc7ecf9f7\"\n  ],\n  \"emails\": [\n    \"john.doe@example.com\"\n  ]\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.cadrooms.workers.dev/v1/shares")
  .header("Authorization", "Bearer <API key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"revisionId\": \"e88d65cd-879d-4df3-adfc-ef0ca99238bf\",\n  \"userIds\": [\n    \"f008611c-2eef-4880-af86-94dbc7ecf9f7\"\n  ],\n  \"emails\": [\n    \"john.doe@example.com\"\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.cadrooms.workers.dev/v1/shares', [
  'body' => '{
  "revisionId": "e88d65cd-879d-4df3-adfc-ef0ca99238bf",
  "userIds": [
    "f008611c-2eef-4880-af86-94dbc7ecf9f7"
  ],
  "emails": [
    "john.doe@example.com"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <API key>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Files_createShares_example
using RestSharp;

var client = new RestClient("https://api.cadrooms.workers.dev/v1/shares");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <API key>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"revisionId\": \"e88d65cd-879d-4df3-adfc-ef0ca99238bf\",\n  \"userIds\": [\n    \"f008611c-2eef-4880-af86-94dbc7ecf9f7\"\n  ],\n  \"emails\": [\n    \"john.doe@example.com\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Files_createShares_example
import Foundation

let headers = [
  "Authorization": "Bearer <API key>",
  "Content-Type": "application/json"
]
let parameters = [
  "revisionId": "e88d65cd-879d-4df3-adfc-ef0ca99238bf",
  "userIds": ["f008611c-2eef-4880-af86-94dbc7ecf9f7"],
  "emails": ["john.doe@example.com"]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.cadrooms.workers.dev/v1/shares")! 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()
```