Virtual Machines API
Manage Trusted Execution Environment (TEE) Virtual Machines through the API.
List VMs
Get all VMs for a project:
curl https://api.teenode.com/v1/projects/proj_abc123/vms \
-H "Authorization: Bearer YOUR_API_KEY"Get VM Details
Retrieve detailed information about a VM:
curl https://api.teenode.com/v1/vms/vm_xyz789 \
-H "Authorization: Bearer YOUR_API_KEY"Response:
{
"id": "vm_xyz789",
"project_id": "proj_abc123",
"name": "my-secure-vm",
"status": "RUNNING",
"region": "us-east",
"specs": {
"cpu": 2,
"memory": 4096,
"disk": 50
},
"ip_address": "203.0.113.42",
"created_at": "2024-01-15T10:00:00Z",
"attestation": {
"enabled": true,
"measurement": "a1b2c3d4..."
}
}Start a VM
Start a stopped VM:
curl -X POST https://api.teenode.com/v1/vms/vm_xyz789/start \
-H "Authorization: Bearer YOUR_API_KEY"Stop a VM
Stop a running VM:
curl -X POST https://api.teenode.com/v1/vms/vm_xyz789/stop \
-H "Authorization: Bearer YOUR_API_KEY"Restart a VM
Restart a VM:
curl -X POST https://api.teenode.com/v1/vms/vm_xyz789/restart \
-H "Authorization: Bearer YOUR_API_KEY"Resize a VM
Update VM resources:
curl -X PATCH https://api.teenode.com/v1/vms/vm_xyz789 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"specs": {
"cpu": 4,
"memory": 8192
}
}'Resizing requires a VM restart. Save your work before proceeding.
Get VM Metrics
Retrieve performance metrics:
curl https://api.teenode.com/v1/vms/vm_xyz789/metrics?period=1h \
-H "Authorization: Bearer YOUR_API_KEY"Response:
{
"cpu_usage": [
{"timestamp": "2024-01-15T14:00:00Z", "value": 45.2},
{"timestamp": "2024-01-15T14:05:00Z", "value": 52.1}
],
"memory_usage": [
{"timestamp": "2024-01-15T14:00:00Z", "value": 2048},
{"timestamp": "2024-01-15T14:05:00Z", "value": 2304}
],
"disk_usage": 25600
}Get Attestation Report
Retrieve the AMD SEV-SNP attestation report:
curl https://api.teenode.com/v1/vms/vm_xyz789/attestation \
-H "Authorization: Bearer YOUR_API_KEY"Response:
{
"report": "base64_encoded_attestation_report",
"measurement": "a1b2c3d4e5f6...",
"verified": true,
"timestamp": "2024-01-15T14:30:00Z",
"platform": {
"vendor": "AMD",
"model": "EPYC 7003",
"firmware_version": "1.51.03"
}
}Console Access
Get console access URL (VNC/Serial):
curl -X POST https://api.teenode.com/v1/vms/vm_xyz789/console \
-H "Authorization: Bearer YOUR_API_KEY"Response:
{
"url": "wss://console.teenode.com/vm_xyz789?token=abc123",
"expires_at": "2024-01-15T15:00:00Z"
}Create Snapshot
Create a point-in-time snapshot:
curl -X POST https://api.teenode.com/v1/vms/vm_xyz789/snapshots \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "before-upgrade"
}'Restore from Snapshot
Restore a VM to a previous snapshot:
curl -X POST https://api.teenode.com/v1/vms/vm_xyz789/restore \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"snapshot_id": "snap_abc123"
}'Restoring a snapshot will replace all current data with the snapshot data.
VM Status
CREATING- VM is being provisionedRUNNING- VM is active and runningSTOPPED- VM is stoppedREBOOTING- VM is restartingERROR- VM encountered an errorDELETING- VM is being deleted