> For the complete documentation index, see [llms.txt](https://flapjax.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://flapjax.gitbook.io/docs/rest-api/reference/record-events/get-related-entities-by-external-id.md).

# Get Related Entities (by External ID)

## Get related entities for a record (by external ID)

> Returns the entities related to a record through a specific relationship attribute. The record is identified by its external ID.\
> \
> The \*\*return type depends on the attribute's data type\*\*:\
> \- \*\*Person/People-type attributes\*\* return related people.\
> \- \*\*Stack-type attributes\*\* return related records from the linked stack.\
> \
> Behaves identically to the record ID variant but uses the external ID as the record identifier.<br>

```json
{"openapi":"3.0.3","info":{"title":"Listener API","version":"1.0.0"},"tags":[{"name":"get-record-related-by-external-id"}],"servers":[{"url":"https://{domain}/v1","variables":{"domain":{"default":"your-domain","description":"Your deployment domain"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT token with the required scope for the endpoint. Pass via the `Authorization: Bearer <token>` header.\n"}},"parameters":{"StackKey":{"name":"stack_key","in":"path","required":true,"description":"The unique key identifying the stack.","schema":{"type":"string"}},"RecordExternalId":{"name":"external_id","in":"path","required":true,"description":"The external identifier of the record.","schema":{"type":"string"}},"AttributeKey":{"name":"attribute_key","in":"path","required":true,"description":"The key of the relationship attribute to traverse.","schema":{"type":"string"}}},"schemas":{"PaginationRequest":{"type":"object","description":"Pagination parameters for list and related endpoints. If omitted entirely, defaults are used (size 50, descending order).\n","properties":{"cursor_configuration":{"$ref":"#/components/schemas/CursorConfiguration"},"sorting_type":{"type":"string","description":"Sort order for results.","enum":["asc","desc"],"default":"desc"}}},"CursorConfiguration":{"type":"object","description":"Cursor-based pagination configuration.","properties":{"size":{"type":"integer","description":"Number of results per page.","default":50},"after_id":{"type":"string","description":"ID from a previous response. When provided, results start after this ID.\n"}}},"PaginatedResponse":{"type":"object","description":"Response envelope containing a paginated list.","properties":{"status":{"type":"string","enum":["Success"]},"data":{"type":"object","properties":{"items":{"type":"array","description":"The page of results.","items":{"type":"object"}}}}}},"ErrorResponse":{"type":"object","description":"Standard error response envelope.","properties":{"error":{"type":"string","description":"Machine-readable error type. Use this for programmatic error handling.\n","enum":["operation_failed","failed_binding_json","invalid_json","invalid_parameter","not_found","duplicate_entry","rate_limit_exceeded"]},"errorstack":{"type":"object","nullable":true,"description":"Detailed error stack (only present for server errors)."}}}}},"paths":{"/stacks/{stack_key}/{external_id}/attributes/{attribute_key}/related":{"post":{"summary":"Get related entities for a record (by external ID)","operationId":"getRecordRelatedByExternalId","tags":["get-record-related-by-external-id"],"description":"Returns the entities related to a record through a specific relationship attribute. The record is identified by its external ID.\n\nThe **return type depends on the attribute's data type**:\n- **Person/People-type attributes** return related people.\n- **Stack-type attributes** return related records from the linked stack.\n\nBehaves identically to the record ID variant but uses the external ID as the record identifier.\n","parameters":[{"$ref":"#/components/parameters/StackKey"},{"$ref":"#/components/parameters/RecordExternalId"},{"$ref":"#/components/parameters/AttributeKey"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginationRequest"}}}},"responses":{"200":{"description":"Paginated list of related entities (people or records depending on attribute type).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse"}}}},"500":{"description":"Record, stack, or attribute not found, or internal error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```
