---
title: "Find other files in the space that share entities with this one"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.cloudraker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Find other files in the space that share entities with this one

Path: CloudRaker Workspace API › Ontology

`GET /spaces/{spaceId}/ontology/files/{fileId}/related`

Returns `{ files }` — documents in the same space connected to `:fileId` through shared entities, ranked by `score` (more or rarer shared entities score higher). Each item has `fileId`, `score`, and `shared` (the overlapping entities as `{ entityId, name, type }`). Use it for 'documents related to this one'. Requires `space:read` on `:spaceId`; missing access surfaces as a 404.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `spaceId` (`listRelatedFiles.path.spaceId`; string, required)
- `fileId` (`listRelatedFiles.path.fileId`; string, required)

## Code samples

### cURL

```bash
curl --request GET \
  --url 'https://api.cloudraker.com/spaces/<spaceId>/ontology/files/<fileId>/related' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/spaces/<spaceId>/ontology/files/<fileId>/related';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/spaces/<spaceId>/ontology/files/<fileId>/related"

headers = {"Authorization": "Bearer <token>"}

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

print(response.text)
```

## Responses

### 200

Related files ranked by shared-entity overlap.

#### Example

```json
{
  "files": [
    {
      "fileId": "string",
      "score": -9007199254740991,
      "shared": [
        {
          "entityId": "string",
          "name": "string",
          "type": "organization"
        }
      ]
    }
  ]
}
```

- `files` (`listRelatedFiles.response.200.files`; array<object>, required)
  - `fileId` (`listRelatedFiles.response.200.files.fileId`; string, required)
  - `score` (`listRelatedFiles.response.200.files.score`; integer, required) — Count of shared entities; higher ranks first.
    - min -9007199254740991; max 9007199254740991
  - `shared` (`listRelatedFiles.response.200.files.shared`; array<object>, required)
    - `entityId` (`listRelatedFiles.response.200.files.shared.entityId`; string, required)
    - `name` (`listRelatedFiles.response.200.files.shared.name`; string, required)
    - `type` (`listRelatedFiles.response.200.files.shared.type`; string, required)
      - example `"organization"`


Source: https://docs.cloudraker.com/workspace/api/ontology/list-related-files/index.md
