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

# List the dependency tree

GET https://api.cadrooms.workers.dev/v1/revisions/{revisionId}/dependency-tree

Lists the dependencies of a file at the specified revision, including nested dependencies up to the specified depth.

The result is a flat list. Each entry includes its parent and level, allowing you to reconstruct the dependency tree. Dependencies referenced in multiple places are expanded only once. Entries with a `missing` status are not expanded further.

Only dependencies within the same project are followed.

Required permission: Viewer or higher in the project.


Reference: https://docs.cadrooms.com/api-reference/file-relationship/list-dependency-tree

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

- `revisionId` (string, required) — Unique identifier of the revision.

### Query parameters

- `levels` (integer, optional, default: 100) — Number of levels to follow. Accepts values between 1 and 100.
- `limit` (integer, optional, default: 100) — Maximum number of records to return per page. Accepts values between 1 and 1000.
- `cursor` (string, optional) — Cursor for retrieving the next page. Use the `nextCursor` value from the previous response. Omit for the first page.

## Response

### 200

Returns a paginated, flat list of dependencies, ordered by level.

- `data` (list of DependencyTreeItem, required) — Array of records returned for the current page, following the endpoint's defined sort order.
- `nextCursor` (string, required, nullable) — Cursor for retrieving the next page. Returns `null` when there are no more results.
- `totalCount` (integer, optional) — Number of records that match the request, across all pages. Returned only when the list accepts `include=totalCount` and you send it.

## Errors

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

### DependencyTreeItem

One row of a dependency tree.

- `id` (string, required) — Unique identifier for the link between the two files.
- `parentPath` (string, required) — Path of the file that uses this dependency.
- `path` (string, required, nullable) — Path of the dependency, or `null` if it is not found in the project.
- `referencedName` (string, required) — Filename referenced by the parent file.
- `level` (integer, required) — Level in the tree, starting at 1.
- `status` (enum, required) — Indicates whether the referenced file has been resolved.
  - Allowed values: `resolved`, `missing`, `ignored`
- `revisionId` (string, required, nullable) — ID of the dependency's revision, or `null` if it is not found in the project.

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

### ErrorErrorDetailsItems

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

## Examples

**SDK Code**

```python
import requests

url = "https://api.cadrooms.workers.dev/v1/revisions/b8486747-4d21-4260-a8dd-4ece97cbac49/dependency-tree"

headers = {"Authorization": "Bearer <API key>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.cadrooms.workers.dev/v1/revisions/b8486747-4d21-4260-a8dd-4ece97cbac49/dependency-tree';
const options = {method: 'GET', headers: {Authorization: 'Bearer <API key>'}};

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

```go
package main

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

func main() {

	url := "https://api.cadrooms.workers.dev/v1/revisions/b8486747-4d21-4260-a8dd-4ece97cbac49/dependency-tree"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <API key>")

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

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

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

}
```

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

url = URI("https://api.cadrooms.workers.dev/v1/revisions/b8486747-4d21-4260-a8dd-4ece97cbac49/dependency-tree")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <API key>'

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

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

HttpResponse<String> response = Unirest.get("https://api.cadrooms.workers.dev/v1/revisions/b8486747-4d21-4260-a8dd-4ece97cbac49/dependency-tree")
  .header("Authorization", "Bearer <API key>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.cadrooms.workers.dev/v1/revisions/b8486747-4d21-4260-a8dd-4ece97cbac49/dependency-tree', [
  'headers' => [
    'Authorization' => 'Bearer <API key>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.cadrooms.workers.dev/v1/revisions/b8486747-4d21-4260-a8dd-4ece97cbac49/dependency-tree");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <API key>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <API key>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.cadrooms.workers.dev/v1/revisions/b8486747-4d21-4260-a8dd-4ece97cbac49/dependency-tree")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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()
```