Skip to main content
POST
/
relationships
/
list
JavaScript SDK
const relationships = await client.relationships.list({ filter: { createdTime: { min: new Date('1 jan 2018'), max: new Date('1 jan 2019') }}});
{
  "items": [
    {
      "externalId": "<string>",
      "sourceExternalId": "<string>",
      "sourceType": "asset",
      "targetExternalId": "<string>",
      "targetType": "asset",
      "createdTime": 1730204346000,
      "lastUpdatedTime": 1730204346000,
      "startTime": 1730204346000,
      "endTime": 1730204346000,
      "confidence": 0.5,
      "dataSetId": 4503599627370496,
      "labels": [
        {
          "externalId": "my.known.id"
        }
      ],
      "source": {
        "createdTime": 1730204346000,
        "lastUpdatedTime": 1730204346000,
        "rootId": 4503599627370496,
        "name": "<string>",
        "id": 4503599627370496,
        "aggregates": {
          "childCount": 1,
          "depth": 1,
          "path": [
            {
              "id": 4503599627370496
            }
          ]
        },
        "parentId": 4503599627370496,
        "parentExternalId": "my.known.id",
        "externalId": "my.known.id",
        "description": "<string>",
        "dataSetId": 4503599627370496,
        "metadata": {},
        "source": "<string>",
        "labels": [
          {
            "externalId": "my.known.id"
          }
        ],
        "geoLocation": {
          "type": "Feature",
          "geometry": {
            "type": "Point",
            "coordinates": [
              123
            ]
          },
          "properties": {}
        }
      },
      "target": {
        "createdTime": 1730204346000,
        "lastUpdatedTime": 1730204346000,
        "rootId": 4503599627370496,
        "name": "<string>",
        "id": 4503599627370496,
        "aggregates": {
          "childCount": 1,
          "depth": 1,
          "path": [
            {
              "id": 4503599627370496
            }
          ]
        },
        "parentId": 4503599627370496,
        "parentExternalId": "my.known.id",
        "externalId": "my.known.id",
        "description": "<string>",
        "dataSetId": 4503599627370496,
        "metadata": {},
        "source": "<string>",
        "labels": [
          {
            "externalId": "my.known.id"
          }
        ],
        "geoLocation": {
          "type": "Feature",
          "geometry": {
            "type": "Point",
            "coordinates": [
              123
            ]
          },
          "properties": {}
        }
      }
    }
  ],
  "nextCursor": "<string>"
}

Authorizations

Authorization
string
header
required

Access token issued by the CDF project's configured identity provider. Access token must be an OpenID Connect token, and the project must be configured to accept OpenID Connect tokens. Use a header key of 'Authorization' with a value of 'Bearer $accesstoken'. The token can be obtained through any flow supported by the identity provider.

Body

application/json

Data required to filter relationships. Combined filters are interpreted as an AND operation (not OR). Only relationships that match ALL the provided filters are returned.

filter
object

Filter on relationships with exact match. Multiple filter elements in one property, for example sourceExternalIds: [ "a", "b" ], returns all relationships where the sourceExternalId field is eitheraorb`. Filters in multiple properties return relationships that match all criteria. If the filter is not specified, it defaults to an empty filter.

limit
any
cursor
any
fetchResources
boolean
default:false

If true, will try to fetch the resources referred to in the relationship, based on the users access rights. Will silently fail to attatch the resources if the user lacks access to some of them.

partition
string

Splits the data set into N partitions. The attribute is specified as a "M/N" string, where M is a natural number in the interval of [1, N]. You need to follow the cursors within each partition in order to receive all the data.

To prevent unexpected problems and maximize read throughput, you should at most use 10 (N <= 10) partitions.

When using more than 10 partitions, CDF may reduce the number of partitions silently. For example, CDF may reduce the number of partitions to K = 10 so if you specify an X/N partition value where X = 8 and N = 20 - i.e. "partition": "8/20"- then CDF will change N to N = K = 10 and process the request. But if you specify the X/N partition value where X = 11 (X > K) and N = 20 - i.e. "partition": "11/20"- then CDF will reply with an empty result list and no cursor in the response.\

In future releases of the resource APIs, Cognite may reject requests if you specify more than 10 partitions. When Cognite enforces this behavior, the requests will result in a 400 Bad Request status.

Example:

"1/10"

Response

One page of relationships stored by CDF that match the provided filter.

items
object[]
required
Required array length: 1 - 1000 elements
nextCursor
string

The cursor to get the next page of results (if available).

Last modified on April 23, 2026