---
title: "Walk the org-wide graph outward from an entity"
---

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

# Walk the org-wide graph outward from an entity

Path: CloudRaker Workspace API › Ontology

`GET /ontology/entities/{entityId}/related`

Returns `{ entities, edges }` — the neighbourhood of an entity within the org-wide (`org`) graph, up to `?depth=` hops (1-3, default 1). Neighbour entities carry `id`, `type`, `name`, `distance`; edges carry `sourceId`, `targetId`, `relation`, `fileId`. Org-admin only — requires the admin role; non-admins get a 403.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `entityId` (`getOrgOntologyRelatedEntities.path.entityId`; string, required)

## Query parameters

- `depth` (`getOrgOntologyRelatedEntities.query.depth`; integer, optional) — Hops to walk, 1–3.
  - min 1; max 3; default `1`

## Code samples

### cURL

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

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/ontology/entities/<entityId>/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/ontology/entities/<entityId>/related"

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

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

print(response.text)
```

## Responses

### 200

Neighbouring entities and the connecting edges.

#### Example

```json
{
  "entities": [
    {
      "id": "string",
      "type": "organization",
      "name": "string",
      "distance": -9007199254740991
    }
  ],
  "edges": [
    {
      "sourceId": "string",
      "targetId": "string",
      "relation": "employed_by",
      "fileId": "string"
    }
  ]
}
```

- `entities` (`getOrgOntologyRelatedEntities.response.200.entities`; array<object>, required)
  - `id` (`getOrgOntologyRelatedEntities.response.200.entities.id`; string, required)
  - `type` (`getOrgOntologyRelatedEntities.response.200.entities.type`; string, required)
    - example `"organization"`
  - `name` (`getOrgOntologyRelatedEntities.response.200.entities.name`; string, required)
  - `distance` (`getOrgOntologyRelatedEntities.response.200.entities.distance`; integer, required) — Hops from the seed entity.
    - min -9007199254740991; max 9007199254740991
- `edges` (`getOrgOntologyRelatedEntities.response.200.edges`; array<object>, required)
  - `sourceId` (`getOrgOntologyRelatedEntities.response.200.edges.sourceId`; string, required)
  - `targetId` (`getOrgOntologyRelatedEntities.response.200.edges.targetId`; string, required)
  - `relation` (`getOrgOntologyRelatedEntities.response.200.edges.relation`; string, required)
    - example `"employed_by"`
  - `fileId` (`getOrgOntologyRelatedEntities.response.200.edges.fileId`; string, required) — The file the relation was observed in.


Source: https://docs.cloudraker.com/workspace/api/ontology/get-org-ontology-related-entities/index.md
