# Get Relationships For Master Data

Operation ID: `getRelationshipsForMasterData`

Group: Value Accounting › Master Data Associations

[Open in the interactive reference](https://lensing.ai/api-docs/lensing/v1/endpoints/getRelationshipsForMasterData)

`POST /value-accounting/associations/search`

Read-only: A read that takes its filters in the body. Changes nothing, and ignores Idempotency-Key.

List every relationship touching one master-data record — which other records it is tagged to, since when, and whether this record asserted the relationship itself. Read-only; the companion of ensureRelationship (POST value-accounting/associations) and removeRelationship (POST value-accounting/associations/remove). Each relationship appears exactly ONCE (no double counting): a relationship is stored as two directed edges and this reads only the subject's own, so isImplicit always describes the SUBJECT — false when this record asserted the relationship, true when the edge exists because the other record tagged this one. When both records tagged each other, both sides read false. An empty page means the record has no relationships at all, which is also the condition the master-data delete guard requires before it will let the record be deleted. POST rather than GET because the subject is a (dimensionCode, id) pair and both halves are required — a UUID is unique within its dimension but not across dimensions. Cursor-paginated.

Lists every relationship touching ONE master-data record, with the far side resolved to its dimension, id and display name.

Each relationship appears exactly ONCE — no double counting. A relationship is stored as two directed edges and this reads only the subject's own, so `isImplicit` is always about the SUBJECT: false when this record asserted the relationship, true when the edge was created because the other record tagged this one. When both records tagged each other, both sides read false.

An empty page means the record has no relationships, which is also the condition the master-data delete guard requires before it will let the record be deleted.

POST rather than GET: the subject is a (dimensionCode, id) pair, and a paired predicate must not become two loose query params that admit a half-filled request.

Read-only, and the companion of ensureRelationship (POST value-accounting/associations) and removeRelationship (POST value-accounting/associations/remove).

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Api-Version` | header | string · v1 | yes | The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version `v1`. |

## Request body

Required, `application/json`: getRelationshipsForMasterDataInput.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `filters` | object | yes | Which relationships to read. Required, unlike the other searches' filters: there is no unfiltered collection of associations, because reading every association in the tenant is not a question anyone asks. Example: `{"record":{"dimensionCode":"department","id":"9a5e1c77-3b2d-4f10-8c6e-1d40a7b93c58"}}`. |
| `filters.record` | object | yes | The master-data record whose relationships you want, as the (dimensionCode, id) pair. Both halves are required: a UUID is unique within its dimension, not across dimensions. |
| `filters.record.dimensionCode` | string | yes | Dimension the record belongs to. One of 'department', 'businessUnit', 'team', 'location', 'region', 'employee', 'vendor', 'customer', 'valueCenter', 'custom' ('custom' being a custom value object). An unknown code raises UNSUPPORTED_DIMENSION_CODE. |
| `filters.record.id` | string | yes | Id (a UUID) of the master-data record — the same value resolveReportingTags (POST base/reporting-tags/resolve) returns as modelUuid. An id that resolves to no record of that dimension raises RECORD_NOT_FOUND, which is deliberately different from the record existing with no relationships (an empty page). Ids are matched case-insensitively and returned in canonical lowercase. |
| `page` | object | no | Cursor and page size. Omit for the first page at the default size. Example: `{"size":50}`. |
| `page.cursor` | string | no | Opaque forward cursor from a previous response's pagination.nextCursor; omit for the first page. Do not construct or decode it — a token is bound to this endpoint and to the subject record it was issued for, so one from another endpoint, from another record's walk, or altered by hand raises INVALID_CURSOR rather than silently restarting at the first page, which would make a paging loop repeat forever. It encodes the LAST ROW of the page you received, not a position, so the walk resumes AT THAT ROW rather than at a count: a row created or removed before your position cannot make a later page repeat a row you already saw or skip one you have not. |
| `page.size` | number | no | Maximum number of relationships to return. Defaults to 50, capped at 200; a larger value is clamped rather than rejected, so the server may return fewer but never more. |

```json
{
  "filters": {
    "record": {
      "dimensionCode": "department",
      "id": "9a5e1c77-3b2d-4f10-8c6e-1d40a7b93c58"
    }
  }
}
```

## Response

`200` Success

Under `data` (getRelationshipsForMasterDataOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `items` | array<object> | yes | The relationships on this page, one row per relationship. Empty when the record has none — an empty page with HTTP 200, never a 404. Ordered by the far side's dimension then id — a unique composite key per row. The cursor is a KEYSET cursor over that order (it resumes at the last row of the page you received): a relationship added after your cursor position appears on a later page, one added before it does not, and no row is ever repeated or skipped while you walk. |
| `items[].relatedRecord` | object | yes | The record on the FAR side of the relationship, in the same (dimensionCode, id) shape the write endpoints take — pass it straight back to removeRelationship (POST value-accounting/associations/remove) to undo the relationship. |
| `items[].relatedRecord.dimensionCode` | string | yes | Dimension the far-side record belongs to. One of the ten dimension codes. |
| `items[].relatedRecord.id` | string | yes | Id (a UUID) of the far-side master-data record. |
| `items[].relatedRecord.name` | string | yes | Display name of the far-side record, as it appears in tagging UIs and on reports. Resolved for convenience so a table need not make a second call; it is not part of the record's identity. |
| `items[].isImplicit` | boolean | yes | False when THIS record asserted the relationship — its own edge is explicit. True when the edge exists because the far side tagged this record. When both records tagged each other, both sides read false. It never changes what is reported; it records who claimed the relationship. |
| `items[].startDate` | date | no | Date the relationship starts, as YYYY-MM-DD. Absent only for a row written before dates were required. |
| `items[].endDate` | date | no | Date the relationship ends, as YYYY-MM-DD. Absent — not null — for an open-ended relationship. |
| `items[].status` | string | no | Consistency status of the association anchor holding this edge, 'consistent' or 'inconsistent'. Documentation only: no reporting figure depends on it, and an inconsistent anchor still tags normally. |
| `items[].lastModifiedDate` | date-time | yes | Instant this relationship last changed, as ISO 8601 UTC (YYYY-MM-DDTHH:mm:ss.sssZ). It is the edge's own last change, not the far-side record's. Sync incrementally by keeping the highest value you have seen and re-reading the subject's relationships when it moves. |
| `unresolvedCount` | number | yes | How many relationships on this page could not be published because their far side no longer resolves to a master-data record — a custom dimension removed, or the far-side record no longer existing. Zero normally. Those rows are absent from items rather than returned half-built, so this is the only way to tell an incomplete page from a complete one. |
| `pagination` | object | yes | Pagination cursor for this page. |
| `pagination.nextCursor` | string | no | Opaque cursor to pass as `page.cursor` for the next page; absent on the last page. |
| `pagination.hasMore` | boolean | yes | True when more relationships remain beyond this page. |

```json
{
  "data": {
    "items": [
      {
        "relatedRecord": {
          "dimensionCode": "<dimensionCode>",
          "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
          "name": "<name>"
        },
        "isImplicit": true,
        "startDate": "2026-01-15",
        "endDate": "2026-01-15",
        "status": "<status>",
        "lastModifiedDate": "2026-01-15T09:30:00.000Z"
      }
    ],
    "unresolvedCount": 0,
    "pagination": {
      "nextCursor": "<nextCursor>",
      "hasMore": true
    }
  },
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}
```

## Errors

| Code | Status |
| --- | --- |
| `UNSUPPORTED_DIMENSION_CODE` | 400 |
| `RECORD_NOT_FOUND` | 400 |
| `INVALID_CURSOR` | 400 |

## Statuses

- `400` — Invalid request or business failure. Codes: UNSUPPORTED_DIMENSION_CODE, RECORD_NOT_FOUND, INVALID_CURSOR
- `401` — The request carries no valid access token.
- `403` — Not authorized
- `404` — Not found
- `429` — Too many requests from this client address. The response has no body and no `Retry-After` header.
- `500` — Internal server error
