---
title: "Find related edges (findByQuery)"
method: POST
path: "/api/edges"
tags: ["edge-controller"]
---

# Find related edges (findByQuery)

`POST /api/edges`

Returns all edges that are related to the specific entity. The entity id, relation type, edge types, depth of the search, and other query parameters defined using complex 'EdgeSearchQuery' object. See 'Model' tab of the Parameters for more info.

Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority.

## Request body

- EdgeSearchQuery
  - `parameters` RelationsSearchParameters
    - `rootId` string, uuid — Root entity id to start search from.
    - `rootType` 'TENANT' | 'CUSTOMER' | 'USER' | 'DASHBOARD' | 'ASSET' | 'DEVICE' | 'ALARM' | 'RULE_CHAIN' | 'RULE_NODE' | 'ENTITY_VIEW' | 'WIDGETS_BUNDLE' | 'WIDGET_TYPE' | 'TENANT_PROFILE' | 'DEVICE_PROFILE' | 'ASSET_PROFILE' | 'API_USAGE_STATE' | 'TB_RESOURCE' | 'OTA_PACKAGE' | 'EDGE' | 'RPC' | 'QUEUE' | 'NOTIFICATION_TARGET' | 'NOTIFICATION_TEMPLATE' | 'NOTIFICATION_REQUEST' | 'NOTIFICATION' | 'NOTIFICATION_RULE' | 'QUEUE_STATS' | 'OAUTH2_CLIENT' | 'DOMAIN' | 'MOBILE_APP' | 'MOBILE_APP_BUNDLE' | 'CALCULATED_FIELD' | 'JOB' | 'ADMIN_SETTINGS' | 'AI_MODEL' | 'API_KEY' — Type of the root entity.
    - `direction` 'FROM' | 'TO' — Type of the root entity.
    - `relationTypeGroup` 'COMMON' | 'DASHBOARD' | 'RULE_CHAIN' | 'RULE_NODE' | 'EDGE' | 'EDGE_AUTO_ASSIGN_RULE_CHAIN' — Type of the relation.
    - `maxLevel` integer — Maximum level of the search depth.
    - `fetchLastLevelOnly` boolean — Fetch entities that match the last level of search. Useful to find Devices that are strictly 'maxLevel' relations away from the root entity.
  - `relationType` string — Type of the relation between root entity and edge (e.g. 'Contains' or 'Manages').
  - `edgeTypes` string[] — Array of edge types to filter the related entities (e.g. 'Silos', 'Stores').

## Response `200`

OK

- Edge[]
  - `id` EdgeId
    - `id` string, uuid, required — ID of the entity, time-based UUID v1
    - `entityType` 'EDGE', required — string
  - `createdTime` integer — Timestamp of the edge creation, in milliseconds
  - `tenantId` TenantId
    - `id` string, uuid, required — ID of the entity, time-based UUID v1
    - `entityType` 'TENANT', required — string
  - `customerId` CustomerId
    - `id` string, uuid, required — ID of the entity, time-based UUID v1
    - `entityType` 'CUSTOMER', required — string
  - `rootRuleChainId` RuleChainId
    - `id` string, uuid, required — ID of the entity, time-based UUID v1
    - `entityType` 'RULE_CHAIN', required — string
  - `name` string, required — Unique Edge Name in scope of Tenant
  - `type` string, required — Edge type
  - `label` string — Label that may be used in widgets
  - `routingKey` string, required — Edge routing key ('username') to authorize on cloud
  - `secret` string, required — Edge secret ('password') to authorize on cloud
  - `version` integer
  - `additionalInfo` unknown

---

[API](https://skmtc.net/thingsboard/apis/thingsboard-rest-api.md) · [All operations](https://skmtc.net/thingsboard/apis/thingsboard-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/thingsboard/thingsboard-rest-api/revisions/40169ccdec5c/schema)
