# Relations

> The Relations operations of the Hub REST API (3 operations).

URL: https://docs.synap.live/docs/reference/hub-api/relations · Generated from Synap-core/backend@c31e261ab (main)

Paths are relative to `/api/hub` on a pod.

## GET /relations

List relations

Returns relations in a workspace. Filter by `entityId` (either side of the edge) and/or `type`.

Parameters:

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `userId` | query | string | yes |  |
| `workspaceId` | query | string | yes |  |
| `entityId` | query | string |  | Filter to relations involving this entity (either side). |
| `type` | query | string |  | Filter by relation type. |

Responses:

- `200`: Array of relations
- `400`: Missing required param
- `403`: Forbidden
- `500`: Internal error

## POST /relations

Create a relation

Creates a typed edge between two entities.

Request body (`application/json`): CreateRelationRequest

| Field | Type | Required | Description |
|---|---|---|---|
| `userId` | string | yes |  |
| `workspaceId` | string | yes |  |
| `sourceEntityId` | string | yes |  |
| `targetEntityId` | string | yes |  |
| `type` | string | yes | Relation type identifier (e.g. parent_of, references). |
| `metadata` | object |  |  |
| `agentUserId` | string |  |  |
| `reasoning` | string |  |  |
| `sourceMessageId` | string |  |  |

Responses:

- `200`: Created relation
- `400`: Bad request
- `403`: Forbidden
- `500`: Internal error

## DELETE /relations/{relationId}

Delete a relation

Parameters:

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `relationId` | path | string | yes |  |

Request body (`application/json`): DeleteRelationRequest

| Field | Type | Required | Description |
|---|---|---|---|
| `userId` | string |  |  |
| `workspaceId` | string |  |  |
| `agentUserId` | string |  |  |
| `reasoning` | string |  |  |
| `sourceMessageId` | string |  |  |

Responses:

- `200`: Deletion result
- `400`: Bad request
- `403`: Forbidden
- `500`: Internal error
