Filesystem API
WebSocket Endpoints — Some endpoints in this section use WebSocket for bidirectional communication. The SDK handles the connection protocol automatically.
Read File
Section titled "Read File"/v1/sprites/{name}/fs/readRead file contents from the sprite filesystem. Returns raw file bytes.
Query Parameters
Path to the file to read
Working directory for resolving relative paths
Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | Success |
404 | Not Found - Resource not found |
500 | Internal Server Error |
Write File
Section titled "Write File"/v1/sprites/{name}/fs/writeWrite file contents to the sprite filesystem. Request body contains raw file bytes.
Query Parameters
Path to the file to write
Working directory for resolving relative paths
File permissions in octal (e.g., '0644')
Create parent directories if they don't exist
Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | Success |
400 | Bad Request - Invalid request body |
404 | Not Found - Resource not found |
500 | Internal Server Error |
Query Parameters
Path to the directory to list
Working directory for resolving relative paths
Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | Success |
404 | Not Found - Resource not found |
500 | Internal Server Error |
Delete File or Directory
Section titled "Delete File or Directory"/v1/sprites/{name}/fs/deleteDelete a file or directory.
Request Body
Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | Success |
400 | Bad Request - Invalid request body |
404 | Not Found - Resource not found |
500 | Internal Server Error |
Rename File or Directory
Section titled "Rename File or Directory"/v1/sprites/{name}/fs/renameRename or move a file or directory.
Request Body
Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | Success |
400 | Bad Request - Invalid request body |
404 | Not Found - Resource not found |
500 | Internal Server Error |
Copy File or Directory
Section titled "Copy File or Directory"/v1/sprites/{name}/fs/copyCopy a file or directory.
Request Body
Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | Success |
400 | Bad Request - Invalid request body |
404 | Not Found - Resource not found |
500 | Internal Server Error |
Change File Mode
Section titled "Change File Mode"/v1/sprites/{name}/fs/chmodChange file or directory permissions.
Request Body
Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | Success |
400 | Bad Request - Invalid request body |
404 | Not Found - Resource not found |
500 | Internal Server Error |
Change File Owner
Section titled "Change File Owner"/v1/sprites/{name}/fs/chownChange file or directory ownership.
Request Body
Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | Success |
400 | Bad Request - Invalid request body |
404 | Not Found - Resource not found |
500 | Internal Server Error |
Watch Filesystem
Section titled "Watch Filesystem"/v1/sprites/{name}/fs/watchWatch for filesystem changes via WebSocket.
Responses
Section titled “Responses”| Status | Description |
|---|---|
101 | Switching Protocols - WebSocket connection established |
400 | Bad Request - Invalid WebSocket upgrade or missing parameters |
404 | Not Found - Resource not found |
Client → Server Messages
Section titled “Client → Server Messages”WatchMessage
Section titled “WatchMessage”| Field | Type | Description |
|---|---|---|
type | string | |
paths | string[] | |
recursive | boolean | |
workingDir | string | |
path | string | |
event | string | |
timestamp | string | |
size | number | |
isDir | boolean | |
message | string |
Server → Client Messages
Section titled “Server → Client Messages”WatchMessage
Section titled “WatchMessage”| Field | Type | Description |
|---|---|---|
type | string | |
paths | string[] | |
recursive | boolean | |
workingDir | string | |
path | string | |
event | string | |
timestamp | string | |
size | number | |
isDir | boolean | |
message | string |