Machines API
Manage your connected machines.
List Machines
GET /machinesQuery Parameters
| Parameter | Type | Description |
|---|---|---|
status | string | Filter by status: online, offline |
tags | string | Comma-separated tags |
search | string | Search by name |
limit | number | Results per page (default: 20) |
offset | number | Offset for pagination |
Example
curl "https://api.cmdop.com/v1/machines?status=online&limit=10" \
-H "Authorization: Bearer TOKEN"Response
{
"data": [
{
"id": "mach_abc123",
"name": "production-server",
"status": "online",
"os": "linux",
"arch": "amd64",
"hostname": "prod-1.example.com",
"tags": ["production", "web"],
"created_at": "2024-01-15T10:30:00Z",
"last_seen": "2024-01-20T15:45:00Z"
}
],
"meta": {
"total": 5,
"limit": 10,
"offset": 0
}
}Get Machine
GET /machines/:idExample
curl https://api.cmdop.com/v1/machines/mach_abc123 \
-H "Authorization: Bearer TOKEN"Response
{
"data": {
"id": "mach_abc123",
"name": "production-server",
"status": "online",
"os": "linux",
"arch": "amd64",
"hostname": "prod-1.example.com",
"ip": "192.168.1.100",
"tags": ["production", "web"],
"agent_version": "1.2.3",
"created_at": "2024-01-15T10:30:00Z",
"last_seen": "2024-01-20T15:45:00Z"
}
}Get Machine Status
GET /machines/:id/statusResponse
{
"data": {
"connected": true,
"uptime": 86400,
"last_ping": "2024-01-20T15:45:00Z",
"cpu": {
"usage": 45.2,
"cores": 4
},
"memory": {
"total": 8589934592,
"used": 4294967296,
"free": 4294967296
},
"disk": {
"total": 107374182400,
"used": 53687091200,
"free": 53687091200
}
}
}Update Machine
PATCH /machines/:idRequest Body
{
"name": "new-name",
"tags": ["production", "api"]
}Example
curl -X PATCH https://api.cmdop.com/v1/machines/mach_abc123 \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "new-name"}'Delete Machine
DELETE /machines/:idExample
curl -X DELETE https://api.cmdop.com/v1/machines/mach_abc123 \
-H "Authorization: Bearer TOKEN"Response
{
"data": {
"deleted": true
}
}