API reference

REST API for programmatic access to ServersCamp infrastructure. Manage VMs, storage, networks, and more.

Overview

The ServersCamp API is a RESTful API that allows you to manage your cloud infrastructure programmatically.

Base URL

https://platform.serverscamp.com/api/v1

Request format

All requests should include:

  • Content-Type: application/json for requests with body
  • Authorization: Bearer <token> header

Response format

All responses are JSON. Successful responses return the requested data directly. Errors return an object with detail field.

Authentication

All API requests require authentication using an API token. Tokens are prefixed with sc_.

Getting an API token

Generate API tokens in the Platform Settings.

Using your token

Include the token in the Authorization header:

curl -X GET "https://platform.serverscamp.com/api/v1/vms" \
  -H "Authorization: Bearer sc_your_token_here"
import requests

API_TOKEN = "sc_your_token_here"
BASE_URL = "https://platform.serverscamp.com/api/v1"

headers = {"Authorization": f"Bearer {API_TOKEN}"}
response = requests.get(f"{BASE_URL}/vms", headers=headers)
vms = response.json()

Error handling

The API uses standard HTTP status codes:

CodeMeaning
200Success
201Created
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing token
403Forbidden - Insufficient permissions
404Not Found - Resource doesn't exist
422Validation Error - Check request body
500Server Error - Contact support

Error response

{"detail": "VM not found"}

Virtual machines

Create and manage virtual machine instances.

List VMs

GET /vms
curl -X GET "https://platform.serverscamp.com/api/v1/vms" \
  -H "Authorization: Bearer $API_TOKEN"

Response

[
  {
    "uuid": "06837545-c878-443b-a114-ddab3b8c6e90",
    "display_name": "web-server-01",
    "state": "running",
    "vm_class": {"name": "burst-xs", "cpu_cores": 1, "ram_mb": 1024},
    "disk_gb": 20,
    "internal_ip": "172.31.106.70",
    "public_ipv4": "194.110.174.102"
  }
]

Create VM

POST /vms
ParameterTypeDescription
display_namestringOptional. Human-readable name
vm_class_idintegerRequired. VM class ID from GET /vm-classes (hardware generation, profile, vCPU, RAM)
storage_class_idintegerRequired. Disk class ID from GET /storage-classes
vm_template_idintegerRequired. OS template from GET /vm-templates
network_uuidstringRequired. Network UUID to attach the VM to
disk_gbintegerRequired. Root disk size in GB (bounds depend on the disk class)
ssh_key_idintegerOptional. SSH key for access
assign_public_ipsbooleanOptional. Assign public IPv4/IPv6
curl -X POST "https://platform.serverscamp.com/api/v1/vms" \
  -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "display_name": "web-server",
    "vm_class_id": 2,
    "vm_template_id": 1,
    "storage_class_id": 12,
    "network_uuid": "8f14e45f-...-net",
    "disk_gb": 25,
    "ssh_key_id": 7,
    "assign_public_ips": true
  }'

Get VM details

GET /vms/{vm_uuid}

Delete VM

DELETE /vms/{vm_uuid}

Control VM power

POST /vms/{vm_uuid}/power

Body: {"action": "start"}. Available actions: start, shutdown, destroy, reboot, reset

Networking

List networks

GET /network

Create network

POST /network
ParameterTypeDescription
display_namestringOptional. Network name
cidrstringRequired. IP range (e.g., 10.0.0.0/24)

List routers

GET /router

Create router

POST /router

Attach network to router

POST /network/{network_uuid}/attach

Body: {"router_uuid": "..."}. Detach with DELETE /network/{network_uuid}/detach.

SSH keys

List SSH keys

GET /ssh-keys

Create SSH key

POST /ssh-keys
ParameterTypeDescription
namestringRequired. Key name
public_keystringRequired. SSH public key content

Delete SSH key

DELETE /ssh-keys/{key_id}

Resource classes

List VM classes

GET /vm-classes

List storage classes

GET /storage-classes

List hardware classes

GET /hardware-classes

List OS templates

GET /vm-templates