API Reference
Complete reference for the SwarmStack REST API. All endpoints except /api/health require Bearer token authentication.
Files API
Read, write, search, and manage files on the server.
Read contents of a file from the server.
| Name | Type | Description |
|---|---|---|
| path required | string | Absolute path to the file |
| encoding | string | File encoding (default: utf-8) |
Write content to a file.
| Name | Type | Description |
|---|---|---|
| path required | string | Absolute path for the file |
| content required | string | Content to write |
List directory contents with detailed file information.
| Name | Type | Description |
|---|---|---|
| path required | string | Directory path to list |
Search for files matching a pattern.
| Name | Type | Description |
|---|---|---|
| path required | string | Root directory to search |
| pattern required | string | Search pattern (glob or regex) |
Delete a file or directory.
| Name | Type | Description |
|---|---|---|
| path required | string | Path to delete |
Create a new directory (with parents if needed).
| Name | Type | Description |
|---|---|---|
| path required | string | Directory path to create |
Git API
Git operations for version control integration.
Get repository status (staged, modified, untracked files).
| Name | Type | Description |
|---|---|---|
| path required | string | Repository path |
Get diff of changes in the repository.
Get commit history.
List branches or get current branch.
Stage files for commit.
| Name | Type | Description |
|---|---|---|
| path required | string | Repository path |
| files | string[] | Files to stage (default: all) |
Create a commit with staged changes.
| Name | Type | Description |
|---|---|---|
| path required | string | Repository path |
| message required | string | Commit message |
Push commits to remote repository.
Pull changes from remote repository.
Swarm API
Manage Firecracker microVMs for AI agent execution.
Get status of all running VMs including PID, IP, and uptime.
Boot one or more Firecracker microVMs using snapshot restoration (~8ms per VM).
| Name | Type | Description |
|---|---|---|
| count | number | Number of VMs to boot (default: 1) |
Terminate all running VMs and clean up resources.
Terminate a specific VM by process ID.
| Name | Type | Description |
|---|---|---|
| pid required | number | VM process ID |
Tickets API
Work ticket management for agent task orchestration.
List all tickets with optional filtering.
| Name | Type | Description |
|---|---|---|
| status | string | Filter by status (pending, in_progress, completed, failed) |
| priority | string | Filter by priority (low, medium, high, critical) |
Get a specific ticket by ID.
Create a new ticket for agent work.
| Name | Type | Description |
|---|---|---|
| title required | string | Ticket title |
| description | string | Detailed description |
| priority | string | low, medium, high, critical |
| dependencies | string[] | IDs of prerequisite tickets |
Update ticket status, assignment, or other fields.
| Name | Type | Description |
|---|---|---|
| status | string | New status |
| assignee | string | Agent ID claiming the ticket |
| result | object | Work output/results |
Delete a ticket.
Admin API
Administrative operations (elevated permissions required).
Execute a shell command on the server.
| Name | Type | Description |
|---|---|---|
| command required | string | Shell command to execute |
| cwd | string | Working directory |
| timeout | number | Timeout in milliseconds |
Restart the API server (PM2 managed).