Services API
Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | Success |
404 | Not Found - Resource not found |
500 | Internal Server Error |
Request
Response
[{ "args": [ "-D", "/var/lib/postgresql/data" ], "cmd": "postgres", "http_port": null, "name": "postgres", "needs": [], "state": { "name": "postgres", "pid": 1234, "started_at": "2026-01-05T08:00:00Z", "status": "running" }},{ "args": [ "-m", "http.server", "8000" ], "cmd": "python", "http_port": 8000, "name": "webapp", "needs": [ "postgres" ], "state": { "name": "webapp", "pid": 1567, "started_at": "2026-01-05T08:01:00Z", "status": "running" }}]Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | Success |
404 | Not Found - Resource not found |
500 | Internal Server Error |
Request
Response
{"args": [ "-m", "http.server", "8000"],"cmd": "python","http_port": 8000,"name": "webapp","needs": [ "postgres"],"state": { "name": "webapp", "pid": 1567, "started_at": "2026-01-05T08:01:00Z", "status": "running"}}Query Parameters
duration:optionalduration
Time to monitor logs after starting (default: `5s`)
Request Body
cmd:string
Command to execute
args:[]string
Command arguments
needs:[]string
Service dependencies (started first)
http_port:optional*int
HTTP port for proxy routing
Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | Success |
400 | Bad Request - Invalid request body |
404 | Not Found - Resource not found |
500 | Internal Server Error |
Request
Response
{"args": [ "-m", "http.server", "8000"],"cmd": "python","http_port": 8000,"name": "webapp","needs": [ "postgres"],"state": { "name": "webapp", "started_at": "2026-01-05T10:30:00Z", "status": "starting"}}Query Parameters
duration:optionalduration
Time to monitor logs after starting (default: `5s`)
Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | Success - Streaming NDJSON response |
404 | Not Found - Resource not found |
500 | Internal Server Error |
Streaming Events
Section titled “Streaming Events”This endpoint returns streaming NDJSON. Each line is one of these event types:
stdout
Section titled “stdout”| Field | Type | Description |
|---|---|---|
type | string | (const: "stdout") |
data | string | Log line content |
timestamp | int64 | Unix milliseconds |
{"data":"Server listening on port 3000\n","timestamp":1767609000000,"type":"stdout"}stderr
Section titled “stderr”| Field | Type | Description |
|---|---|---|
type | string | (const: "stderr") |
data | string | Log line content |
timestamp | int64 | Unix milliseconds |
{"data":"Warning: deprecated API usage\n","timestamp":1767609000000,"type":"stderr"}| Field | Type | Description |
|---|---|---|
type | string | (const: "exit") |
exit_code | int | Process exit code |
timestamp | int64 | Unix milliseconds |
{"exit_code":0,"timestamp":1767609000000,"type":"exit"}| Field | Type | Description |
|---|---|---|
type | string | (const: "error") |
data | string | Error message |
timestamp | int64 | Unix milliseconds |
{"data":"Failed to start service: command not found","timestamp":1767609000000,"type":"error"}complete
Section titled “complete”| Field | Type | Description |
|---|---|---|
type | string | (const: "complete") |
timestamp | int64 | Unix milliseconds |
{"log_files":{"combined":"/.sprite/logs/services/webapp.log","stderr":"/.sprite/logs/services/webapp.log","stdout":"/.sprite/logs/services/webapp.log"},"timestamp":1767609000000,"type":"complete"}started
Section titled “started”| Field | Type | Description |
|---|---|---|
type | string | (const: "started") |
timestamp | int64 | Unix milliseconds |
{"timestamp":1767609000000,"type":"started"} Request
Response
[{ "timestamp": 1735988400000, "type": "started"},{ "data": "Starting server...\n", "timestamp": 1735988400000, "type": "stdout"},{ "data": "Listening on port 8000\n", "timestamp": 1735988401000, "type": "stdout"},{ "log_files": { "stdout": "/.sprite/logs/services/webapp.log" }, "timestamp": 1735988402000, "type": "complete"}]Query Parameters
timeout:optionalduration
Timeout waiting for service to stop (default: `10s`)
Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | Success - Streaming NDJSON response |
404 | Not Found - Resource not found |
500 | Internal Server Error |
Streaming Events
Section titled “Streaming Events”This endpoint returns streaming NDJSON. Each line is one of these event types:
stopping
Section titled “stopping”| Field | Type | Description |
|---|---|---|
type | string | (const: "stopping") |
timestamp | int64 | Unix milliseconds |
{"timestamp":1767609000000,"type":"stopping"}stdout
Section titled “stdout”| Field | Type | Description |
|---|---|---|
type | string | (const: "stdout") |
data | string | Log line content |
timestamp | int64 | Unix milliseconds |
{"data":"Server listening on port 3000\n","timestamp":1767609000000,"type":"stdout"}stderr
Section titled “stderr”| Field | Type | Description |
|---|---|---|
type | string | (const: "stderr") |
data | string | Log line content |
timestamp | int64 | Unix milliseconds |
{"data":"Warning: deprecated API usage\n","timestamp":1767609000000,"type":"stderr"}| Field | Type | Description |
|---|---|---|
type | string | (const: "error") |
data | string | Error message |
timestamp | int64 | Unix milliseconds |
{"data":"Failed to start service: command not found","timestamp":1767609000000,"type":"error"}stopped
Section titled “stopped”| Field | Type | Description |
|---|---|---|
type | string | (const: "stopped") |
exit_code | int | Process exit code |
timestamp | int64 | Unix milliseconds |
{"exit_code":0,"timestamp":1767609000000,"type":"stopped"}complete
Section titled “complete”| Field | Type | Description |
|---|---|---|
type | string | (const: "complete") |
timestamp | int64 | Unix milliseconds |
{"log_files":{"combined":"/.sprite/logs/services/webapp.log","stderr":"/.sprite/logs/services/webapp.log","stdout":"/.sprite/logs/services/webapp.log"},"timestamp":1767609000000,"type":"complete"} Request
Response
[{ "timestamp": 1735988400000, "type": "stopping"},{ "exit_code": 0, "timestamp": 1735988401000, "type": "stopped"},{ "log_files": { "stdout": "/.sprite/logs/services/webapp.log" }, "timestamp": 1735988402000, "type": "complete"}]Query Parameters
lines:optionalint
Number of lines to return from log buffer (default: all)
duration:optionalduration
Time to follow new logs (default: `0`, no follow)
Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | Success - Streaming NDJSON response |
404 | Not Found - Resource not found |
500 | Internal Server Error |
Streaming Events
Section titled “Streaming Events”This endpoint returns streaming NDJSON. Each line is one of these event types:
stdout
Section titled “stdout”| Field | Type | Description |
|---|---|---|
type | string | (const: "stdout") |
data | string | Log line content |
timestamp | int64 | Unix milliseconds |
{"data":"Server listening on port 3000\n","timestamp":1767609000000,"type":"stdout"}stderr
Section titled “stderr”| Field | Type | Description |
|---|---|---|
type | string | (const: "stderr") |
data | string | Log line content |
timestamp | int64 | Unix milliseconds |
{"data":"Warning: deprecated API usage\n","timestamp":1767609000000,"type":"stderr"}| Field | Type | Description |
|---|---|---|
type | string | (const: "exit") |
exit_code | int | Process exit code |
timestamp | int64 | Unix milliseconds |
{"exit_code":0,"timestamp":1767609000000,"type":"exit"}| Field | Type | Description |
|---|---|---|
type | string | (const: "error") |
data | string | Error message |
timestamp | int64 | Unix milliseconds |
{"data":"Failed to start service: command not found","timestamp":1767609000000,"type":"error"}complete
Section titled “complete”| Field | Type | Description |
|---|---|---|
type | string | (const: "complete") |
timestamp | int64 | Unix milliseconds |
{"log_files":{"combined":"/.sprite/logs/services/webapp.log","stderr":"/.sprite/logs/services/webapp.log","stdout":"/.sprite/logs/services/webapp.log"},"timestamp":1767609000000,"type":"complete"} Request
Response
[{ "data": "Server started\n", "timestamp": 1735988400000, "type": "stdout"},{ "data": "Handling request from 127.0.0.1\n", "timestamp": 1735988450000, "type": "stdout"},{ "data": "Warning: slow query detected\n", "timestamp": 1735988455000, "type": "stderr"},{ "log_files": { "stdout": "/.sprite/logs/services/webapp.log" }, "timestamp": 1735988460000, "type": "complete"}]