Swarms

REST endpoints for swarms. Bearer-auth required.

GET /api/swarms

List swarms.

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.
  • workspace_id (optional): Filter to swarms in this workspace. When omitted, returns swarms across every workspace the caller is a member of (admins see all).
  • include_deleted (optional): Soft-deleted swarm visibility. false (default) — active rows only. true — active plus soft-deleted. only — soft-deleted only (trash view).
  • name (optional): Case-insensitive substring match on name.
  • source (optional): Narrow by source. workspace = this workspace's rows plus those visible via installed integrations; integration = only rows made visible by installed integrations; omit = union.
  • default_version_id (optional): Shorthand: filter where defaultVersionId equals this value.
  • created_by (optional): Shorthand: filter where createdBy equals this value.
  • runtime_user_id (optional): Shorthand: filter where runtimeUserId equals this value.
  • retention_tier (optional): Shorthand: filter where retentionTier equals this value.

Response

JSON
{
  "data": [
    {
      "id": "<...>",
      "workspaceId": "<...>",
      "name": "<...>",
      "description": "<...>",
      "defaultVersionId": "<...>",
      "createdBy": "<...>",
      "runtimeUserId": "<...>",
      "deletedAt": "<...>",
      "retentionTier": "<...>",
      "createdAt": "<...>",
      "updatedAt": "<...>"
    }
  ],
  "pageInfo": {
    "total": "number",
    "hasNextPage": "boolean",
    "hasPreviousPage": "boolean",
    "startCursor": "string",
    "endCursor": "string"
  }
}

POST /api/swarms

Create swarm

Request body

JSON
{
  "workspaceId": "string",
  "name": "string",
  "description?": "string",
  "instructions?": "string",
  "models?": ["string"]
}

Response

JSON
{
  "id": "string",
  "workspaceId": "string",
  "name": "string",
  "description": "string",
  "defaultVersionId": "string",
  "createdBy": "string",
  "runtimeUserId": "string",
  "deletedAt": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}

GET /api/swarms/{id}

Get a swarm by ID.

Path parameters

  • id (required): Swarm to retrieve.

Response

JSON
{
  "id": "string",
  "workspaceId": "string",
  "name": "string",
  "description": "string",
  "defaultVersionId": "string",
  "createdBy": "string",
  "runtimeUserId": "string",
  "deletedAt": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}

PATCH /api/swarms/{id}

Update swarm

Path parameters

  • id (required): The swarm's prefixed ID (e.g. swm_...).

Request body

JSON
{
  "name?": "string",
  "description?": "string",
  "runtimeUserId?": "string"
}

Response

JSON
{
  "id": "string",
  "workspaceId": "string",
  "name": "string",
  "description": "string",
  "defaultVersionId": "string",
  "createdBy": "string",
  "runtimeUserId": "string",
  "deletedAt": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}

DELETE /api/swarms/{id}

Soft-delete a swarm.

Path parameters

  • id (required): Swarm to soft-delete.

Response

JSON
{
  "success": "boolean"
}

DELETE /api/swarms/{id}/purge

Permanently delete a soft-deleted swarm.

Path parameters

  • id (required): Soft-deleted swarm to permanently delete.

Response

JSON
{
  "success": "boolean"
}

POST /api/swarms/{id}/restore

Restore a soft-deleted swarm.

Path parameters

  • id (required): Soft-deleted swarm to restore.

Response

JSON
{
  "id": "string",
  "workspaceId": "string",
  "name": "string",
  "description": "string",
  "defaultVersionId": "string",
  "createdBy": "string",
  "runtimeUserId": "string",
  "deletedAt": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}