API Reference

Complete reference for the SwarmStack REST API. All endpoints except /api/health require Bearer token authentication.

Base URL: https://api.swarmstack.net

Files API

Read, write, search, and manage files on the server.

GET /api/files/read

Read contents of a file from the server.

Query Parameters
NameTypeDescription
path requiredstringAbsolute path to the file
encodingstringFile encoding (default: utf-8)
POST /api/files/write

Write content to a file.

Request Body
NameTypeDescription
path requiredstringAbsolute path for the file
content requiredstringContent to write
GET /api/ls

List directory contents with detailed file information.

Query Parameters
NameTypeDescription
path requiredstringDirectory path to list
GET /api/files/search

Search for files matching a pattern.

Query Parameters
NameTypeDescription
path requiredstringRoot directory to search
pattern requiredstringSearch pattern (glob or regex)
DELETE /api/files

Delete a file or directory.

Query Parameters
NameTypeDescription
path requiredstringPath to delete
POST /api/mkdir

Create a new directory (with parents if needed).

Request Body
NameTypeDescription
path requiredstringDirectory path to create

Git API

Git operations for version control integration.

GET /api/git/status

Get repository status (staged, modified, untracked files).

Query Parameters
NameTypeDescription
path requiredstringRepository path
GET /api/git/diff

Get diff of changes in the repository.

GET /api/git/log

Get commit history.

GET /api/git/branch

List branches or get current branch.

POST /api/git/add

Stage files for commit.

Request Body
NameTypeDescription
path requiredstringRepository path
filesstring[]Files to stage (default: all)
POST /api/git/commit

Create a commit with staged changes.

Request Body
NameTypeDescription
path requiredstringRepository path
message requiredstringCommit message
POST /api/git/push

Push commits to remote repository.

POST /api/git/pull

Pull changes from remote repository.

Swarm API

Manage Firecracker microVMs for AI agent execution.

GET /api/swarm/status

Get status of all running VMs including PID, IP, and uptime.

POST /api/swarm/boot

Boot one or more Firecracker microVMs using snapshot restoration (~8ms per VM).

Request Body
NameTypeDescription
countnumberNumber of VMs to boot (default: 1)
POST /api/swarm/cleanup

Terminate all running VMs and clean up resources.

DELETE /api/swarm/vm/:pid

Terminate a specific VM by process ID.

Path Parameters
NameTypeDescription
pid requirednumberVM process ID

Tickets API

Work ticket management for agent task orchestration.

GET /api/tickets

List all tickets with optional filtering.

Query Parameters
NameTypeDescription
statusstringFilter by status (pending, in_progress, completed, failed)
prioritystringFilter by priority (low, medium, high, critical)
GET /api/tickets/:id

Get a specific ticket by ID.

POST /api/tickets

Create a new ticket for agent work.

Request Body
NameTypeDescription
title requiredstringTicket title
descriptionstringDetailed description
prioritystringlow, medium, high, critical
dependenciesstring[]IDs of prerequisite tickets
PATCH /api/tickets/:id

Update ticket status, assignment, or other fields.

Request Body
NameTypeDescription
statusstringNew status
assigneestringAgent ID claiming the ticket
resultobjectWork output/results
DELETE /api/tickets/:id

Delete a ticket.

Admin API

Administrative operations (elevated permissions required).

POST /api/exec

Execute a shell command on the server.

Request Body
NameTypeDescription
command requiredstringShell command to execute
cwdstringWorking directory
timeoutnumberTimeout in milliseconds
POST /api/admin/restart

Restart the API server (PM2 managed).