REST API¶
Plitho provides a REST API for programmatic access to all features.
Base URL¶
https://your-server:8080/api
Authentication¶
All endpoints require session authentication. Log in via the dashboard first, then use the session cookies.
# Login
curl -c cookies.txt -d '{"username":"admin","password":"secret"}' \
https://your-server:8080/login
# Use cookies for subsequent requests
curl -b cookies.txt https://your-server:8080/api/apps
Apps¶
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/apps |
List your apps |
| POST | /api/apps |
Create app |
| GET | /api/apps/{name} |
Get app details |
| DELETE | /api/apps/{name} |
Delete app |
| POST | /api/apps/{name}/start |
Start/deploy |
| POST | /api/apps/{name}/stop |
Stop |
| POST | /api/apps/{name}/reload |
Restart |
| POST | /api/apps/{name}/scale |
Scale workers |
| GET | /api/apps/{name}/status |
App status |
| GET | /api/apps/{name}/metrics |
CPU/memory metrics |
| GET | /api/apps/{name}/logs/stream |
Live logs (SSE) |
List Apps¶
GET /api/apps
[
{
"name": "myapp",
"status": "running",
"runtime": "node",
"port": 3000,
"revision": "abc1234"
}
]
Scale App¶
POST /api/apps/myapp/scale?web=4
Databases¶
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/databases |
List databases |
| POST | /api/databases |
Create database |
| DELETE | /api/databases/{name} |
Drop database |
| POST | /api/databases/{name}/extensions |
Add extension |
| POST | /api/databases/{name}/reset-password |
Reset password |
Cache¶
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/cache |
List cache instances |
| POST | /api/cache |
Create cache instance |
| DELETE | /api/cache/{name} |
Delete cache instance |
| POST | /api/cache/{name}/restart |
Restart cache |
| POST | /api/cache/{name}/reset-password |
Reset password |
| GET | /api/cache/{name}/stats |
Cache stats |
Cache — Resource Quota¶
| Method | Endpoint | Description |
|---|---|---|
| PUT | /api/cache/{name}/resources |
Update CPU / memory / storage quota |
Request body: {"max_cpu_millicores": 500, "max_memory_mb": 256, "storage_mb": 2048}
Data Services¶
Managed stateful services (NATS, MongoDB, RabbitMQ/LavinMQ).
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/data-services |
List your services |
| POST | /api/data-services |
Create a service |
| GET | /api/data-services/{type}/{name} |
Get service details |
| DELETE | /api/data-services/{type}/{name} |
Delete service + data |
| POST | /api/data-services/{type}/{name}/restart |
Restart |
| PUT | /api/data-services/{type}/{name}/resources |
Update CPU / memory / storage |
| POST | /api/data-services/{type}/{name}/reset-credentials |
Rotate password |
| PUT | /api/data-services/{type}/{name}/backup |
Configure backup schedule |
Create Data Service¶
POST /api/data-services
{
"type": "nats",
"name": "my-nats",
"max_cpu_millicores": 500,
"max_memory_mb": 256,
"storage_mb": 1024,
"backup_enabled": true,
"backup_schedule": "*-*-* 02:00:00",
"credentials": {"password": "mysecret"}
}
Supported types: nats, mongodb, rabbitmq.
Response includes port and a reminder to save credentials (not stored after response).
Update Resources¶
PUT /api/data-services/nats/my-nats/resources
{"max_cpu_millicores": 1000, "max_memory_mb": 512, "storage_mb": 4096}
Configure Backup¶
PUT /api/data-services/mongodb/mydb/backup
{"backup_enabled": true, "backup_schedule": "Sun *-*-* 03:00:00"}
Disable: {"backup_enabled": false}.
Deployments¶
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/deployments |
List all deployments |
| GET | /api/apps/{name}/deployments |
List app deployments |
| GET | /api/apps/{name}/deployments/{id} |
Deployment details |
| GET | /api/apps/{name}/deployments/{id}/events |
Deployment events (SSE) |
Templates¶
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/templates |
List available templates |
| GET | /api/templates/{id} |
Template details |
| POST | /api/templates/install |
Install template |
| POST | /api/templates/{appName}/upgrade |
Upgrade template |
| GET | /api/templates/installed |
List installed templates |
SSH Keys¶
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/settings/ssh-keys |
List your keys |
| POST | /api/settings/ssh-keys |
Add key |
| DELETE | /api/settings/ssh-keys/{fingerprint} |
Remove key |
Server-Sent Events (SSE)¶
Some endpoints stream real-time data:
/api/apps/{name}/logs/stream— Live log output/api/apps/{name}/deployments/{id}/events— Deployment progress
const events = new EventSource('/api/apps/myapp/logs/stream');
events.onmessage = (e) => console.log(JSON.parse(e.data));