---
title: "Swarm Edges"
description: "REST endpoints for swarm edges. Bearer-auth required."
section: "API"
group: "REST"
order: 63
---

## GET /api/swarm-edges

List swarm edges for a swarm version.

**Query parameters**

- `limit` (optional): Page size (1–100, default 100).
- `after` (optional): Keyset cursor — return the page after this row (next page).
- `before` (optional): Keyset cursor — return the page before this row (prev page).
- `ids` (optional): Comma-separated list of IDs. Narrows results to these IDs within the caller's accessible scope (does not bypass access checks).
- `filter` (optional): Nested filter expression (`<Entity>Filter`): AND/OR/NOT + per-field comparison operators + relation traversal. JSON-encoded on the query string.
- `orderBy` (optional): Multi-key sort (`<Entity>OrderBy[]`): array of `{ field: direction }` applied in order. Directions: asc/desc plus the four explicit nulls variants. JSON-encoded on the query string.
- `swarm_version_id` (required): Swarm version whose edges to list.
- `source_node_id` (optional): Shorthand: filter where `sourceNodeId` equals this value.
- `target_node_id` (optional): Shorthand: filter where `targetNodeId` equals this value.

**Response**

```json
{
  "data": [
    {
      "id": "<...>",
      "swarmVersionId": "<...>",
      "sourceNodeId": "<...>",
      "targetNodeId": "<...>"
    }
  ]
}
```

## POST /api/swarm-edges

Add an edge to a swarm version

**Request body**

```json
{
  "swarmVersionId": "string",
  "sourceNodeId": "string",
  "targetNodeId": "string"
}
```

**Response**

```json
{
  "id": "string",
  "swarmVersionId": "string",
  "sourceNodeId": "string",
  "targetNodeId": "string"
}
```

## GET /api/swarm-edges/{id}

Get a swarm edge by ID.

**Path parameters**

- `id` (required): Edge to retrieve.

**Response**

```json
{
  "id": "string",
  "swarmVersionId": "string",
  "sourceNodeId": "string",
  "targetNodeId": "string"
}
```

## DELETE /api/swarm-edges/{id}

Delete a swarm edge.

**Path parameters**

- `id` (required): Edge to remove.

**Response**

```json
{
  "success": "boolean"
}
```
