Services API
List Services
Section titled "List Services"/v1/sprites/{name}/servicesList all configured services and their current state.
Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | Success |
404 | Not Found - Resource not found |
500 | Internal Server Error |
[{ "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" }}]Get Service
Section titled "Get Service"/v1/sprites/{name}/services/{service_name}Get details of a specific service.
Responses
Section titled “Responses”| Status | Description |
|---|---|
200 | Success |
404 | Not Found - Resource not found |
500 | Internal Server Error |
{"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"}}Create Service
Section titled "Create Service"/v1/sprites/{name}/services/{service_name}Create or update a service definition.
Query Parameters
Time to monitor logs after starting (default: `5s`)
Request Body
Command to execute
Command arguments
Environment variables to add to the base service environment
Working directory for the service
Service dependencies (started first)
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 |
{"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"}}Start Service
Section titled "Start Service"/v1/sprites/{name}/services/{service_name}/startStart a service. Returns streaming NDJSON with stdout/stderr.
Query Parameters
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 | number | 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 | number | Unix milliseconds |
{"data":"Warning: deprecated API usage\n","timestamp":1767609000000,"type":"stderr"}| Field | Type | Description |
|---|---|---|
type | string | (const: "exit") |
exit_code | number | Process exit code |
timestamp | number | Unix milliseconds |
{"exit_code":0,"timestamp":1767609000000,"type":"exit"}| Field | Type | Description |
|---|---|---|
type | string | (const: "error") |
data | string | Error message |
timestamp | number | 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 | number | 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 | number | Unix milliseconds |
{"timestamp":1767609000000,"type":"started"}[{ "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"}]Stop Service
Section titled "Stop Service"/v1/sprites/{name}/services/{service_name}/stopStop a running service. Returns streaming NDJSON with service stop progress.
Query Parameters
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 | number | Unix milliseconds |
{"timestamp":1767609000000,"type":"stopping"}stdout
Section titled “stdout”| Field | Type | Description |
|---|---|---|
type | string | (const: "stdout") |
data | string | Log line content |
timestamp | number | 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 | number | Unix milliseconds |
{"data":"Warning: deprecated API usage\n","timestamp":1767609000000,"type":"stderr"}| Field | Type | Description |
|---|---|---|
type | string | (const: "error") |
data | string | Error message |
timestamp | number | 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 | number | Process exit code |
timestamp | number | Unix milliseconds |
{"exit_code":0,"timestamp":1767609000000,"type":"stopped"}complete
Section titled “complete”| Field | Type | Description |
|---|---|---|
type | string | (const: "complete") |
timestamp | number | 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"}[{ "timestamp": 1735988400000, "type": "stopping"},{ "exit_code": 0, "timestamp": 1735988401000, "type": "stopped"},{ "log_files": { "stdout": "/.sprite/logs/services/webapp.log" }, "timestamp": 1735988402000, "type": "complete"}]Restart Service
Section titled "Restart Service"/v1/sprites/{name}/services/{service_name}/restartRestart a service (stop if running, then start). Returns streaming NDJSON with stop and start progress.
Query Parameters
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:
stopping
Section titled “stopping”| Field | Type | Description |
|---|---|---|
type | string | (const: "stopping") |
timestamp | number | Unix milliseconds |
{"timestamp":1767609000000,"type":"stopping"}stopped
Section titled “stopped”| Field | Type | Description |
|---|---|---|
type | string | (const: "stopped") |
exit_code | number | Process exit code |
timestamp | number | Unix milliseconds |
{"exit_code":0,"timestamp":1767609000000,"type":"stopped"}stdout
Section titled “stdout”| Field | Type | Description |
|---|---|---|
type | string | (const: "stdout") |
data | string | Log line content |
timestamp | number | 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 | number | Unix milliseconds |
{"data":"Warning: deprecated API usage\n","timestamp":1767609000000,"type":"stderr"}| Field | Type | Description |
|---|---|---|
type | string | (const: "exit") |
exit_code | number | Process exit code |
timestamp | number | Unix milliseconds |
{"exit_code":0,"timestamp":1767609000000,"type":"exit"}| Field | Type | Description |
|---|---|---|
type | string | (const: "error") |
data | string | Error message |
timestamp | number | 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 | number | 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 | number | Unix milliseconds |
{"timestamp":1767609000000,"type":"started"}Get Service Logs
Section titled "Get Service Logs"/v1/sprites/{name}/services/{service_name}/logsStream logs for a service.
Query Parameters
Number of lines to return from log buffer (default: all)
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 | number | 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 | number | Unix milliseconds |
{"data":"Warning: deprecated API usage\n","timestamp":1767609000000,"type":"stderr"}| Field | Type | Description |
|---|---|---|
type | string | (const: "exit") |
exit_code | number | Process exit code |
timestamp | number | Unix milliseconds |
{"exit_code":0,"timestamp":1767609000000,"type":"exit"}| Field | Type | Description |
|---|---|---|
type | string | (const: "error") |
data | string | Error message |
timestamp | number | 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 | number | 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"}[{ "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"}]